mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-11 02:43:58 +02:00
Better way of managing Controllers
This commit is contained in:
@@ -19,8 +19,6 @@ public:
|
|||||||
virtual void ControllerExit()
|
virtual void ControllerExit()
|
||||||
{
|
{
|
||||||
cc->gameModel->SetUser(cc->loginWindow->GetUser());
|
cc->gameModel->SetUser(cc->loginWindow->GetUser());
|
||||||
delete cc->loginWindow;
|
|
||||||
cc->loginWindow = NULL;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -116,9 +114,14 @@ void GameController::DrawPoints(queue<ui::Point*> & pointQueue)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameController::Tick()
|
void GameController::Update()
|
||||||
{
|
{
|
||||||
//gameModel->GetSimulation()->update_particles();
|
//gameModel->GetSimulation()->update_particles();
|
||||||
|
if(loginWindow && loginWindow->HasExited)
|
||||||
|
{
|
||||||
|
delete loginWindow;
|
||||||
|
loginWindow = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameController::SetPaused(bool pauseState)
|
void GameController::SetPaused(bool pauseState)
|
||||||
|
@@ -31,7 +31,7 @@ public:
|
|||||||
GameView * GetView();
|
GameView * GetView();
|
||||||
void AdjustBrushSize(int direction);
|
void AdjustBrushSize(int direction);
|
||||||
void DrawPoints(queue<ui::Point*> & pointQueue);
|
void DrawPoints(queue<ui::Point*> & pointQueue);
|
||||||
void Tick();
|
void Update();
|
||||||
void SetPaused(bool pauseState);
|
void SetPaused(bool pauseState);
|
||||||
void SetPaused();
|
void SetPaused();
|
||||||
void SetActiveMenu(Menu * menu);
|
void SetActiveMenu(Menu * menu);
|
||||||
|
@@ -414,7 +414,7 @@ void GameView::OnTick(float dt)
|
|||||||
{
|
{
|
||||||
c->DrawPoints(pointQueue);
|
c->DrawPoints(pointQueue);
|
||||||
}
|
}
|
||||||
c->Tick();
|
c->Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameView::OnDraw()
|
void GameView::OnDraw()
|
||||||
|
@@ -8,7 +8,9 @@
|
|||||||
#include "LoginController.h"
|
#include "LoginController.h"
|
||||||
#include "client/User.h"
|
#include "client/User.h"
|
||||||
|
|
||||||
LoginController::LoginController(ControllerCallback * callback) {
|
LoginController::LoginController(ControllerCallback * callback):
|
||||||
|
HasExited(false)
|
||||||
|
{
|
||||||
// TODO Auto-generated constructor stub
|
// TODO Auto-generated constructor stub
|
||||||
loginView = new LoginView();
|
loginView = new LoginView();
|
||||||
loginModel = new LoginModel();
|
loginModel = new LoginModel();
|
||||||
@@ -38,6 +40,7 @@ void LoginController::Exit()
|
|||||||
}
|
}
|
||||||
if(callback)
|
if(callback)
|
||||||
callback->ControllerExit();
|
callback->ControllerExit();
|
||||||
|
HasExited = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
LoginController::~LoginController() {
|
LoginController::~LoginController() {
|
||||||
|
@@ -23,6 +23,7 @@ class LoginController {
|
|||||||
LoginModel * loginModel;
|
LoginModel * loginModel;
|
||||||
ControllerCallback * callback;
|
ControllerCallback * callback;
|
||||||
public:
|
public:
|
||||||
|
bool HasExited;
|
||||||
LoginController(ControllerCallback * callback = NULL);
|
LoginController(ControllerCallback * callback = NULL);
|
||||||
void Login(string username, string password);
|
void Login(string username, string password);
|
||||||
void Exit();
|
void Exit();
|
||||||
|
Reference in New Issue
Block a user