summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-03-05 19:55:39 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-03-05 19:55:39 (GMT)
commit7e3d45bbfb701a5eca3e93b589680d8651ada016 (patch)
treebfdd7260e46979922e1343bb579d2768fa53feed /src
parent81f3114cb22592a8c09fa564db49fbea079f1328 (diff)
downloadpowder-7e3d45bbfb701a5eca3e93b589680d8651ada016.zip
powder-7e3d45bbfb701a5eca3e93b589680d8651ada016.tar.gz
Tag UI - actually more of a box at the moment
Diffstat (limited to 'src')
-rw-r--r--src/game/GameController.cpp10
-rw-r--r--src/game/GameController.h2
-rw-r--r--src/tags/TagsController.cpp37
-rw-r--r--src/tags/TagsController.h28
-rw-r--r--src/tags/TagsModel.cpp23
-rw-r--r--src/tags/TagsModel.h22
-rw-r--r--src/tags/TagsView.cpp29
-rw-r--r--src/tags/TagsView.h24
8 files changed, 173 insertions, 2 deletions
diff --git a/src/game/GameController.cpp b/src/game/GameController.cpp
index 1164de5..25f02e9 100644
--- a/src/game/GameController.cpp
+++ b/src/game/GameController.cpp
@@ -71,7 +71,8 @@ GameController::GameController():
renderOptions(NULL),
loginWindow(NULL),
ssave(NULL),
- console(NULL)
+ console(NULL),
+ tagsWindow(NULL)
{
gameView = new GameView();
gameModel = new GameModel();
@@ -99,6 +100,10 @@ GameController::~GameController()
{
delete loginWindow;
}
+ if(tagsWindow)
+ {
+ delete tagsWindow;
+ }
if(console)
{
delete console;
@@ -333,7 +338,8 @@ void GameController::OpenLogin()
void GameController::OpenTags()
{
- //TODO: Implement
+ tagsWindow = new TagsController(NULL);
+ ui::Engine::Ref().ShowWindow(tagsWindow->GetView());
}
void GameController::OpenDisplayOptions()
diff --git a/src/game/GameController.h b/src/game/GameController.h
index 8480aeb..7944dc7 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 "tags/TagsController.h"
#include "console/ConsoleController.h"
//#include "cat/TPTScriptInterface.h"
#include "cat/LuaScriptInterface.h"
@@ -32,6 +33,7 @@ private:
LoginController * loginWindow;
SSaveController * ssave;
ConsoleController * console;
+ TagsController * tagsWindow;
CommandInterface * commandInterface;
public:
class LoginCallback;
diff --git a/src/tags/TagsController.cpp b/src/tags/TagsController.cpp
new file mode 100644
index 0000000..88356c7
--- /dev/null
+++ b/src/tags/TagsController.cpp
@@ -0,0 +1,37 @@
+/*
+ * TagsController.cpp
+ *
+ * Created on: Mar 5, 2012
+ * Author: Simon
+ */
+
+#include "TagsController.h"
+#include "interface/Engine.h"
+
+#include "TagsModel.h"
+#include "TagsView.h"
+
+TagsController::TagsController(ControllerCallback * callback):
+ HasDone(false)
+{
+ tagsModel = new TagsModel();
+ tagsView = new TagsView();
+ tagsView->AttachController(this);
+ tagsModel->AddObserver(tagsView);
+
+ this->callback = callback;
+}
+
+void TagsController::Exit()
+{
+ if(ui::Engine::Ref().GetWindow() == tagsView)
+ ui::Engine::Ref().CloseWindow();
+ if(callback)
+ callback->ControllerExit();
+ HasDone = true;
+}
+
+TagsController::~TagsController() {
+ // TODO Auto-generated destructor stub
+}
+
diff --git a/src/tags/TagsController.h b/src/tags/TagsController.h
new file mode 100644
index 0000000..5c613f0
--- /dev/null
+++ b/src/tags/TagsController.h
@@ -0,0 +1,28 @@
+/*
+ * TagsController.h
+ *
+ * Created on: Mar 5, 2012
+ * Author: Simon
+ */
+
+#ifndef TAGSCONTROLLER_H_
+#define TAGSCONTROLLER_H_
+
+#include "Controller.h"
+#include "TagsView.h"
+
+class TagsView;
+class TagsModel;
+class TagsController {
+ ControllerCallback * callback;
+ TagsView * tagsView;
+ TagsModel * tagsModel;
+public:
+ bool HasDone;
+ TagsController(ControllerCallback * callback);
+ TagsView * GetView() {return tagsView;}
+ void Exit();
+ virtual ~TagsController();
+};
+
+#endif /* TAGSCONTROLLER_H_ */
diff --git a/src/tags/TagsModel.cpp b/src/tags/TagsModel.cpp
new file mode 100644
index 0000000..cfff371
--- /dev/null
+++ b/src/tags/TagsModel.cpp
@@ -0,0 +1,23 @@
+/*
+ * TagsModel.cpp
+ *
+ * Created on: Mar 5, 2012
+ * Author: Simon
+ */
+
+#include "TagsModel.h"
+
+TagsModel::TagsModel() {
+ // TODO Auto-generated constructor stub
+
+}
+
+void TagsModel::AddObserver(TagsView * observer)
+{
+ observers.push_back(observer);
+}
+
+TagsModel::~TagsModel() {
+ // TODO Auto-generated destructor stub
+}
+
diff --git a/src/tags/TagsModel.h b/src/tags/TagsModel.h
new file mode 100644
index 0000000..fe7c057
--- /dev/null
+++ b/src/tags/TagsModel.h
@@ -0,0 +1,22 @@
+/*
+ * TagsModel.h
+ *
+ * Created on: Mar 5, 2012
+ * Author: Simon
+ */
+
+#ifndef TAGSMODEL_H_
+#define TAGSMODEL_H_
+
+#include <vector>
+
+class TagsView;
+class TagsModel {
+ std::vector<TagsView*> observers;
+public:
+ TagsModel();
+ void AddObserver(TagsView * observer);
+ virtual ~TagsModel();
+};
+
+#endif /* TAGSMODEL_H_ */
diff --git a/src/tags/TagsView.cpp b/src/tags/TagsView.cpp
new file mode 100644
index 0000000..f9eafbc
--- /dev/null
+++ b/src/tags/TagsView.cpp
@@ -0,0 +1,29 @@
+/*
+ * TagsView.cpp
+ *
+ * Created on: Mar 5, 2012
+ * Author: Simon
+ */
+
+#include "TagsView.h"
+
+#include "TagsController.h"
+#include "TagsModel.h"
+
+TagsView::TagsView():
+ ui::Window(ui::Point(-1, -1), ui::Point(200, 300)){
+ // TODO Auto-generated constructor stub
+
+}
+
+void TagsView::OnDraw()
+{
+ Graphics * g = ui::Engine::Ref().g;
+ g->clearrect(Position.X-2, Position.Y-2, Size.X+3, Size.Y+3);
+ g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 255, 255, 255, 255);
+}
+
+TagsView::~TagsView() {
+ // TODO Auto-generated destructor stub
+}
+
diff --git a/src/tags/TagsView.h b/src/tags/TagsView.h
new file mode 100644
index 0000000..3126e5a
--- /dev/null
+++ b/src/tags/TagsView.h
@@ -0,0 +1,24 @@
+/*
+ * TagsView.h
+ *
+ * Created on: Mar 5, 2012
+ * Author: Simon
+ */
+
+#ifndef TAGSVIEW_H_
+#define TAGSVIEW_H_
+
+#include "interface/Window.h"
+
+class TagsController;
+class TagsModel;
+class TagsView: public ui::Window {
+ TagsController * c;
+public:
+ TagsView();
+ virtual void OnDraw();
+ void AttachController(TagsController * c_) { c = c_; };
+ virtual ~TagsView();
+};
+
+#endif /* TAGSVIEW_H_ */