Skip to content
Browse files

first commit

  • Loading branch information...
0 parents commit 97bdd8f73251da2160f4c3346c63786b49902286 @elliotwoods committed Jul 10, 2011
Showing with 101 additions and 0 deletions.
  1. +3 −0 README
  2. +33 −0 src/IV_Base.cpp
  3. +47 −0 src/IV_Base.h
  4. +9 −0 src/ofxInteractiveVariable.cpp
  5. +9 −0 src/ofxInteractiveVariable.h
3 README
@@ -0,0 +1,3 @@
+ofxInteractiveVariable, copyright Kimchi and Chips 2011
+
+Wrappers for simple vars (e.g. float, int, etc) to register onto global 'interactive variable' dictionary for global editing.
33 src/IV_Base.cpp
@@ -0,0 +1,33 @@
+//
+// IV_Base.cpp
+// MapTools
+//
+// Created by Elliot Woods on 06/03/2011.
+// Copyright 2011 Kimchi and Chips. All rights reserved.
+//
+
+#include "IV_Base.h"
+
+IV_Base::IV_Base()
+{
+ IV_Dictionary::IVars.insert(this);
+}
+
+IV_Base::~IV_Base()
+{
+ IV_Dictionary::IVars.erase(this);
+}
+
+void IV_Base::setName(string newName)
+{
+ //we might have to create an event thing here
+ //if we consider that we need to trigger things
+ //on a name change
+ //e.g. update name on a client machine
+
+ name = newName;
+}
+
+//template class IV<float>;
+
+set<IV_Base*> IV_Dictionary::IVars = set<IV_Base*>();
47 src/IV_Base.h
@@ -0,0 +1,47 @@
+#pragma once
+//
+// IV_Base.h
+// MapTools
+//
+// Created by Elliot Woods on 06/03/2011.
+// Copyright 2011 Kimchi and Chips. All rights reserved.
+//
+
+#include <string>
+#include <set>
+using namespace std;
+
+//interactive handling
+class IV_Base
+{
+public:
+ IV_Base();
+ ~IV_Base();
+
+ string getName() { return name; }
+ void setName(string newName);
+
+protected:
+ string name;
+};
+
+
+
+//template variable
+template<typename T>
+class IV : public IV_Base
+{
+ public:
+ IV(string name) { setName(name); }
+
+ T var;
+};
+
+
+
+//dictionary class
+class IV_Dictionary
+{
+public:
+ static set<IV_Base*> IVars;
+};
9 src/ofxInteractiveVariable.cpp
@@ -0,0 +1,9 @@
+//
+// ofxInteractiveVariable.cpp
+// ofxInteractiveVariable
+//
+// Created by Elliot Woods on 06/03/2011.
+// Copyright 2011 Kimchi and Chips. All rights reserved.
+//
+
+#include "ofxInteractiveVariable.h"
9 src/ofxInteractiveVariable.h
@@ -0,0 +1,9 @@
+//
+// ofxInteractiveVariable.h
+// ofxInteractiveVariable
+//
+// Created by Elliot Woods on 06/03/2011.
+// Copyright 2011 Kimchi and Chips. All rights reserved.
+//
+
+#include "IV_Base.h"

0 comments on commit 97bdd8f

Please sign in to comment.
Something went wrong with that request. Please try again.