summaryrefslogtreecommitdiff
path: root/src/Console.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-01-11 22:59:45 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-01-11 22:59:45 (GMT)
commitfc2f52099c0bbb2412046252bf7b5e4113bbe8e4 (patch)
treeaa820daf182a845758c3ba2c649df54a228748d4 /src/Console.cpp
parent2eb09c1daac8199532694167f418146fa57e7735 (diff)
downloadpowder-fc2f52099c0bbb2412046252bf7b5e4113bbe8e4.zip
powder-fc2f52099c0bbb2412046252bf7b5e4113bbe8e4.tar.gz
More stuff, started console
Diffstat (limited to 'src/Console.cpp')
-rw-r--r--src/Console.cpp68
1 files changed, 68 insertions, 0 deletions
diff --git a/src/Console.cpp b/src/Console.cpp
new file mode 100644
index 0000000..6bf8ce6
--- /dev/null
+++ b/src/Console.cpp
@@ -0,0 +1,68 @@
+
+#include <string>
+#include "Console.h"
+
+int Console::ParseType(std::string * type)
+{
+ char * txt = (char *)type->c_str();
+ int i = -1;
+ // alternative names for some elements
+ if (*type == "C4") i = PT_PLEX;
+ else if (*type == "C5") i = PT_C5;
+ else if (*type == "NONE") i = PT_NONE;
+ if (i>=0 && i<PT_NUM && sim->ptypes[i].enabled)
+ {
+ (*lastError) = "";
+ return i;
+ }
+ for (i=1; i<PT_NUM; i++) {
+ if (strcasecmp(txt, sim->ptypes[i].name)==0 && sim->ptypes[i].enabled)
+ {
+ (*lastError) = "";
+ return i;
+ }
+ }
+ (*lastError) = "Particle type not recognised";
+ return -1;
+}
+
+void Console::Tick(float * dt)
+{
+
+}
+
+void Console::ConsoleShown()
+{
+
+}
+
+void Console::ConsoleHidden()
+{
+
+}
+
+int Console::ProcessCommand(std::string * command)
+{
+
+}
+
+std::string * Console::GetLastError()
+{
+ return lastError;
+}
+
+std::vector<ConsoleCommand> * Console::GetPreviousCommands()
+{
+
+}
+
+Console::Console(ui::Sandbox * sandbox)
+{
+ this->sandbox = sandbox;
+ sim = sandbox->GetSimulation();
+}
+
+Console::~Console()
+{
+
+}