Added new way of dealing with enums

This commit is contained in:
andreja6
2018-10-23 19:42:42 -07:00
parent ebbbbb3a69
commit 7f7e015706
4 changed files with 27 additions and 14 deletions

9
Enum.h Normal file
View File

@@ -0,0 +1,9 @@
namespace Enum
{
namespace SurfaceType
{
enum Value {
Smooth, Bumps, Welds, Glue
};
}
}

View File

@@ -363,6 +363,10 @@
RelativePath=".\Demo.h" RelativePath=".\Demo.h"
> >
</File> </File>
<File
RelativePath=".\Enum.h"
>
</File>
<File <File
RelativePath=".\Enums.h" RelativePath=".\Enums.h"
> >

View File

@@ -13,12 +13,12 @@ PhysicalInstance::PhysicalInstance(void)
color = Color3::gray(); color = Color3::gray();
velocity = Vector3(0,0,0); velocity = Vector3(0,0,0);
rotVelocity = Vector3(0,0,0); rotVelocity = Vector3(0,0,0);
top = Smooth; top = Enum::SurfaceType::Smooth;
front = Smooth; front = Enum::SurfaceType::Smooth;
right = Smooth; right = Enum::SurfaceType::Smooth;
back = Smooth; back = Enum::SurfaceType::Smooth;
left = Smooth; left = Enum::SurfaceType::Smooth;
bottom = Smooth; bottom = Enum::SurfaceType::Smooth;
} }
PhysicalInstance::PhysicalInstance(const PhysicalInstance &oinst) PhysicalInstance::PhysicalInstance(const PhysicalInstance &oinst)
@@ -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;
SurfaceType face; Enum::SurfaceType::Value face;
if(i == 0)//Back if(i == 0)//Back
face = back; face = back;
else if(i == 16)//Right else if(i == 16)//Right

View File

@@ -1,6 +1,6 @@
#pragma once #pragma once
#include "instance.h" #include "instance.h"
#include "Enums.h" #include "Enum.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;
SurfaceType top; Enum::SurfaceType::Value top;
SurfaceType front; Enum::SurfaceType::Value front;
SurfaceType right; Enum::SurfaceType::Value right;
SurfaceType back; Enum::SurfaceType::Value back;
SurfaceType left; Enum::SurfaceType::Value left;
SurfaceType bottom; Enum::SurfaceType::Value bottom;
CoordinateFrame cFrame; CoordinateFrame cFrame;
Color3 color; Color3 color;
Vector3 getPosition(); Vector3 getPosition();