summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-02-01 18:45:59 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-02-01 18:45:59 (GMT)
commit038da72c61ea6a251d805e2de3662f240da52b02 (patch)
tree05170050b16f9d663ec44ae451211e686ba196ac /src/game
parent857b0cc1fc58f066acd59404d16ee5e566e20f00 (diff)
downloadpowder-038da72c61ea6a251d805e2de3662f240da52b02.zip
powder-038da72c61ea6a251d805e2de3662f240da52b02.tar.gz
Console UI, open in browser button, tab and enter shortcut for Login UI, various
Diffstat (limited to 'src/game')
-rw-r--r--src/game/GameController.cpp10
-rw-r--r--src/game/GameController.h3
-rw-r--r--src/game/GameModel.cpp13
-rw-r--r--src/game/GameView.cpp10
-rw-r--r--src/game/ToolButton.cpp4
5 files changed, 33 insertions, 7 deletions
diff --git a/src/game/GameController.cpp b/src/game/GameController.cpp
index 9e5f53b..a4e0ccc 100644
--- a/src/game/GameController.cpp
+++ b/src/game/GameController.cpp
@@ -95,6 +95,10 @@ GameController::~GameController()
{
delete loginWindow;
}
+ if(console)
+ {
+ delete console;
+ }
if(ui::Engine::Ref().GetWindow() == gameView)
{
ui::Engine::Ref().CloseWindow();
@@ -301,6 +305,12 @@ void GameController::OpenDisplayOptions()
//TODO: Implement
}
+void GameController::ShowConsole()
+{
+ console = new ConsoleController(NULL);
+ ui::Engine::Ref().ShowWindow(console->GetView());
+}
+
void GameController::OpenRenderOptions()
{
renderOptions = new RenderController(gameModel->GetRenderer(), new RenderCallback(this));
diff --git a/src/game/GameController.h b/src/game/GameController.h
index df5f9fc..84af343 100644
--- a/src/game/GameController.h
+++ b/src/game/GameController.h
@@ -10,6 +10,7 @@
#include "render/RenderController.h"
#include "login/LoginController.h"
#include "ssave/SSaveController.h"
+#include "console/ConsoleController.h"
#include "Menu.h"
using namespace std;
@@ -26,6 +27,7 @@ private:
RenderController * renderOptions;
LoginController * loginWindow;
SSaveController * ssave;
+ ConsoleController * console;
public:
class LoginCallback;
class SearchCallback;
@@ -57,6 +59,7 @@ public:
void ReloadSim();
void Vote(int direction);
void ChangeBrush();
+ void ShowConsole();
ui::Point PointTranslate(ui::Point point);
};
diff --git a/src/game/GameModel.cpp b/src/game/GameModel.cpp
index 2ff9e0b..dcad405 100644
--- a/src/game/GameModel.cpp
+++ b/src/game/GameModel.cpp
@@ -41,12 +41,19 @@ GameModel::GameModel():
//sim->wtypes[i]
}
+ //Set default brush palette
brushList.push_back(new Brush(ui::Point(4, 4)));
brushList.push_back(new EllipseBrush(ui::Point(4, 4)));
- activeTools[0] = new ElementTool(1, "TURD", 0, 0, 0);
- activeTools[1] = new ElementTool(0, "TURD", 0, 0, 0);
- //activeTool[1] = new ElementTool(0, "TURD", 0, 0, 0);
+ //Set default tools
+ activeTools[0] = menuList[SC_POWDERS]->GetToolList()[0];
+ activeTools[1] = menuList[SC_SPECIAL]->GetToolList()[0];
+
+ //Set default menu
+ activeMenu = menuList[SC_POWDERS];
+ toolList = menuList[SC_POWDERS]->GetToolList();
+
+ //Load last user
std::cout << Client::Ref().GetAuthUser().Username << std::endl;
if(Client::Ref().GetAuthUser().ID)
{
diff --git a/src/game/GameView.cpp b/src/game/GameView.cpp
index a443025..e93b9b7 100644
--- a/src/game/GameView.cpp
+++ b/src/game/GameView.cpp
@@ -277,6 +277,7 @@ void GameView::NotifyActiveToolsChanged(GameModel * sender)
void GameView::NotifyToolListChanged(GameModel * sender)
{
+ //int currentY = YRES+MENUSIZE-36;
int currentX = XRES+BARSIZE-56;
int totalColour;
for(int i = 0; i < menuButtons.size(); i++)
@@ -299,8 +300,10 @@ void GameView::NotifyToolListChanged(GameModel * sender)
vector<Tool*> toolList = sender->GetToolList();
for(int i = 0; i < toolList.size(); i++)
{
- ToolButton * tempButton = new ToolButton(ui::Point(currentX, YRES), ui::Point(32, 16), toolList[i]->GetName());
- currentX -= 36;
+ //ToolButton * tempButton = new ToolButton(ui::Point(XRES+1, currentY), ui::Point(28, 15), toolList[i]->GetName());
+ ToolButton * tempButton = new ToolButton(ui::Point(currentX, YRES+1), ui::Point(28, 15), toolList[i]->GetName());
+ //currentY -= 17;
+ currentX -= 32;
tempButton->SetActionCallback(new ToolAction(this, toolList[i]));
tempButton->SetBackgroundColour(ui::Colour(toolList[i]->colRed, toolList[i]->colGreen, toolList[i]->colBlue));
@@ -507,6 +510,9 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
zoomCursorFixed = false;
c->SetZoomEnabled(true);
break;
+ case '`':
+ c->ShowConsole();
+ break;
}
}
diff --git a/src/game/ToolButton.cpp b/src/game/ToolButton.cpp
index 374d424..27bbab6 100644
--- a/src/game/ToolButton.cpp
+++ b/src/game/ToolButton.cpp
@@ -43,11 +43,11 @@ void ToolButton::Draw(const ui::Point& screenPos)
if (totalColour<544)
{
- g->drawtext(screenPos.X+textPosition.X, screenPos.Y+textPosition.Y, ButtonText.c_str(), 255, 255, 255, 255);
+ g->drawtext(screenPos.X+textPosition.X, screenPos.Y+textPosition.Y, buttonDisplayText.c_str(), 255, 255, 255, 255);
}
else
{
- g->drawtext(screenPos.X+textPosition.X, screenPos.Y+textPosition.Y, ButtonText.c_str(), 0, 0, 0, 255);
+ g->drawtext(screenPos.X+textPosition.X, screenPos.Y+textPosition.Y, buttonDisplayText.c_str(), 0, 0, 0, 255);
}
if(currentSelection!=-1)
{