[Scummvm-cvs-logs] scummvm master -> 657edcf84e97d9c6b044ae3f3687fa9aba9e9ce9
sev-
sev at scummvm.org
Fri Mar 18 11:45:49 CET 2016
This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
671d3faa71 WAGE: Initial code for border manipulation
1aa5f0d4c8 WAGE: Correction to highlighted border drawing
9707a8b359 WAGE: Fixed border highlighting
657edcf84e WAGE: Plugged in console scrolling up/down
Commit: 671d3faa7199cdea4f2214742735b36d52f0e7fa
https://github.com/scummvm/scummvm/commit/671d3faa7199cdea4f2214742735b36d52f0e7fa
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-03-18T11:45:29+01:00
Commit Message:
WAGE: Initial code for border manipulation
Changed paths:
engines/wage/gui.cpp
engines/wage/gui.h
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index 387731c..91a9cfe 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -294,10 +294,10 @@ void Gui::drawBox(Graphics::Surface *g, int x, int y, int w, int h) {
g->frameRect(r, kColorBlack);
}
-void Gui::fillRect(Graphics::Surface *g, int x, int y, int w, int h) {
+void Gui::fillRect(Graphics::Surface *g, int x, int y, int w, int h, int color) {
Common::Rect r(x, y, x + w, y + h);
- g->fillRect(r, kColorBlack);
+ g->fillRect(r, color);
}
#define ARROW_W 12
@@ -310,8 +310,8 @@ const int arrowPixels[ARROW_H][ARROW_W] = {
{0,1,1,1,1,1,1,1,1,1,1,0},
{1,1,1,1,1,1,1,1,1,1,1,1}};
-void Gui::paintBorder(Graphics::Surface *g, Common::Rect &r, WindowType windowType) {
- bool active = false, scrollable = false, closeable = false, closeBoxPressed = false, drawTitle = false;
+void Gui::paintBorder(Graphics::Surface *g, Common::Rect &r, WindowType windowType, int highlightedPart) {
+ bool active = false, scrollable = false, closeable = false, drawTitle = false;
const int size = kBorderWidth;
int x = r.left - size;
int y = r.top - size;
@@ -323,14 +323,12 @@ void Gui::paintBorder(Graphics::Surface *g, Common::Rect &r, WindowType windowTy
active = _sceneIsActive;
scrollable = false;
closeable = _sceneIsActive;
- closeBoxPressed = false;
drawTitle = true;
break;
case kWindowConsole:
active = !_sceneIsActive;
scrollable = true;
closeable = !_sceneIsActive;
- closeBoxPressed = false;
drawTitle = false;
break;
}
@@ -353,29 +351,43 @@ void Gui::paintBorder(Graphics::Surface *g, Common::Rect &r, WindowType windowTy
} else {
int x1 = x + width - 15;
int y1 = y + size + 1;
+ int color1 = kColorBlack;
+ int color2 = kColorWhite;
+ if (highlightedPart == kBorderScrollUp) {
+ SWAP(color1, color2);
+ fillRect(g, x + width - kBorderWidth, y, x + width, y + height / 2);
+ }
for (int yy = 0; yy < ARROW_H; yy++) {
for (int xx = 0; xx < ARROW_W; xx++) {
if (arrowPixels[yy][xx] != 0) {
- g->hLine(x1 + xx, y1 + yy, x1 + xx, kColorBlack);
+ g->hLine(x1 + xx, y1 + yy, x1 + xx, color1);
} else {
- g->hLine(x1 + xx, y1 + yy, x1 + xx, kColorWhite);
+ g->hLine(x1 + xx, y1 + yy, x1 + xx, color2);
}
}
}
- fillRect(g, x + width - 13, y + size + ARROW_H, 8, height - 2 * size - 1 - ARROW_H * 2);
+ fillRect(g, x + width - 13, y + size + ARROW_H, 8, height - 2 * size - 1 - ARROW_H * 2, color1);
+
+ color1 = kColorBlack;
+ color2 = kColorWhite;
+ if (highlightedPart == kBorderScrollDown) {
+ SWAP(color1, color2);
+ fillRect(g, x + width - kBorderWidth, y + height / 2, x + width, y + height);
+ }
+ fillRect(g, x + width - 13, y + size + ARROW_H, 8, height - 2 * size - 1 - ARROW_H * 2, color1);
y1 += height - 2 * size - ARROW_H - 2;
for (int yy = 0; yy < ARROW_H; yy++) {
for (int xx = 0; xx < ARROW_W; xx++) {
if (arrowPixels[ARROW_H - yy - 1][xx] != 0) {
- g->hLine(x1 + xx, y1 + yy, x1 + xx, kColorBlack);
+ g->hLine(x1 + xx, y1 + yy, x1 + xx, color1);
} else {
- g->hLine(x1 + xx, y1 + yy, x1 + xx, kColorWhite);
+ g->hLine(x1 + xx, y1 + yy, x1 + xx, color2);
}
}
}
}
if (closeable) {
- if (closeBoxPressed) {
+ if (highlightedPart == kBorderCloseButton) {
fillRect(g, x + 6, y + 6, 6, 6);
} else {
drawBox(g, x + 5, y + 5, 7, 7);
@@ -499,6 +511,26 @@ void Gui::popCursor() {
CursorMan.popCursor();
}
+static int isInBorder(Common::Rect &rect, int x, int y) {
+ if (x >= rect.left - kBorderWidth && x < rect.left && y >= rect.top - kBorderWidth && y < rect.top)
+ return kBorderCloseButton;
+
+ if (x >= rect.right && x < rect.right + kBorderWidth) {
+ if (y < rect.top - kBorderWidth)
+ return kBorderNone;
+
+ if (y >= rect.bottom + kBorderWidth)
+ return kBorderNone;
+
+ if (y >= rect.top + rect.height() / 2)
+ return kBorderScrollDown;
+
+ return kBorderScrollUp;
+ }
+
+ return kBorderNone;
+}
+
Designed *Gui::mouseUp(int x, int y) {
if (_menu->_menuActivated) {
if (_menu->mouseRelease(x, y)) {
@@ -532,6 +564,8 @@ Designed *Gui::mouseUp(int x, int y) {
}
}
+ int borderClick;
+
if (_sceneArea.contains(x, y)) {
if (!_sceneIsActive) {
_sceneIsActive = true;
@@ -552,16 +586,23 @@ Designed *Gui::mouseUp(int x, int y) {
_sceneIsActive = false;
_bordersDirty = true;
}
+ } else if ((borderClick = isInBorder(_consoleTextArea, x, y)) != kBorderNone) {
+ _bordersDirty = true;
+ warning("Border: %d", borderClick);
}
return NULL;
}
void Gui::mouseDown(int x, int y) {
+ int borderClick;
+
if (_menu->mouseClick(x, y)) {
_menuDirty = true;
} else if (_consoleTextArea.contains(x, y)) {
startMarking(x, y);
+ } else if ((borderClick = isInBorder(_consoleTextArea, x, y)) != kBorderNone) {
+ paintBorder(&_screen, _consoleTextArea, kWindowConsole, borderClick);
}
}
diff --git a/engines/wage/gui.h b/engines/wage/gui.h
index 61f8c31..73814d3 100644
--- a/engines/wage/gui.h
+++ b/engines/wage/gui.h
@@ -84,6 +84,13 @@ enum {
kPatternCheckers2 = 4
};
+enum {
+ kBorderNone = 0,
+ kBorderScrollUp,
+ kBorderScrollDown,
+ kBorderCloseButton
+};
+
class Gui {
public:
Gui(WageEngine *engine);
@@ -116,10 +123,10 @@ public:
private:
void undrawCursor();
void drawDesktop();
- void paintBorder(Graphics::Surface *g, Common::Rect &r, WindowType windowType);
+ void paintBorder(Graphics::Surface *g, Common::Rect &r, WindowType windowType, int highlightedPart = kBorderNone);
void renderConsole(Graphics::Surface *g, Common::Rect &r);
void drawBox(Graphics::Surface *g, int x, int y, int w, int h);
- void fillRect(Graphics::Surface *g, int x, int y, int w, int h);
+ void fillRect(Graphics::Surface *g, int x, int y, int w, int h, int color = kColorBlack);
void loadFonts();
void flowText(Common::String &str);
const Graphics::Font *getConsoleFont();
Commit: 1aa5f0d4c82dcc3024807c20b0df340f139df1d8
https://github.com/scummvm/scummvm/commit/1aa5f0d4c82dcc3024807c20b0df340f139df1d8
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-03-18T11:45:29+01:00
Commit Message:
WAGE: Correction to highlighted border drawing
Changed paths:
engines/wage/gui.cpp
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index 91a9cfe..95ea8fb 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -355,7 +355,7 @@ void Gui::paintBorder(Graphics::Surface *g, Common::Rect &r, WindowType windowTy
int color2 = kColorWhite;
if (highlightedPart == kBorderScrollUp) {
SWAP(color1, color2);
- fillRect(g, x + width - kBorderWidth, y, x + width, y + height / 2);
+ fillRect(g, x + width - kBorderWidth, y + size, x + width, y + height / 2);
}
for (int yy = 0; yy < ARROW_H; yy++) {
for (int xx = 0; xx < ARROW_W; xx++) {
@@ -372,7 +372,7 @@ void Gui::paintBorder(Graphics::Surface *g, Common::Rect &r, WindowType windowTy
color2 = kColorWhite;
if (highlightedPart == kBorderScrollDown) {
SWAP(color1, color2);
- fillRect(g, x + width - kBorderWidth, y + height / 2, x + width, y + height);
+ fillRect(g, x + width - kBorderWidth, y + height / 2, x + width, y + height - size);
}
fillRect(g, x + width - 13, y + size + ARROW_H, 8, height - 2 * size - 1 - ARROW_H * 2, color1);
y1 += height - 2 * size - ARROW_H - 2;
Commit: 9707a8b359dde44e71211588607bb7202910e97a
https://github.com/scummvm/scummvm/commit/9707a8b359dde44e71211588607bb7202910e97a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-03-18T11:45:29+01:00
Commit Message:
WAGE: Fixed border highlighting
Changed paths:
engines/wage/gui.cpp
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index 95ea8fb..0e33068 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -355,7 +355,7 @@ void Gui::paintBorder(Graphics::Surface *g, Common::Rect &r, WindowType windowTy
int color2 = kColorWhite;
if (highlightedPart == kBorderScrollUp) {
SWAP(color1, color2);
- fillRect(g, x + width - kBorderWidth, y + size, x + width, y + height / 2);
+ fillRect(g, x + width - kBorderWidth + 2, y + size, size - 4, r.height() / 2);
}
for (int yy = 0; yy < ARROW_H; yy++) {
for (int xx = 0; xx < ARROW_W; xx++) {
@@ -366,15 +366,15 @@ void Gui::paintBorder(Graphics::Surface *g, Common::Rect &r, WindowType windowTy
}
}
}
- fillRect(g, x + width - 13, y + size + ARROW_H, 8, height - 2 * size - 1 - ARROW_H * 2, color1);
+ fillRect(g, x + width - 13, y + size + ARROW_H, 8, r.height() / 2 - ARROW_H, color1);
color1 = kColorBlack;
color2 = kColorWhite;
if (highlightedPart == kBorderScrollDown) {
SWAP(color1, color2);
- fillRect(g, x + width - kBorderWidth, y + height / 2, x + width, y + height - size);
+ fillRect(g, x + width - kBorderWidth + 2, y + size + r.height() / 2, size - 4, r.height() / 2);
}
- fillRect(g, x + width - 13, y + size + ARROW_H, 8, height - 2 * size - 1 - ARROW_H * 2, color1);
+ fillRect(g, x + width - 13, y + size + r.height() / 2, 8, r.height() / 2 - ARROW_H, color1);
y1 += height - 2 * size - ARROW_H - 2;
for (int yy = 0; yy < ARROW_H; yy++) {
for (int xx = 0; xx < ARROW_W; xx++) {
Commit: 657edcf84e97d9c6b044ae3f3687fa9aba9e9ce9
https://github.com/scummvm/scummvm/commit/657edcf84e97d9c6b044ae3f3687fa9aba9e9ce9
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-03-18T11:45:29+01:00
Commit Message:
WAGE: Plugged in console scrolling up/down
Changed paths:
engines/wage/gui.cpp
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index 0e33068..4af5bea 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -588,7 +588,17 @@ Designed *Gui::mouseUp(int x, int y) {
}
} else if ((borderClick = isInBorder(_consoleTextArea, x, y)) != kBorderNone) {
_bordersDirty = true;
- warning("Border: %d", borderClick);
+
+ switch (borderClick) {
+ case kBorderScrollUp:
+ _scrollPos--;
+ _consoleDirty = true;
+ break;
+ case kBorderScrollDown:
+ _scrollPos++;
+ _consoleDirty = true;
+ break;
+ }
}
return NULL;
More information about the Scummvm-git-logs
mailing list