diff --git a/ActionType.h b/ActionType.h deleted file mode 100644 index 6ec748b..0000000 --- a/ActionType.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef ACTIONTYPE_H -#define ACTIONTYPE_H -static enum ActionType {Nothing, Pause, Lose, Draw, Win}; -#endif diff --git a/AffectType.h b/AffectType.h deleted file mode 100644 index cee3834..0000000 --- a/AffectType.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef AFFECTTYPE_H -#define AFFECTTYPE_H -static enum AffectType {NoChange, Increase, Decrease}; -#endif diff --git a/BaseButtonInstance.cpp b/BaseButtonInstance.cpp index 99dfa46..ff411f5 100644 --- a/BaseButtonInstance.cpp +++ b/BaseButtonInstance.cpp @@ -1,11 +1,7 @@ #include "BaseButtonInstance.h" #include "Globals.h" -bool floatBottom = false; -bool floatRight = false; -bool floatCenter = false; -bool disabled = false; -bool selected = false; + ButtonListener* listener = NULL; BaseButtonInstance::BaseButtonInstance(void) diff --git a/BaseButtonInstance.h b/BaseButtonInstance.h index 6322426..abb0784 100644 --- a/BaseButtonInstance.h +++ b/BaseButtonInstance.h @@ -16,7 +16,7 @@ public: bool floatBottom; bool floatRight; bool floatCenter; - bool disabled; + volatile bool disabled; bool selected; protected: bool mouseInArea(float, float, float, float, float, float); diff --git a/BinType.h b/BinType.h deleted file mode 100644 index 15ef898..0000000 --- a/BinType.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef BINTYPE_H -#define BINTYPE_H -static enum ActionType {GameTool, Grab, Clone, Hammer}; -#endif diff --git a/ControllerType.h b/ControllerType.h deleted file mode 100644 index 77a6d7f..0000000 --- a/ControllerType.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef CONTROLLERTYPE_H -#define CONTROLLERTYPE_H -static enum ControllerType {None, KeyboardRight, KeyboardLeft, Joypad1, Joypad2, Chase, Flee}; -#endif diff --git a/Demo.h b/Demo.h index dc0b16e..e6fef08 100644 --- a/Demo.h +++ b/Demo.h @@ -34,6 +34,7 @@ class Demo { // : public GApp { CameraController cameraController; RenderDevice* renderDevice; UserInput* userInput; + PropertyWindow* _propWindow; private: void initGUI(); HWND _hWndMain; @@ -46,7 +47,7 @@ class Demo { // : public GApp { HWND _hwndToolbox; HWND _buttonTest; HWND _hwndRenderer; - PropertyWindow* _propWindow; + protected: Stopwatch m_graphicsWatch; Stopwatch m_logicWatch; diff --git a/Enums.h b/Enums.h new file mode 100644 index 0000000..68d7f23 --- /dev/null +++ b/Enums.h @@ -0,0 +1,14 @@ +#ifndef ENUM_H +#define ENUM_H +static enum BinType {GameTool, Grab, Clone, Hammer}; +static enum ControllerType {None, KeyboardRight, KeyboardLeft, Joypad1, Joypad2, Chase, Flee}; +//static enum JointType {UNK0, WeldJoint, SnapJoint, UNK3, Rotate, RotateP, RotateV, GlueJoint, UNK8, UNK9, None}; +static enum ActionType {Nothing, Pause, Lose, Draw, Win}; +static enum AffectType {NoChange, Increase, Decrease}; +static enum InputType {NoInput, LeftTread, RightTread, Steer, Throtle, UpDown, Action1, Action2, Action3, Action4, Action5, Constant, Sin}; +//static enum SurfaceConstraint {None, Hinge, SteppingMotor, Motor}; +static enum SurfaceType{Smooth, Snaps, Inlets, Glue, Weld, Hinge, Motor, Bumps}; +static enum SoundType {NoSound, Boing, Bomb, Break, Click, Clock, Slingshot, Page, Ping, Snap, Splat, Step, StepOn, Swoosh, Victory}; +static enum PartType {Ball, Block, Cylinder}; +static enum KeywordFilterType {Include, Exclude}; +#endif diff --git a/G3D-Fun.zip b/G3D-Fun.zip new file mode 100644 index 0000000..1f63569 Binary files /dev/null and b/G3D-Fun.zip differ diff --git a/G3DTest.vcproj b/G3DTest.vcproj index a244185..024a8e3 100644 --- a/G3DTest.vcproj +++ b/G3DTest.vcproj @@ -339,14 +339,6 @@ Name="Header Files" Filter="h;hpp;hxx;hm;inl" > - - - - @@ -355,10 +347,6 @@ RelativePath=".\ax.h" > - - @@ -372,11 +360,11 @@ > - - - - - - - - @@ -415,22 +387,6 @@ RelativePath=".\resource.h" > - - - - - - - - diff --git a/ImageButtonInstance.cpp b/ImageButtonInstance.cpp index 6268941..897cc9b 100644 --- a/ImageButtonInstance.cpp +++ b/ImageButtonInstance.cpp @@ -85,7 +85,7 @@ void ImageButtonInstance::drawObj(RenderDevice* rd, Vector2 mousePos, bool mouse positionRelative = Vector2(rd->getWidth() + position.x, position.y); } int renderimage = openGLID; - if(selected == true && !image_dn.isNull()) + if(selected == true && !image_dn.isNull() && !disabled) { renderimage = openGLID_dn; } diff --git a/InputType.h b/InputType.h deleted file mode 100644 index 1ffad84..0000000 --- a/InputType.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef INPUTTYPE_H -#define INPUTTYPE_H -static enum InputType {NoInput, LeftTread, RightTread, Steer, Throtle, UpDown, Action1, Action2, Action3, Action4, Action5, Constant, Sin}; -#endif diff --git a/Instance.cpp b/Instance.cpp index 624f3a4..6cf2fea 100644 --- a/Instance.cpp +++ b/Instance.cpp @@ -136,16 +136,14 @@ void Instance::removeChild(Instance* oldChild) Instance* Instance::findFirstChild(std::string name) { - Instance* child = NULL; for(size_t i = 0; i < children.size(); i++) { - if(children.at(i)->name == name) + if(children.at(i)->name.compare(name) == 0) { - child = children.at(i); - break; + return children.at(i); } } - return child; + return NULL; } diff --git a/Instance.h b/Instance.h index ad132e0..eb85d18 100644 --- a/Instance.h +++ b/Instance.h @@ -12,7 +12,7 @@ public: virtual void render(RenderDevice*); std::vector children; // All children. std::string getClassName(); - Instance* findFirstChild(std::string); + virtual Instance* findFirstChild(std::string); std::vector getChildren(); std::vector getAllChildren(); void setParent(Instance*); diff --git a/JointType.h b/JointType.h deleted file mode 100644 index 61b1f22..0000000 --- a/JointType.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef JOINTTYPE_H -#define JOINTTYPE_H -static enum ActionType {UNK0, Weld, Snap, UNK3, Rotate, RotateP, RotateV, Glue, UNK8, UNK9, None}; -#endif diff --git a/KeywordFilterType.h b/KeywordFilterType.h deleted file mode 100644 index b3faa70..0000000 --- a/KeywordFilterType.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef KEYWORDFILTERTYPE_H -#define KEYWORDFILTERTYPE_H -static enum KeywordFilterType {Include, Exclude}; -#endif diff --git a/PartType.h b/PartType.h deleted file mode 100644 index 9c3c561..0000000 --- a/PartType.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef PARTTYPE_H -#define PARTTYPE_H -static enum PartType {Ball, Block, Cylinder}; -#endif diff --git a/PhysicalInstance.cpp b/PhysicalInstance.cpp index d776366..7374d64 100644 --- a/PhysicalInstance.cpp +++ b/PhysicalInstance.cpp @@ -149,7 +149,7 @@ void PhysicalInstance::render(RenderDevice* rd) for(int i = 0; i < 96; i+=16) { double add = 0.8; - Surface face; + SurfaceType face; if(i == 0)//Back face = back; else if(i == 16)//Right diff --git a/PhysicalInstance.h b/PhysicalInstance.h index 3c26b07..69456e9 100644 --- a/PhysicalInstance.h +++ b/PhysicalInstance.h @@ -1,6 +1,6 @@ #pragma once #include "instance.h" -#include "Surface.h" +#include "Enums.h" class PhysicalInstance : public Instance @@ -12,12 +12,12 @@ public: ~PhysicalInstance(void); virtual void render(RenderDevice*); Vector3 velocity; - Surface top; - Surface front; - Surface right; - Surface back; - Surface left; - Surface bottom; + SurfaceType top; + SurfaceType front; + SurfaceType right; + SurfaceType back; + SurfaceType left; + SurfaceType bottom; CoordinateFrame cFrame; Color3 color; Vector3 getPosition(); diff --git a/SoundType.h b/SoundType.h deleted file mode 100644 index e9f4d5b..0000000 --- a/SoundType.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef SOUNDTYPE_H -#define SOUNDTYPE_H -static enum SoundType {NoSound, Boing, Bomb, Break, Click, Clock, Slingshot, Page, Ping, Snap, Splat, Step, StepOn, Swoosh, Victory}; -#endif diff --git a/Surface.h b/Surface.h deleted file mode 100644 index 86ef867..0000000 --- a/Surface.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef SURFACE_H -#define SURFACE_H -static enum Surface {Smooth, Snaps, Inlets, Glue, Weld, Hinge, Motor}; -#endif diff --git a/SurfaceConstraint.h b/SurfaceConstraint.h deleted file mode 100644 index 59cac85..0000000 --- a/SurfaceConstraint.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef SURFACECONSTRAINT_H -#define SURFACECONSTRAINT_H -static enum SurfaceConstraint {None, Hinge, SteppingMotor, Motor}; -#endif diff --git a/SurfaceType.h b/SurfaceType.h deleted file mode 100644 index ec6c773..0000000 --- a/SurfaceType.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef SURFACETYPE_H -#define SURFACETYPE_H -static enum SurfaceType {Smooth, Bumps, Weld, Snaps, Inlet}; -#endif diff --git a/main.cpp b/main.cpp index d3d9e41..287512e 100644 --- a/main.cpp +++ b/main.cpp @@ -157,7 +157,7 @@ void OnError(int err, std::string msg = "") //usableApp->window()->setMouseVisible(true); std::string emsg = "An unexpected error has occured and "+PlaceholderName+" has to quit. We're sorry!" + msg; std::string title = PlaceholderName+"Crash"; - clearInstances(); + //clearInstances(); MessageBox(NULL, emsg.c_str(), title.c_str(), MB_OK); exit(err); } @@ -307,6 +307,7 @@ void deleteInstance() AudioPlayer::playSound(GetFileInPath("/content/sounds/pageturn.wav")); } } + usableApp->_propWindow->ClearProperties(); } @@ -802,16 +803,8 @@ void Demo::onCleanup() { void Demo::onLogic() { // Add non-simulation game logic and AI code here - - Instance* obj = dataModel->getGuiRoot()->findFirstChild("Delete"); - if(obj != NULL) - { - ImageButtonInstance* button = (ImageButtonInstance*)obj; - if(selectedInstances.size() > 0) - button->disabled = true; - else - button->disabled = false; - } + + } @@ -832,6 +825,18 @@ std::vector Demo::getSelection() return selectedInstances; } void Demo::onSimulation(RealTime rdt, SimTime sdt, SimTime idt) { + + Instance* obj = dataModel->getGuiRoot()->findFirstChild("Delete"); + if(obj != NULL) + { + ImageButtonInstance* button = (ImageButtonInstance*)obj; + if(selectedInstances.size() <= 0) + button->disabled = true; + else + button->disabled = false; + } + + if(dataModel->name != title) { title = dataModel->name;