Added instance types

I feel like the way it works now isn't the best
This commit is contained in:
andreja6
2018-04-10 21:59:55 -07:00
parent 0908d93f29
commit 59f6652396
7 changed files with 74 additions and 1 deletions

Binary file not shown.

View File

@@ -233,6 +233,10 @@
/>
</FileConfiguration>
</File>
<File
RelativePath=".\PhysicalInstance.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
@@ -242,6 +246,10 @@
RelativePath=".\Instance.h"
>
</File>
<File
RelativePath=".\PhysicalInstance.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"

View File

@@ -1,9 +1,25 @@
#include <G3DAll.h>
#include "Instance.h"
std::string name;
Instance* parent;
static const int BASE_INSTANCE = 0;
static const int PHYSICAL_INSTANCE = 1;
static const int type = BASE_INSTANCE;
Instance::Instance(void)
{
name = "Default Game Instance";
}
Instance::~Instance(void)
{
name = "Default Game Instance";
}
int getType()
{
return type;
}

View File

@@ -5,4 +5,9 @@ class Instance
public:
Instance(void);
~Instance(void);
std::string name;
int getType();
Instance* parent; // Another pointer.
static const int BASE_INSTANCE;
static const int PHYSICAL_INSTANCE;
};

26
PhysicalInstance.cpp Normal file
View File

@@ -0,0 +1,26 @@
#include <G3DAll.h>
#include "PhysicalInstance.h"
bool collides = true;
bool anchored = false;
Vector3 size;
Vector3 position;
Color3 color;
//static const int type = PHYSICAL_INSTANCE;
PhysicalInstance::PhysicalInstance(void)
{
name = "Default PhysicalInstance";
collides = true;
anchored = true;
size = Vector3(2,1,4);
position = Vector3(0,0,0);
color = Color3::gray();
}
PhysicalInstance::~PhysicalInstance(void)
{
}

10
PhysicalInstance.h Normal file
View File

@@ -0,0 +1,10 @@
#pragma once
#include "instance.h"
class PhysicalInstance :
public Instance
{
public:
PhysicalInstance(void);
~PhysicalInstance(void);
};

View File

@@ -12,6 +12,7 @@
*/
#include <G3DAll.h>
#include "Instance.h"
#include "PhysicalInstance.h"
#if G3D_VER < 61000
#error Requires G3D 6.10
@@ -19,6 +20,7 @@
static const float VNUM = 0.01F;
static const std::string VERSION = "PRE-ALPHA ";
static std::vector<Instance> Instances;
static Instance* dataModel;
static GFontRef fntdominant = NULL;
static GFontRef fntlighttrek = NULL;
static bool democ = true;
@@ -93,11 +95,17 @@ std::string Convert (float number){
void Demo::onInit() {
// Called before Demo::run() beings
dataModel = new Instance();
//dataModel->name = "undefined";
dataModel->parent = NULL;
PhysicalInstance* test = new PhysicalInstance();
setDesiredFrameRate(FPSVal[index]);
app->debugCamera.setPosition(Vector3(0, 2, 10));
app->debugCamera.lookAt(Vector3(0, 2, 0));
//std::string str = "Dynamica Duomillenium 5 Version " + VERSION + Convert(VNUM);
std::string str = "Game \"undefined\"";
std::string str = "Game \"" + dataModel->name + "\"";
app->renderDevice->setCaption(str);
GApplet::onInit();
}