Changed the way enums work
This commit is contained in:
@@ -1,4 +0,0 @@
|
|||||||
#ifndef ACTIONTYPE_H
|
|
||||||
#define ACTIONTYPE_H
|
|
||||||
static enum ActionType {Nothing, Pause, Lose, Draw, Win};
|
|
||||||
#endif
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
#ifndef AFFECTTYPE_H
|
|
||||||
#define AFFECTTYPE_H
|
|
||||||
static enum AffectType {NoChange, Increase, Decrease};
|
|
||||||
#endif
|
|
||||||
@@ -1,11 +1,7 @@
|
|||||||
#include "BaseButtonInstance.h"
|
#include "BaseButtonInstance.h"
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
|
|
||||||
bool floatBottom = false;
|
|
||||||
bool floatRight = false;
|
|
||||||
bool floatCenter = false;
|
|
||||||
bool disabled = false;
|
|
||||||
bool selected = false;
|
|
||||||
ButtonListener* listener = NULL;
|
ButtonListener* listener = NULL;
|
||||||
|
|
||||||
BaseButtonInstance::BaseButtonInstance(void)
|
BaseButtonInstance::BaseButtonInstance(void)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public:
|
|||||||
bool floatBottom;
|
bool floatBottom;
|
||||||
bool floatRight;
|
bool floatRight;
|
||||||
bool floatCenter;
|
bool floatCenter;
|
||||||
bool disabled;
|
volatile bool disabled;
|
||||||
bool selected;
|
bool selected;
|
||||||
protected:
|
protected:
|
||||||
bool mouseInArea(float, float, float, float, float, float);
|
bool mouseInArea(float, float, float, float, float, float);
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
#ifndef BINTYPE_H
|
|
||||||
#define BINTYPE_H
|
|
||||||
static enum ActionType {GameTool, Grab, Clone, Hammer};
|
|
||||||
#endif
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
#ifndef CONTROLLERTYPE_H
|
|
||||||
#define CONTROLLERTYPE_H
|
|
||||||
static enum ControllerType {None, KeyboardRight, KeyboardLeft, Joypad1, Joypad2, Chase, Flee};
|
|
||||||
#endif
|
|
||||||
3
Demo.h
3
Demo.h
@@ -34,6 +34,7 @@ class Demo { // : public GApp {
|
|||||||
CameraController cameraController;
|
CameraController cameraController;
|
||||||
RenderDevice* renderDevice;
|
RenderDevice* renderDevice;
|
||||||
UserInput* userInput;
|
UserInput* userInput;
|
||||||
|
PropertyWindow* _propWindow;
|
||||||
private:
|
private:
|
||||||
void initGUI();
|
void initGUI();
|
||||||
HWND _hWndMain;
|
HWND _hWndMain;
|
||||||
@@ -46,7 +47,7 @@ class Demo { // : public GApp {
|
|||||||
HWND _hwndToolbox;
|
HWND _hwndToolbox;
|
||||||
HWND _buttonTest;
|
HWND _buttonTest;
|
||||||
HWND _hwndRenderer;
|
HWND _hwndRenderer;
|
||||||
PropertyWindow* _propWindow;
|
|
||||||
protected:
|
protected:
|
||||||
Stopwatch m_graphicsWatch;
|
Stopwatch m_graphicsWatch;
|
||||||
Stopwatch m_logicWatch;
|
Stopwatch m_logicWatch;
|
||||||
|
|||||||
14
Enums.h
Normal file
14
Enums.h
Normal file
@@ -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
|
||||||
BIN
G3D-Fun.zip
Normal file
BIN
G3D-Fun.zip
Normal file
Binary file not shown.
@@ -339,14 +339,6 @@
|
|||||||
Name="Header Files"
|
Name="Header Files"
|
||||||
Filter="h;hpp;hxx;hm;inl"
|
Filter="h;hpp;hxx;hm;inl"
|
||||||
>
|
>
|
||||||
<File
|
|
||||||
RelativePath=".\ActionType.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\AffectType.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\AudioPlayer.h"
|
RelativePath=".\AudioPlayer.h"
|
||||||
>
|
>
|
||||||
@@ -355,10 +347,6 @@
|
|||||||
RelativePath=".\ax.h"
|
RelativePath=".\ax.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\BinType.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\BrowserCallHandler.h"
|
RelativePath=".\BrowserCallHandler.h"
|
||||||
>
|
>
|
||||||
@@ -372,11 +360,11 @@
|
|||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\ControllerType.h"
|
RelativePath=".\Demo.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\Demo.h"
|
RelativePath=".\Enums.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
@@ -387,22 +375,6 @@
|
|||||||
RelativePath=".\IEDispatcher.h"
|
RelativePath=".\IEDispatcher.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\InputType.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\JointType.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\KeywordFilterType.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\PartType.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\propertyGrid.h"
|
RelativePath=".\propertyGrid.h"
|
||||||
>
|
>
|
||||||
@@ -415,22 +387,6 @@
|
|||||||
RelativePath=".\resource.h"
|
RelativePath=".\resource.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\SoundType.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\Surface.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\SurfaceConstraint.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\SurfaceType.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\win32Defines.h"
|
RelativePath=".\win32Defines.h"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ void ImageButtonInstance::drawObj(RenderDevice* rd, Vector2 mousePos, bool mouse
|
|||||||
positionRelative = Vector2(rd->getWidth() + position.x, position.y);
|
positionRelative = Vector2(rd->getWidth() + position.x, position.y);
|
||||||
}
|
}
|
||||||
int renderimage = openGLID;
|
int renderimage = openGLID;
|
||||||
if(selected == true && !image_dn.isNull())
|
if(selected == true && !image_dn.isNull() && !disabled)
|
||||||
{
|
{
|
||||||
renderimage = openGLID_dn;
|
renderimage = openGLID_dn;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
|
||||||
@@ -136,16 +136,14 @@ void Instance::removeChild(Instance* oldChild)
|
|||||||
|
|
||||||
Instance* Instance::findFirstChild(std::string name)
|
Instance* Instance::findFirstChild(std::string name)
|
||||||
{
|
{
|
||||||
Instance* child = NULL;
|
|
||||||
for(size_t i = 0; i < children.size(); i++)
|
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);
|
return children.at(i);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return child;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ public:
|
|||||||
virtual void render(RenderDevice*);
|
virtual void render(RenderDevice*);
|
||||||
std::vector<Instance*> children; // All children.
|
std::vector<Instance*> children; // All children.
|
||||||
std::string getClassName();
|
std::string getClassName();
|
||||||
Instance* findFirstChild(std::string);
|
virtual Instance* findFirstChild(std::string);
|
||||||
std::vector<Instance* > getChildren();
|
std::vector<Instance* > getChildren();
|
||||||
std::vector<Instance* > getAllChildren();
|
std::vector<Instance* > getAllChildren();
|
||||||
void setParent(Instance*);
|
void setParent(Instance*);
|
||||||
|
|||||||
@@ -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
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
#ifndef KEYWORDFILTERTYPE_H
|
|
||||||
#define KEYWORDFILTERTYPE_H
|
|
||||||
static enum KeywordFilterType {Include, Exclude};
|
|
||||||
#endif
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
#ifndef PARTTYPE_H
|
|
||||||
#define PARTTYPE_H
|
|
||||||
static enum PartType {Ball, Block, Cylinder};
|
|
||||||
#endif
|
|
||||||
@@ -149,7 +149,7 @@ void PhysicalInstance::render(RenderDevice* rd)
|
|||||||
for(int i = 0; i < 96; i+=16)
|
for(int i = 0; i < 96; i+=16)
|
||||||
{
|
{
|
||||||
double add = 0.8;
|
double add = 0.8;
|
||||||
Surface face;
|
SurfaceType face;
|
||||||
if(i == 0)//Back
|
if(i == 0)//Back
|
||||||
face = back;
|
face = back;
|
||||||
else if(i == 16)//Right
|
else if(i == 16)//Right
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "instance.h"
|
#include "instance.h"
|
||||||
#include "Surface.h"
|
#include "Enums.h"
|
||||||
|
|
||||||
class PhysicalInstance :
|
class PhysicalInstance :
|
||||||
public Instance
|
public Instance
|
||||||
@@ -12,12 +12,12 @@ public:
|
|||||||
~PhysicalInstance(void);
|
~PhysicalInstance(void);
|
||||||
virtual void render(RenderDevice*);
|
virtual void render(RenderDevice*);
|
||||||
Vector3 velocity;
|
Vector3 velocity;
|
||||||
Surface top;
|
SurfaceType top;
|
||||||
Surface front;
|
SurfaceType front;
|
||||||
Surface right;
|
SurfaceType right;
|
||||||
Surface back;
|
SurfaceType back;
|
||||||
Surface left;
|
SurfaceType left;
|
||||||
Surface bottom;
|
SurfaceType bottom;
|
||||||
CoordinateFrame cFrame;
|
CoordinateFrame cFrame;
|
||||||
Color3 color;
|
Color3 color;
|
||||||
Vector3 getPosition();
|
Vector3 getPosition();
|
||||||
|
|||||||
@@ -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
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
#ifndef SURFACE_H
|
|
||||||
#define SURFACE_H
|
|
||||||
static enum Surface {Smooth, Snaps, Inlets, Glue, Weld, Hinge, Motor};
|
|
||||||
#endif
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
#ifndef SURFACECONSTRAINT_H
|
|
||||||
#define SURFACECONSTRAINT_H
|
|
||||||
static enum SurfaceConstraint {None, Hinge, SteppingMotor, Motor};
|
|
||||||
#endif
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
#ifndef SURFACETYPE_H
|
|
||||||
#define SURFACETYPE_H
|
|
||||||
static enum SurfaceType {Smooth, Bumps, Weld, Snaps, Inlet};
|
|
||||||
#endif
|
|
||||||
25
main.cpp
25
main.cpp
@@ -157,7 +157,7 @@ void OnError(int err, std::string msg = "")
|
|||||||
//usableApp->window()->setMouseVisible(true);
|
//usableApp->window()->setMouseVisible(true);
|
||||||
std::string emsg = "An unexpected error has occured and "+PlaceholderName+" has to quit. We're sorry!" + msg;
|
std::string emsg = "An unexpected error has occured and "+PlaceholderName+" has to quit. We're sorry!" + msg;
|
||||||
std::string title = PlaceholderName+"Crash";
|
std::string title = PlaceholderName+"Crash";
|
||||||
clearInstances();
|
//clearInstances();
|
||||||
MessageBox(NULL, emsg.c_str(), title.c_str(), MB_OK);
|
MessageBox(NULL, emsg.c_str(), title.c_str(), MB_OK);
|
||||||
exit(err);
|
exit(err);
|
||||||
}
|
}
|
||||||
@@ -307,6 +307,7 @@ void deleteInstance()
|
|||||||
AudioPlayer::playSound(GetFileInPath("/content/sounds/pageturn.wav"));
|
AudioPlayer::playSound(GetFileInPath("/content/sounds/pageturn.wav"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
usableApp->_propWindow->ClearProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -803,15 +804,7 @@ void Demo::onCleanup() {
|
|||||||
void Demo::onLogic() {
|
void Demo::onLogic() {
|
||||||
// Add non-simulation game logic and AI code here
|
// 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<Instance*> Demo::getSelection()
|
|||||||
return selectedInstances;
|
return selectedInstances;
|
||||||
}
|
}
|
||||||
void Demo::onSimulation(RealTime rdt, SimTime sdt, SimTime idt) {
|
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)
|
if(dataModel->name != title)
|
||||||
{
|
{
|
||||||
title = dataModel->name;
|
title = dataModel->name;
|
||||||
|
|||||||
Reference in New Issue
Block a user