summaryrefslogtreecommitdiff
path: root/src/game/GameView.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-04-07 23:11:21 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-04-07 23:11:21 (GMT)
commitc88079d084f2f3b7ec891da22f8c497cd2652853 (patch)
treeba24b70fb653b24a23e51c18a1d8d876233f71a5 /src/game/GameView.cpp
parentbbfbb81086897d50b67bf1494ac150eb607add72 (diff)
downloadpowder-c88079d084f2f3b7ec891da22f8c497cd2652853.zip
powder-c88079d084f2f3b7ec891da22f8c497cd2652853.tar.gz
Element sampling HUD thingy (No very good with MVC)
Diffstat (limited to 'src/game/GameView.cpp')
-rw-r--r--src/game/GameView.cpp28
1 files changed, 25 insertions, 3 deletions
diff --git a/src/game/GameView.cpp b/src/game/GameView.cpp
index bd4bd7a..e6e6445 100644
--- a/src/game/GameView.cpp
+++ b/src/game/GameView.cpp
@@ -1,4 +1,5 @@
#include <sstream>
+#include <iomanip>
#include "Config.h"
#include "GameView.h"
@@ -29,7 +30,8 @@ GameView::GameView():
selectPoint1(0, 0),
selectPoint2(0, 0),
stampThumb(NULL),
- clipboardThumb(NULL)
+ clipboardThumb(NULL),
+ mousePosition(0, 0)
{
int currentX = 1;
//Set up UI
@@ -282,6 +284,16 @@ void GameView::NotifyMenuListChanged(GameModel * sender)
}
}
+void GameView::SetSample(Particle sample)
+{
+ this->sample = sample;
+}
+
+ui::Point GameView::GetMousePosition()
+{
+ return mousePosition;
+}
+
void GameView::NotifyActiveToolsChanged(GameModel * sender)
{
for(int i = 0; i < toolButtons.size(); i++)
@@ -469,6 +481,7 @@ void GameView::NotifyBrushChanged(GameModel * sender)
void GameView::OnMouseMove(int x, int y, int dx, int dy)
{
+ mousePosition = c->PointTranslate(ui::Point(x, y));
if(selectMode!=SelectNone)
{
if(selectMode==PlaceStamp || selectMode==PlaceClipboard)
@@ -837,9 +850,9 @@ void GameView::changeColour()
void GameView::OnDraw()
{
+ Graphics * g = ui::Engine::Ref().g;
if(ren)
{
- Graphics * g = ui::Engine::Ref().g;
ren->draw_air();
ren->render_parts();
ren->render_fire();
@@ -925,10 +938,19 @@ void GameView::OnDraw()
{
string message = (*iter);
startY -= 13;
- g->fillrect(startX-3, startY-3, Graphics::textwidth((char*)message.c_str())+6, 14, 0, 0, 0, 100);
+ 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, startAlpha);
startAlpha-=14;
}
}
}
+
+ std::stringstream sampleInfo;
+ sampleInfo.precision(2);
+ if(sample.type)
+ sampleInfo << c->ElementResolve(sample.type) << ", Temp: " << std::fixed << sample.temp -273.15f;
+ else
+ sampleInfo << "Empty";
+
+ g->drawtext(XRES+BARSIZE-(10+Graphics::textwidth((char*)sampleInfo.str().c_str())), 5, (const char*)sampleInfo.str().c_str(), 255, 255, 255, 255);
}