From 7f7e015706d1e303a7ddbc0a13a47d22e23f94d8 Mon Sep 17 00:00:00 2001 From: andreja6 Date: Tue, 23 Oct 2018 19:42:42 -0700 Subject: [PATCH] Added new way of dealing with enums --- Enum.h | 9 +++++++++ G3DTest.vcproj | 4 ++++ PhysicalInstance.cpp | 14 +++++++------- PhysicalInstance.h | 14 +++++++------- 4 files changed, 27 insertions(+), 14 deletions(-) create mode 100644 Enum.h diff --git a/Enum.h b/Enum.h new file mode 100644 index 0000000..4e70d15 --- /dev/null +++ b/Enum.h @@ -0,0 +1,9 @@ +namespace Enum +{ + namespace SurfaceType + { + enum Value { + Smooth, Bumps, Welds, Glue + }; + } +} \ No newline at end of file diff --git a/G3DTest.vcproj b/G3DTest.vcproj index 024a8e3..174413c 100644 --- a/G3DTest.vcproj +++ b/G3DTest.vcproj @@ -363,6 +363,10 @@ RelativePath=".\Demo.h" > + + diff --git a/PhysicalInstance.cpp b/PhysicalInstance.cpp index 7374d64..2866dc3 100644 --- a/PhysicalInstance.cpp +++ b/PhysicalInstance.cpp @@ -13,12 +13,12 @@ PhysicalInstance::PhysicalInstance(void) color = Color3::gray(); velocity = Vector3(0,0,0); rotVelocity = Vector3(0,0,0); - top = Smooth; - front = Smooth; - right = Smooth; - back = Smooth; - left = Smooth; - bottom = Smooth; + top = Enum::SurfaceType::Smooth; + front = Enum::SurfaceType::Smooth; + right = Enum::SurfaceType::Smooth; + back = Enum::SurfaceType::Smooth; + left = Enum::SurfaceType::Smooth; + bottom = Enum::SurfaceType::Smooth; } PhysicalInstance::PhysicalInstance(const PhysicalInstance &oinst) @@ -149,7 +149,7 @@ void PhysicalInstance::render(RenderDevice* rd) for(int i = 0; i < 96; i+=16) { double add = 0.8; - SurfaceType face; + Enum::SurfaceType::Value face; if(i == 0)//Back face = back; else if(i == 16)//Right diff --git a/PhysicalInstance.h b/PhysicalInstance.h index 69456e9..70d89b2 100644 --- a/PhysicalInstance.h +++ b/PhysicalInstance.h @@ -1,6 +1,6 @@ #pragma once #include "instance.h" -#include "Enums.h" +#include "Enum.h" class PhysicalInstance : public Instance @@ -12,12 +12,12 @@ public: ~PhysicalInstance(void); virtual void render(RenderDevice*); Vector3 velocity; - SurfaceType top; - SurfaceType front; - SurfaceType right; - SurfaceType back; - SurfaceType left; - SurfaceType bottom; + Enum::SurfaceType::Value top; + Enum::SurfaceType::Value front; + Enum::SurfaceType::Value right; + Enum::SurfaceType::Value back; + Enum::SurfaceType::Value left; + Enum::SurfaceType::Value bottom; CoordinateFrame cFrame; Color3 color; Vector3 getPosition();