Added instance types
I feel like the way it works now isn't the best
This commit is contained in:
BIN
G3DTest.suo
BIN
G3DTest.suo
Binary file not shown.
@@ -233,6 +233,10 @@
|
|||||||
/>
|
/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\PhysicalInstance.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Header Files"
|
Name="Header Files"
|
||||||
@@ -242,6 +246,10 @@
|
|||||||
RelativePath=".\Instance.h"
|
RelativePath=".\Instance.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\PhysicalInstance.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Resource Files"
|
Name="Resource Files"
|
||||||
|
|||||||
16
Instance.cpp
16
Instance.cpp
@@ -1,9 +1,25 @@
|
|||||||
|
#include <G3DAll.h>
|
||||||
#include "Instance.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)
|
Instance::Instance(void)
|
||||||
{
|
{
|
||||||
|
name = "Default Game Instance";
|
||||||
}
|
}
|
||||||
|
|
||||||
Instance::~Instance(void)
|
Instance::~Instance(void)
|
||||||
{
|
{
|
||||||
|
name = "Default Game Instance";
|
||||||
}
|
}
|
||||||
|
int getType()
|
||||||
|
{
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,4 +5,9 @@ class Instance
|
|||||||
public:
|
public:
|
||||||
Instance(void);
|
Instance(void);
|
||||||
~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
26
PhysicalInstance.cpp
Normal 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
10
PhysicalInstance.h
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "instance.h"
|
||||||
|
|
||||||
|
class PhysicalInstance :
|
||||||
|
public Instance
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PhysicalInstance(void);
|
||||||
|
~PhysicalInstance(void);
|
||||||
|
};
|
||||||
10
main.cpp
10
main.cpp
@@ -12,6 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
#include <G3DAll.h>
|
#include <G3DAll.h>
|
||||||
#include "Instance.h"
|
#include "Instance.h"
|
||||||
|
#include "PhysicalInstance.h"
|
||||||
|
|
||||||
#if G3D_VER < 61000
|
#if G3D_VER < 61000
|
||||||
#error Requires G3D 6.10
|
#error Requires G3D 6.10
|
||||||
@@ -19,6 +20,7 @@
|
|||||||
static const float VNUM = 0.01F;
|
static const float VNUM = 0.01F;
|
||||||
static const std::string VERSION = "PRE-ALPHA ";
|
static const std::string VERSION = "PRE-ALPHA ";
|
||||||
static std::vector<Instance> Instances;
|
static std::vector<Instance> Instances;
|
||||||
|
static Instance* dataModel;
|
||||||
static GFontRef fntdominant = NULL;
|
static GFontRef fntdominant = NULL;
|
||||||
static GFontRef fntlighttrek = NULL;
|
static GFontRef fntlighttrek = NULL;
|
||||||
static bool democ = true;
|
static bool democ = true;
|
||||||
@@ -93,11 +95,17 @@ std::string Convert (float number){
|
|||||||
void Demo::onInit() {
|
void Demo::onInit() {
|
||||||
|
|
||||||
// Called before Demo::run() beings
|
// Called before Demo::run() beings
|
||||||
|
dataModel = new Instance();
|
||||||
|
//dataModel->name = "undefined";
|
||||||
|
dataModel->parent = NULL;
|
||||||
|
|
||||||
|
PhysicalInstance* test = new PhysicalInstance();
|
||||||
setDesiredFrameRate(FPSVal[index]);
|
setDesiredFrameRate(FPSVal[index]);
|
||||||
app->debugCamera.setPosition(Vector3(0, 2, 10));
|
app->debugCamera.setPosition(Vector3(0, 2, 10));
|
||||||
app->debugCamera.lookAt(Vector3(0, 2, 0));
|
app->debugCamera.lookAt(Vector3(0, 2, 0));
|
||||||
//std::string str = "Dynamica Duomillenium 5 Version " + VERSION + Convert(VNUM);
|
//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);
|
app->renderDevice->setCaption(str);
|
||||||
GApplet::onInit();
|
GApplet::onInit();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user