summaryrefslogtreecommitdiff
path: root/src/interface/Sandbox.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-01-19 13:44:59 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-01-19 13:44:59 (GMT)
commit44639a6423c03552a3c0faafab27ef8f395f73a6 (patch)
tree1a4fc49a56060759fcbec6f18e9159cf126e8606 /src/interface/Sandbox.cpp
parent4a60b97c700c2f1843b7e99313554cb89fb5da4e (diff)
downloadpowder-44639a6423c03552a3c0faafab27ef8f395f73a6.zip
powder-44639a6423c03552a3c0faafab27ef8f395f73a6.tar.gz
Some folder changes, started search and client
Diffstat (limited to 'src/interface/Sandbox.cpp')
-rw-r--r--src/interface/Sandbox.cpp101
1 files changed, 0 insertions, 101 deletions
diff --git a/src/interface/Sandbox.cpp b/src/interface/Sandbox.cpp
deleted file mode 100644
index 9a858f8..0000000
--- a/src/interface/Sandbox.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Sandbox.cpp
- *
- * Created on: Jan 8, 2012
- * Author: Simon
- */
-
-#include <iostream>
-#include <queue>
-
-#include "Config.h"
-#include "Global.h"
-
-#include "interface/Point.h"
-#include "interface/Sandbox.h"
-#include "interface/Component.h"
-#include "Renderer.h"
-#include "Simulation.h"
-#include "Engine.h"
-
-namespace ui {
-
-Sandbox::Sandbox():
- Component(Point(0, 0), Point(XRES, YRES)),
- pointQueue(std::queue<Point*>()),
- ren(NULL),
- isMouseDown(false),
- activeElement(1)
-{
- sim = new Simulation();
-}
-
-Simulation * Sandbox::GetSimulation()
-{
- return sim;
-}
-
-void Sandbox::OnMouseMoved(int localx, int localy, int dx, int dy)
-{
- if(isMouseDown)
- {
- pointQueue.push(new Point(localx-dx, localy-dy));
- pointQueue.push(new Point(localx, localy));
- }
-}
-
-void Sandbox::OnMouseClick(int localx, int localy, unsigned int button)
-{
- isMouseDown = true;
- pointQueue.push(new Point(localx, localy));
-}
-
-void Sandbox::OnMouseUp(int localx, int localy, unsigned int button)
-{
- if(isMouseDown)
- {
- isMouseDown = false;
- pointQueue.push(new Point(localx, localy));
- }
-}
-
-void Sandbox::Draw(const Point& screenPos)
-{
- Graphics * g = Engine::Ref().g;
- if(!ren)
- ren = new Renderer(g, sim);
- ren->render_parts();
-}
-
-void Sandbox::Tick(float delta)
-{
- if(!pointQueue.empty())
- {
- Point * sPoint = NULL;
- while(!pointQueue.empty())
- {
- Point * fPoint = pointQueue.front();
- pointQueue.pop();
- if(sPoint)
- {
- sim->create_line(fPoint->X, fPoint->Y, sPoint->X, sPoint->Y, 1, 1, activeElement, 0);
- delete sPoint;
- }
- else
- {
- sim->create_parts(fPoint->X, fPoint->Y, 1, 1, activeElement, 0);
- }
- sPoint = fPoint;
- }
- if(sPoint)
- delete sPoint;
- }
- sim->update_particles();
- sim->sys_pause = 1;
-}
-
-Sandbox::~Sandbox() {
- // TODO Auto-generated destructor stub
-}
-
-} /* namespace ui */