mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-15 12:54:07 +02:00
@@ -146,7 +146,7 @@ GameController::GameController():
|
|||||||
|
|
||||||
commandInterface = new LuaScriptInterface(this, gameModel);//new TPTScriptInterface();
|
commandInterface = new LuaScriptInterface(this, gameModel);//new TPTScriptInterface();
|
||||||
((LuaScriptInterface*)commandInterface)->SetWindow(gameView);
|
((LuaScriptInterface*)commandInterface)->SetWindow(gameView);
|
||||||
|
|
||||||
commandInterface->OnBrushChanged(gameModel->GetBrushID(), gameModel->GetBrush()->GetRadius().X, gameModel->GetBrush()->GetRadius().X);
|
commandInterface->OnBrushChanged(gameModel->GetBrushID(), gameModel->GetBrush()->GetRadius().X, gameModel->GetBrush()->GetRadius().X);
|
||||||
commandInterface->OnActiveToolChanged(0, gameModel->GetActiveTool(0));
|
commandInterface->OnActiveToolChanged(0, gameModel->GetActiveTool(0));
|
||||||
commandInterface->OnActiveToolChanged(1, gameModel->GetActiveTool(1));
|
commandInterface->OnActiveToolChanged(1, gameModel->GetActiveTool(1));
|
||||||
@@ -937,7 +937,7 @@ void GameController::SetActiveTool(int toolSelection, Tool * tool)
|
|||||||
{
|
{
|
||||||
gameModel->GetRenderer()->gravityZonesEnabled = true;
|
gameModel->GetRenderer()->gravityZonesEnabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameController::OpenSearch()
|
void GameController::OpenSearch()
|
||||||
@@ -1166,7 +1166,7 @@ void GameController::OpenSaveWindow()
|
|||||||
new ServerSaveActivity(tempSave, new SaveUploadedCallback(this));
|
new ServerSaveActivity(tempSave, new SaveUploadedCallback(this));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SaveInfo tempSave(0, 0, 0, 0, gameModel->GetUser().Username, "");
|
SaveInfo tempSave(0, 0, 0, 0, gameModel->GetUser().Username, "");
|
||||||
tempSave.SetGameSave(gameSave);
|
tempSave.SetGameSave(gameSave);
|
||||||
new ServerSaveActivity(tempSave, new SaveUploadedCallback(this));
|
new ServerSaveActivity(tempSave, new SaveUploadedCallback(this));
|
||||||
@@ -1217,7 +1217,7 @@ void GameController::SaveAsCurrent()
|
|||||||
new ServerSaveActivity(tempSave, true, new SaveUploadedCallback(this));
|
new ServerSaveActivity(tempSave, true, new SaveUploadedCallback(this));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SaveInfo tempSave(0, 0, 0, 0, gameModel->GetUser().Username, "");
|
SaveInfo tempSave(0, 0, 0, 0, gameModel->GetUser().Username, "");
|
||||||
tempSave.SetGameSave(gameSave);
|
tempSave.SetGameSave(gameSave);
|
||||||
new ServerSaveActivity(tempSave, true, new SaveUploadedCallback(this));
|
new ServerSaveActivity(tempSave, true, new SaveUploadedCallback(this));
|
||||||
@@ -1388,3 +1388,8 @@ void GameController::RunUpdater()
|
|||||||
new UpdateActivity();
|
new UpdateActivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<Menu*> GameController::GetMenuList()
|
||||||
|
{
|
||||||
|
return gameModel->GetMenuList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -148,6 +148,7 @@ public:
|
|||||||
virtual void NotifyAuthUserChanged(Client * sender);
|
virtual void NotifyAuthUserChanged(Client * sender);
|
||||||
virtual void NotifyNewNotification(Client * sender, std::pair<std::string, std::string> notification);
|
virtual void NotifyNewNotification(Client * sender, std::pair<std::string, std::string> notification);
|
||||||
void RunUpdater();
|
void RunUpdater();
|
||||||
|
std::vector<Menu*> GetMenuList();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GAMECONTROLLER_H
|
#endif // GAMECONTROLLER_H
|
||||||
|
@@ -12,6 +12,7 @@
|
|||||||
#include "interface/Slider.h"
|
#include "interface/Slider.h"
|
||||||
#include "search/Thumbnail.h"
|
#include "search/Thumbnail.h"
|
||||||
#include "simulation/SaveRenderer.h"
|
#include "simulation/SaveRenderer.h"
|
||||||
|
#include "simulation/SimulationData.h"
|
||||||
#include "dialogues/ConfirmPrompt.h"
|
#include "dialogues/ConfirmPrompt.h"
|
||||||
#include "Format.h"
|
#include "Format.h"
|
||||||
#include "QuickOption.h"
|
#include "QuickOption.h"
|
||||||
@@ -186,7 +187,7 @@ GameView::GameView():
|
|||||||
currentSaveType(0),
|
currentSaveType(0),
|
||||||
lastLogEntry(0.0f)
|
lastLogEntry(0.0f)
|
||||||
{
|
{
|
||||||
|
|
||||||
int currentX = 1;
|
int currentX = 1;
|
||||||
//Set up UI
|
//Set up UI
|
||||||
class SearchAction : public ui::ButtonAction
|
class SearchAction : public ui::ButtonAction
|
||||||
@@ -202,13 +203,13 @@ GameView::GameView():
|
|||||||
v->c->OpenSearch();
|
v->c->OpenSearch();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
scrollBar = new ui::Button(ui::Point(0,YRES+21), ui::Point(XRES, 2), "");
|
scrollBar = new ui::Button(ui::Point(0,YRES+21), ui::Point(XRES, 2), "");
|
||||||
scrollBar->Appearance.BackgroundInactive = ui::Colour(255, 255, 255);
|
scrollBar->Appearance.BackgroundInactive = ui::Colour(255, 255, 255);
|
||||||
scrollBar->Appearance.HorizontalAlign = ui::Appearance::AlignCentre;
|
scrollBar->Appearance.HorizontalAlign = ui::Appearance::AlignCentre;
|
||||||
scrollBar->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
scrollBar->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
||||||
AddComponent(scrollBar);
|
AddComponent(scrollBar);
|
||||||
|
|
||||||
searchButton = new ui::Button(ui::Point(currentX, Size.Y-16), ui::Point(17, 15), "", "Find & open a simulation"); //Open
|
searchButton = new ui::Button(ui::Point(currentX, Size.Y-16), ui::Point(17, 15), "", "Find & open a simulation"); //Open
|
||||||
searchButton->SetIcon(IconOpen);
|
searchButton->SetIcon(IconOpen);
|
||||||
currentX+=18;
|
currentX+=18;
|
||||||
@@ -1321,6 +1322,8 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
|
|||||||
case 'b':
|
case 'b':
|
||||||
if(ctrl)
|
if(ctrl)
|
||||||
c->SetDecoration();
|
c->SetDecoration();
|
||||||
|
else
|
||||||
|
c->SetActiveMenu(c->GetMenuList()[SC_DECO]);
|
||||||
break;
|
break;
|
||||||
case 'y':
|
case 'y':
|
||||||
c->SwitchAir();
|
c->SwitchAir();
|
||||||
@@ -1478,7 +1481,7 @@ void GameView::OnTick(float dt)
|
|||||||
{
|
{
|
||||||
buttonTipShow -= int(dt)>0?int(dt):1;
|
buttonTipShow -= int(dt)>0?int(dt):1;
|
||||||
if(buttonTipShow<0)
|
if(buttonTipShow<0)
|
||||||
buttonTipShow = 0;
|
buttonTipShow = 0;
|
||||||
}
|
}
|
||||||
if(toolTipPresence>0)
|
if(toolTipPresence>0)
|
||||||
{
|
{
|
||||||
@@ -1508,12 +1511,12 @@ void GameView::DoMouseMove(int x, int y, int dx, int dy)
|
|||||||
int mouseX = x;
|
int mouseX = x;
|
||||||
if(mouseX > XRES)
|
if(mouseX > XRES)
|
||||||
mouseX = XRES;
|
mouseX = XRES;
|
||||||
|
|
||||||
scrollBar->Position.X = (int)(((float)mouseX/((float)XRES-15))*(float)(XRES-scrollSize));
|
scrollBar->Position.X = (int)(((float)mouseX/((float)XRES-15))*(float)(XRES-scrollSize));
|
||||||
|
|
||||||
float overflow = totalWidth-(XRES-15), mouseLocation = float(XRES)/float(mouseX-(XRES));
|
float overflow = totalWidth-(XRES-15), mouseLocation = float(XRES)/float(mouseX-(XRES));
|
||||||
setToolButtonOffset(overflow/mouseLocation);
|
setToolButtonOffset(overflow/mouseLocation);
|
||||||
|
|
||||||
//Ensure that mouseLeave events are make their way to the buttons should they move from underneith the mouse pointer
|
//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)
|
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());
|
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, 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+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, 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);
|
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;
|
cb *= tmp;
|
||||||
for (j=0; j<h; j++)
|
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);
|
g->blendpixel(x+29-i,y+j,cr>255?255:cr,cg>255?255:cg,cb>255?255:cb,255);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user