Skip to content

Commit

Permalink
WAGE: Started text selection implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Feb 14, 2016
1 parent 63ef49e commit d812706
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
17 changes: 16 additions & 1 deletion engines/wage/gui.cpp
Expand Up @@ -155,6 +155,8 @@ Gui::Gui(WageEngine *engine) {
_cursorState = false;
_cursorOff = false;

_inTextSelection = false;

g_system->getPaletteManager()->setPalette(palette, 0, 4);

CursorMan.replaceCursorPalette(palette, 0, 4);
Expand Down Expand Up @@ -649,8 +651,21 @@ Designed *Gui::mouseUp(int x, int y) {
}

void Gui::mouseDown(int x, int y) {
if (_menu->mouseClick(x, y))
if (_menu->mouseClick(x, y)) {
_menuDirty = true;
} else if (_consoleTextArea.contains(x, y)) {
startMarking(x, y);
}
}

void Gui::startMarking(int x, int y) {
const int firstLine = _scrollPos / _consoleLineHeight;
int textLine = (y - kConHOverlap - kConHPadding - _scrollPos % _consoleLineHeight - _consoleTextArea.top) / _consoleLineHeight + firstLine;
int charPos = x - kConWOverlap - kConWPadding - _consoleTextArea.left;

_inTextSelection = true;

warning("x: %d y: %d", textLine, charPos);
}

} // End of namespace Wage
3 changes: 3 additions & 0 deletions engines/wage/gui.h
Expand Up @@ -111,6 +111,7 @@ class Gui {
void flowText(Common::String &str);
const Graphics::Font *getConsoleFont();
const Graphics::Font *getTitleFont();
void startMarking(int x, int y);

public:
Graphics::Surface _screen;
Expand Down Expand Up @@ -143,6 +144,8 @@ class Gui {
Common::Rect _sceneArea;
bool _sceneIsActive;
bool _cursorIsArrow;

bool _inTextSelection;
};

} // End of namespace Wage
Expand Down

0 comments on commit d812706

Please sign in to comment.