mirror of https://github.com/kurisufriend/threedee
parent
e9e4485dd4
commit
4cac2beb4f
@ -1,9 +1,9 @@ |
|||||||
#pragma once |
#pragma once |
||||||
#include "../objects/vector.h" |
#include "../objects/vector3.h" |
||||||
#include "../objects/entityList.h" |
#include "../objects/entityList2D.h" |
||||||
namespace global |
namespace global |
||||||
{ |
{ |
||||||
extern bool running; |
extern bool running; |
||||||
extern vector2 mousePos; |
extern vector2 mousePos; |
||||||
extern entityList entList; |
extern entityList2D entList; |
||||||
} |
} |
@ -0,0 +1,22 @@ |
|||||||
|
#pragma once |
||||||
|
#include "square.h" |
||||||
|
/*
|
||||||
|
cubes are the basic 3D entity |
||||||
|
*/ |
||||||
|
struct cube : public square |
||||||
|
{ |
||||||
|
float z; |
||||||
|
cube() : square() |
||||||
|
{ |
||||||
|
this->z = 0; |
||||||
|
} |
||||||
|
cube(float x_, float y_, float z_, int radius_) : square(x_, y_, radius_) |
||||||
|
{ |
||||||
|
this->z = z_; |
||||||
|
} |
||||||
|
void run(SDL_Surface* surface) |
||||||
|
{ |
||||||
|
SDL_Rect rect{ this->x, this->y, this->radius, this->radius }; |
||||||
|
SDL_FillRect(surface, &rect, SDL_MapRGB(surface->format, 0xFF, 0xFF, 0xFF)); |
||||||
|
} |
||||||
|
}; |
@ -0,0 +1,19 @@ |
|||||||
|
#pragma once |
||||||
|
#include <vector> |
||||||
|
#include "SDL.h" |
||||||
|
|
||||||
|
#include "cube.h" |
||||||
|
/*
|
||||||
|
entityList3D is the 3D entity container class |
||||||
|
*/ |
||||||
|
class entityList3D : public std::vector<cube> |
||||||
|
{ |
||||||
|
public: |
||||||
|
void run(SDL_Surface* surface) |
||||||
|
{ |
||||||
|
for (cube entity : *this) |
||||||
|
{ |
||||||
|
entity.run(surface); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
@ -1,18 +1,18 @@ |
|||||||
#pragma once |
#pragma once |
||||||
#include "vector2.h" |
#include "vector2.h" |
||||||
/*
|
/*
|
||||||
vectors extend vector2s and hold 3D cartesian coordinates |
vector3s extend vector2s and hold 3D cartesian coordinates |
||||||
*/ |
*/ |
||||||
struct vector : public vector2 |
struct vector3 : public vector2 |
||||||
{ |
{ |
||||||
float z; |
float z; |
||||||
vector() |
vector3() |
||||||
{ |
{ |
||||||
this->x = 0.f; |
this->x = 0.f; |
||||||
this->y = 0.f; |
this->y = 0.f; |
||||||
this->z = 0.f; |
this->z = 0.f; |
||||||
} |
} |
||||||
vector(float x_, float y_, float z_) |
vector3(float x_, float y_, float z_) |
||||||
{ |
{ |
||||||
this->x = x_; |
this->x = x_; |
||||||
this->y = y_; |
this->y = y_; |
Loading…
Reference in new issue