summaryrefslogtreecommitdiff
path: root/src/game/GameView.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-07-27 19:06:17 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-07-27 19:06:17 (GMT)
commit5befe5c25f8f188e7588de44ab2c8bead22ae999 (patch)
tree643b02af217770c1a3156be03e01442557795760 /src/game/GameView.cpp
parentf8ca8af387b8611c18ca7c5357efd19c8bc28941 (diff)
downloadpowder-5befe5c25f8f188e7588de44ab2c8bead22ae999.zip
powder-5befe5c25f8f188e7588de44ab2c8bead22ae999.tar.gz
Local file browser + some more interesting things like Progress bar UI component
Diffstat (limited to 'src/game/GameView.cpp')
-rw-r--r--src/game/GameView.cpp43
1 files changed, 40 insertions, 3 deletions
diff --git a/src/game/GameView.cpp b/src/game/GameView.cpp
index 5bf7043..7e34b85 100644
--- a/src/game/GameView.cpp
+++ b/src/game/GameView.cpp
@@ -37,7 +37,8 @@ GameView::GameView():
toolTip(""),
infoTip(""),
infoTipPresence(0),
- toolTipPosition(-1, -1)
+ toolTipPosition(-1, -1),
+ alternativeSaveSource(false)
{
int currentX = 1;
@@ -49,7 +50,10 @@ GameView::GameView():
SearchAction(GameView * _v) { v = _v; }
void ActionCallback(ui::Button * sender)
{
- v->c->OpenSearch();
+ if(v->GetAlternativeSourceEnabled())
+ v->c->OpenLocalBrowse();
+ else
+ v->c->OpenSearch();
}
};
@@ -89,7 +93,10 @@ GameView::GameView():
SaveSimulationAction(GameView * _v) { v = _v; }
void ActionCallback(ui::Button * sender)
{
- v->c->OpenSaveWindow();
+ if(v->GetAlternativeSourceEnabled())
+ v->c->OpenLocalSaveWindow();
+ else
+ v->c->OpenSaveWindow();
}
};
saveSimulationButton = new ui::Button(ui::Point(currentX, Size.Y-16), ui::Point(150, 15), "[untitled simulation]");
@@ -847,6 +854,7 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
drawMode = DrawFill;
else
drawMode = DrawRect;
+ enableHDDSave();
break;
case KEY_SHIFT:
if(drawModeReset)
@@ -940,6 +948,9 @@ void GameView::OnKeyRelease(int key, Uint16 character, bool shift, bool ctrl, bo
case KEY_ALT:
drawSnap = false;
break;
+ case KEY_CTRL:
+ disableHDDSave();
+ break;
case 'z':
if(!zoomCursorFixed)
c->SetZoomEnabled(false);
@@ -1152,6 +1163,32 @@ void GameView::changeColour()
c->SetColour(ui::Colour(colourRSlider->GetValue(), colourGSlider->GetValue(), colourBSlider->GetValue(), colourASlider->GetValue()));
}
+void GameView::enableHDDSave()
+{
+ if(!alternativeSaveSource)
+ {
+ alternativeSaveSource = true;
+
+ saveSimulationButton->Appearance.BackgroundInactive = ui::Colour(255, 255, 255);
+ saveSimulationButton->Appearance.TextInactive = ui::Colour(0, 0, 0);
+ searchButton->Appearance.BackgroundInactive = ui::Colour(255, 255, 255);
+ searchButton->Appearance.TextInactive = ui::Colour(0, 0, 0);
+ }
+}
+
+void GameView::disableHDDSave()
+{
+ if(alternativeSaveSource)
+ {
+ alternativeSaveSource = false;
+
+ saveSimulationButton->Appearance.BackgroundInactive = ui::Colour(0, 0, 0);
+ saveSimulationButton->Appearance.TextInactive = ui::Colour(255, 255, 255);
+ searchButton->Appearance.BackgroundInactive = ui::Colour(0, 0, 0);
+ searchButton->Appearance.TextInactive = ui::Colour(255, 255, 255);
+ }
+}
+
void GameView::OnDraw()
{
Graphics * g = ui::Engine::Ref().g;