summaryrefslogtreecommitdiff
path: root/src/game/GameView.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-04-04 17:52:34 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-04-04 17:52:34 (GMT)
commit89cdeef9ad9c164e9f484cded3096bcbc72b7207 (patch)
tree6a26f6313e7cf45a277756890e087201704bab90 /src/game/GameView.cpp
parent299c1da9ae6b79ddb6cc39477ad31fb1d2a3c566 (diff)
downloadpowder-89cdeef9ad9c164e9f484cded3096bcbc72b7207.zip
powder-89cdeef9ad9c164e9f484cded3096bcbc72b7207.tar.gz
CommandInterface, Mouse, Keyboard and Tick events, on screen log, print redirected to tpt.log
Diffstat (limited to 'src/game/GameView.cpp')
-rw-r--r--src/game/GameView.cpp58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/game/GameView.cpp b/src/game/GameView.cpp
index 4067d5a..2ccf2e4 100644
--- a/src/game/GameView.cpp
+++ b/src/game/GameView.cpp
@@ -741,11 +741,55 @@ void GameView::OnTick(float dt)
c->Update();
}
+void GameView::DoMouseMove(int x, int y, int dx, int dy)
+{
+ if(c->MouseMove(x, y, dx, dy))
+ Window::DoMouseMove(x, y, dx, dy);
+}
+
+void GameView::DoMouseDown(int x, int y, unsigned button)
+{
+ if(c->MouseDown(x, y, button))
+ Window::DoMouseDown(x, y, button);
+}
+
+void GameView::DoMouseUp(int x, int y, unsigned button)
+{
+ if(c->MouseUp(x, y, button))
+ Window::DoMouseUp(x, y, button);
+}
+
+void GameView::DoMouseWheel(int x, int y, int d)
+{
+ if(c->MouseWheel(x, y, d))
+ Window::DoMouseWheel(x, y, d);
+}
+
+void GameView::DoKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt)
+{
+ if(c->KeyPress(key, character, shift, ctrl, alt))
+ Window::DoKeyPress(key, character, shift, ctrl, alt);
+}
+
+void GameView::DoKeyRelease(int key, Uint16 character, bool shift, bool ctrl, bool alt)
+{
+ if(c->KeyRelease(key, character, shift, ctrl, alt))
+ Window::DoKeyRelease(key, character, shift, ctrl, alt);
+}
+
void GameView::NotifyZoomChanged(GameModel * sender)
{
zoomEnabled = sender->GetZoomEnabled();
}
+void GameView::NotifyLogChanged(GameModel * sender, string entry)
+{
+ logEntries.push_front(entry);
+ lastLogEntry = 100.0f;
+ if(logEntries.size()>10)
+ logEntries.pop_back();
+}
+
void GameView::NotifyClipboardChanged(GameModel * sender)
{
if(clipboardThumb)
@@ -853,5 +897,19 @@ void GameView::OnDraw()
}
}
}
+
+ int startX = 20;
+ int startY = YRES-20;
+ if(lastLogEntry>0.1 && logEntries.size())
+ {
+ deque<string>::iterator iter;
+ for(iter = logEntries.begin(); iter != logEntries.end(); iter++)
+ {
+ string message = (*iter);
+ startY -= 14;
+ g->fillrect(startX-3, startY-3, Graphics::textwidth((char*)message.c_str())+6, 14, 0, 0, 0, 100);
+ g->drawtext(startX, startY, message.c_str(), 255, 255, 255, 255);
+ }
+ }
}
}