summaryrefslogtreecommitdiff
path: root/src/preview
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-01-21 22:48:37 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-01-21 22:48:37 (GMT)
commitdea70befcf770a767f1cbeecdd149930f6d4c0b8 (patch)
treed7262fed954074b5f60b2a75307ff50c8038c25d /src/preview
parent984d39f8cc6e2fd54c1a1b4aa217334f04a5e479 (diff)
downloadpowder-dea70befcf770a767f1cbeecdd149930f6d4c0b8.zip
powder-dea70befcf770a767f1cbeecdd149930f6d4c0b8.tar.gz
Basic skeleton for save preview
Diffstat (limited to 'src/preview')
-rw-r--r--src/preview/PreviewController.cpp26
-rw-r--r--src/preview/PreviewController.h25
-rw-r--r--src/preview/PreviewModel.cpp29
-rw-r--r--src/preview/PreviewModel.h28
-rw-r--r--src/preview/PreviewView.cpp28
-rw-r--r--src/preview/PreviewView.h23
6 files changed, 159 insertions, 0 deletions
diff --git a/src/preview/PreviewController.cpp b/src/preview/PreviewController.cpp
new file mode 100644
index 0000000..04c4dd6
--- /dev/null
+++ b/src/preview/PreviewController.cpp
@@ -0,0 +1,26 @@
+/*
+ * PreviewController.cpp
+ *
+ * Created on: Jan 21, 2012
+ * Author: Simon
+ */
+
+#include "PreviewController.h"
+#include "PreviewView.h"
+#include "PreviewModel.h"
+
+PreviewController::PreviewController(int saveID) {
+ // TODO Auto-generated constructor stub
+ previewModel = new PreviewModel();
+ previewView = new PreviewView();
+ previewModel->AddObserver(previewView);
+ previewView->AttachController(this);
+
+ previewModel->UpdateSave(saveID);
+}
+
+PreviewController::~PreviewController() {
+ delete previewView;
+ delete previewModel;
+}
+
diff --git a/src/preview/PreviewController.h b/src/preview/PreviewController.h
new file mode 100644
index 0000000..373ff03
--- /dev/null
+++ b/src/preview/PreviewController.h
@@ -0,0 +1,25 @@
+/*
+ * PreviewController.h
+ *
+ * Created on: Jan 21, 2012
+ * Author: Simon
+ */
+
+#ifndef PREVIEWCONTROLLER_H_
+#define PREVIEWCONTROLLER_H_
+
+#include "preview/PreviewModel.h"
+#include "preview/PreviewView.h"
+
+class PreviewModel;
+class PreviewView;
+class PreviewController {
+ PreviewModel * previewModel;
+ PreviewView * previewView;
+public:
+ PreviewController(int saveID);
+ PreviewView * GetView() { return previewView; }
+ virtual ~PreviewController();
+};
+
+#endif /* PREVIEWCONTROLLER_H_ */
diff --git a/src/preview/PreviewModel.cpp b/src/preview/PreviewModel.cpp
new file mode 100644
index 0000000..bf51ff0
--- /dev/null
+++ b/src/preview/PreviewModel.cpp
@@ -0,0 +1,29 @@
+/*
+ * PreviewModel.cpp
+ *
+ * Created on: Jan 21, 2012
+ * Author: Simon
+ */
+
+#include "PreviewModel.h"
+
+PreviewModel::PreviewModel():
+ save(NULL)
+{
+ // TODO Auto-generated constructor stub
+
+}
+
+void PreviewModel::UpdateSave(int saveID)
+{
+
+}
+
+void PreviewModel::AddObserver(PreviewView * observer) {
+ observers.push_back(observer);
+}
+
+PreviewModel::~PreviewModel() {
+ // TODO Auto-generated destructor stub
+}
+
diff --git a/src/preview/PreviewModel.h b/src/preview/PreviewModel.h
new file mode 100644
index 0000000..ba11390
--- /dev/null
+++ b/src/preview/PreviewModel.h
@@ -0,0 +1,28 @@
+/*
+ * PreviewModel.h
+ *
+ * Created on: Jan 21, 2012
+ * Author: Simon
+ */
+
+#ifndef PREVIEWMODEL_H_
+#define PREVIEWMODEL_H_
+
+#include <vector>
+#include "PreviewView.h"
+#include "search/Save.h"
+
+using namespace std;
+
+class PreviewView;
+class PreviewModel {
+ vector<PreviewView*> observers;
+ Save * save;
+public:
+ PreviewModel();
+ void AddObserver(PreviewView * observer);
+ void UpdateSave(int saveID);
+ virtual ~PreviewModel();
+};
+
+#endif /* PREVIEWMODEL_H_ */
diff --git a/src/preview/PreviewView.cpp b/src/preview/PreviewView.cpp
new file mode 100644
index 0000000..c5dbfac
--- /dev/null
+++ b/src/preview/PreviewView.cpp
@@ -0,0 +1,28 @@
+/*
+ * PreviewView.cpp
+ *
+ * Created on: Jan 21, 2012
+ * Author: Simon
+ */
+
+#include "PreviewView.h"
+#include "interface/Point.h"
+#include "interface/Window.h"
+
+PreviewView::PreviewView():
+ ui::Window(ui::Point(-1, -1), ui::Point(200, 200))
+{
+ // TODO Auto-generated constructor stub
+
+}
+
+void PreviewView::OnDraw()
+{
+ Graphics * g = ui::Engine::Ref().g;
+ g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 255, 255, 255, 255);
+}
+
+PreviewView::~PreviewView() {
+ // TODO Auto-generated destructor stub
+}
+
diff --git a/src/preview/PreviewView.h b/src/preview/PreviewView.h
new file mode 100644
index 0000000..728d547
--- /dev/null
+++ b/src/preview/PreviewView.h
@@ -0,0 +1,23 @@
+/*
+ * PreviewView.h
+ *
+ * Created on: Jan 21, 2012
+ * Author: Simon
+ */
+
+#ifndef PREVIEWVIEW_H_
+#define PREVIEWVIEW_H_
+#include "interface/Window.h"
+#include "preview/PreviewController.h"
+
+class PreviewController;
+class PreviewView: public ui::Window {
+ PreviewController * c;
+public:
+ void AttachController(PreviewController * controller) { c = controller;}
+ PreviewView();
+ virtual void OnDraw();
+ virtual ~PreviewView();
+};
+
+#endif /* PREVIEWVIEW_H_ */