Tag UI - actually more of a box at the moment

This commit is contained in:
Simon Robertshaw 2012-03-05 19:55:39 +00:00
parent 81f3114cb2
commit 7e3d45bbfb
8 changed files with 173 additions and 2 deletions

View File

@ -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()

View File

@ -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;

View File

@ -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
}

28
src/tags/TagsController.h Normal file
View File

@ -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_ */

23
src/tags/TagsModel.cpp Normal file
View File

@ -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
}

22
src/tags/TagsModel.h Normal file
View File

@ -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_ */

29
src/tags/TagsView.cpp Normal file
View File

@ -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
}

24
src/tags/TagsView.h Normal file
View File

@ -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_ */