Merge pull request #114 from mniip/deco

'b' key opens deco editor
This commit is contained in:
jacob1 2013-01-12 14:04:31 -08:00
commit e29b4c14d6
3 changed files with 22 additions and 13 deletions

View File

@ -146,7 +146,7 @@ GameController::GameController():
commandInterface = new LuaScriptInterface(this, gameModel);//new TPTScriptInterface();
((LuaScriptInterface*)commandInterface)->SetWindow(gameView);
commandInterface->OnBrushChanged(gameModel->GetBrushID(), gameModel->GetBrush()->GetRadius().X, gameModel->GetBrush()->GetRadius().X);
commandInterface->OnActiveToolChanged(0, gameModel->GetActiveTool(0));
commandInterface->OnActiveToolChanged(1, gameModel->GetActiveTool(1));
@ -937,7 +937,7 @@ void GameController::SetActiveTool(int toolSelection, Tool * tool)
{
gameModel->GetRenderer()->gravityZonesEnabled = true;
}
}
}
}
void GameController::OpenSearch()
@ -1166,7 +1166,7 @@ void GameController::OpenSaveWindow()
new ServerSaveActivity(tempSave, new SaveUploadedCallback(this));
}
else
{
{
SaveInfo tempSave(0, 0, 0, 0, gameModel->GetUser().Username, "");
tempSave.SetGameSave(gameSave);
new ServerSaveActivity(tempSave, new SaveUploadedCallback(this));
@ -1217,7 +1217,7 @@ void GameController::SaveAsCurrent()
new ServerSaveActivity(tempSave, true, new SaveUploadedCallback(this));
}
else
{
{
SaveInfo tempSave(0, 0, 0, 0, gameModel->GetUser().Username, "");
tempSave.SetGameSave(gameSave);
new ServerSaveActivity(tempSave, true, new SaveUploadedCallback(this));
@ -1388,3 +1388,8 @@ void GameController::RunUpdater()
new UpdateActivity();
}
std::vector<Menu*> GameController::GetMenuList()
{
return gameModel->GetMenuList();
}

View File

@ -148,6 +148,7 @@ public:
virtual void NotifyAuthUserChanged(Client * sender);
virtual void NotifyNewNotification(Client * sender, std::pair<std::string, std::string> notification);
void RunUpdater();
std::vector<Menu*> GetMenuList();
};
#endif // GAMECONTROLLER_H

View File

@ -12,6 +12,7 @@
#include "interface/Slider.h"
#include "search/Thumbnail.h"
#include "simulation/SaveRenderer.h"
#include "simulation/SimulationData.h"
#include "dialogues/ConfirmPrompt.h"
#include "Format.h"
#include "QuickOption.h"
@ -186,7 +187,7 @@ GameView::GameView():
currentSaveType(0),
lastLogEntry(0.0f)
{
int currentX = 1;
//Set up UI
class SearchAction : public ui::ButtonAction
@ -202,13 +203,13 @@ GameView::GameView():
v->c->OpenSearch();
}
};
scrollBar = new ui::Button(ui::Point(0,YRES+21), ui::Point(XRES, 2), "");
scrollBar->Appearance.BackgroundInactive = ui::Colour(255, 255, 255);
scrollBar->Appearance.HorizontalAlign = ui::Appearance::AlignCentre;
scrollBar->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
AddComponent(scrollBar);
searchButton = new ui::Button(ui::Point(currentX, Size.Y-16), ui::Point(17, 15), "", "Find & open a simulation"); //Open
searchButton->SetIcon(IconOpen);
currentX+=18;
@ -1321,6 +1322,8 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
case 'b':
if(ctrl)
c->SetDecoration();
else
c->SetActiveMenu(c->GetMenuList()[SC_DECO]);
break;
case 'y':
c->SwitchAir();
@ -1478,7 +1481,7 @@ void GameView::OnTick(float dt)
{
buttonTipShow -= int(dt)>0?int(dt):1;
if(buttonTipShow<0)
buttonTipShow = 0;
buttonTipShow = 0;
}
if(toolTipPresence>0)
{
@ -1508,12 +1511,12 @@ void GameView::DoMouseMove(int x, int y, int dx, int dy)
int mouseX = x;
if(mouseX > XRES)
mouseX = XRES;
scrollBar->Position.X = (int)(((float)mouseX/((float)XRES-15))*(float)(XRES-scrollSize));
float overflow = totalWidth-(XRES-15), mouseLocation = float(XRES)/float(mouseX-(XRES));
setToolButtonOffset(overflow/mouseLocation);
//Ensure that mouseLeave events are make their way to the buttons should they move from underneith the mouse pointer
if(toolButtons[0]->Position.Y < y && toolButtons[0]->Position.Y+toolButtons[0]->Size.Y > y)
{
@ -1800,7 +1803,7 @@ void GameView::OnDraw()
ui::Point finalBrushRadius = c->NormaliseBlockCoord(activeBrush->GetRadius());
ren->xor_line(finalCurrentMouse.X-finalBrushRadius.X, finalCurrentMouse.Y-finalBrushRadius.Y, finalCurrentMouse.X+finalBrushRadius.X+CELL-1, finalCurrentMouse.Y-finalBrushRadius.Y);
ren->xor_line(finalCurrentMouse.X-finalBrushRadius.X, finalCurrentMouse.Y+finalBrushRadius.Y+CELL-1, finalCurrentMouse.X+finalBrushRadius.X+CELL-1, finalCurrentMouse.Y+finalBrushRadius.Y+CELL-1);
ren->xor_line(finalCurrentMouse.X-finalBrushRadius.X, finalCurrentMouse.Y-finalBrushRadius.Y+1, finalCurrentMouse.X-finalBrushRadius.X, finalCurrentMouse.Y+finalBrushRadius.Y+CELL-2);
ren->xor_line(finalCurrentMouse.X+finalBrushRadius.X+CELL-1, finalCurrentMouse.Y-finalBrushRadius.Y+1, finalCurrentMouse.X+finalBrushRadius.X+CELL-1, finalCurrentMouse.Y+finalBrushRadius.Y+CELL-2);
}
@ -2015,7 +2018,7 @@ void GameView::OnDraw()
cb *= tmp;
for (j=0; j<h; j++)
g->blendpixel(x+29-i,y+j,cr>255?255:cr,cg>255?255:cg,cb>255?255:cb,255);
}
}
}
}
#endif