I am going to be re-creating a game engine I created awhile back. This time I want to do it right, so I did some research into design patterns and tried to put pieces together to accomplish my goal. The idea of the game engine is simplicity, but at the same time I don't want to sacrifice usability.
Here is a blueprint of what I am thinking, let me know if you can see any downfalls especially in expandability:
class Object
{
public:
string name;
}
class Object3D : public Object
{
public:
int x;
int y;
int z;
}
class Object2D : public Object
{
public:
int x;
int y;
}
class cube : public Object3D
{
cube() : x(0), y(0), z(0), name("cube") {}
}
class square
{
...
}
int main()
{
SGL Engine(paramters);
c = cube();
s = square();
Engine->Lib3D->AddCube(&c, "cube");
Engine->Lib2D->AddSquare(&s, "square");
Engine->Input->keyboard(&kbevent);
while(Engine->running())
{
if (x)
Engine->Draw("cube");
else
Engine->Draw("square");
}
}
void kbevent(event-paramteres)
{
if (key.up)
engineptr->objects["cube"]->move(x,y);
}
The target language is C++.