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 "Globals.h"
|
||||
|
||||
bool floatBottom = false;
|
||||
bool floatRight = false;
|
||||
bool floatCenter = false;
|
||||
bool disabled = false;
|
||||
bool selected = false;
|
||||
|
||||
ButtonListener* listener = NULL;
|
||||
|
||||
BaseButtonInstance::BaseButtonInstance(void)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
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;
|
||||
|
||||
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"
|
||||
Filter="h;hpp;hxx;hm;inl"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\ActionType.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\AffectType.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\AudioPlayer.h"
|
||||
>
|
||||
@@ -355,10 +347,6 @@
|
||||
RelativePath=".\ax.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\BinType.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\BrowserCallHandler.h"
|
||||
>
|
||||
@@ -372,11 +360,11 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ControllerType.h"
|
||||
RelativePath=".\Demo.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Demo.h"
|
||||
RelativePath=".\Enums.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
@@ -387,22 +375,6 @@
|
||||
RelativePath=".\IEDispatcher.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\InputType.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\JointType.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\KeywordFilterType.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PartType.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\propertyGrid.h"
|
||||
>
|
||||
@@ -415,22 +387,6 @@
|
||||
RelativePath=".\resource.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\SoundType.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Surface.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\SurfaceConstraint.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\SurfaceType.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\win32Defines.h"
|
||||
>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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* 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ public:
|
||||
virtual void render(RenderDevice*);
|
||||
std::vector<Instance*> children; // All children.
|
||||
std::string getClassName();
|
||||
Instance* findFirstChild(std::string);
|
||||
virtual Instance* findFirstChild(std::string);
|
||||
std::vector<Instance* > getChildren();
|
||||
std::vector<Instance* > getAllChildren();
|
||||
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)
|
||||
{
|
||||
double add = 0.8;
|
||||
Surface face;
|
||||
SurfaceType face;
|
||||
if(i == 0)//Back
|
||||
face = back;
|
||||
else if(i == 16)//Right
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
27
main.cpp
27
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<Instance*> 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;
|
||||
|
||||
Reference in New Issue
Block a user