mirror of https://github.com/kurisufriend/threedee
parent
41185cb000
commit
f85006c2ff
@ -1,4 +1,5 @@ |
||||
#include "globals.h" |
||||
|
||||
bool global::running = true; |
||||
vector2 global::mousePos; |
||||
vector2 global::mousePos; |
||||
entityList global::entList; |
@ -1,7 +1,9 @@ |
||||
#pragma once |
||||
#include "../objects/vector.h" |
||||
#include "../objects/entityList.h" |
||||
namespace global |
||||
{ |
||||
extern bool running; |
||||
extern vector2 mousePos; |
||||
extern entityList entList; |
||||
} |
@ -0,0 +1,17 @@ |
||||
#pragma once |
||||
#include <vector> |
||||
#include "SDL.h" |
||||
|
||||
#include "square.h" |
||||
|
||||
class entityList : public std::vector<square> |
||||
{ |
||||
public: |
||||
void run(SDL_Surface* surface) |
||||
{ |
||||
for (square entity : *this) |
||||
{ |
||||
entity.run(surface); |
||||
} |
||||
} |
||||
}; |
@ -0,0 +1,25 @@ |
||||
#pragma once |
||||
#include "SDL.h" |
||||
|
||||
struct square |
||||
{ |
||||
SDL_Rect rect; |
||||
square() |
||||
{ |
||||
rect.x = 0; |
||||
rect.y = 0; |
||||
rect.w = 0; |
||||
rect.h = 0; |
||||
} |
||||
square(int x_, int y_, int w_, int h_) |
||||
{ |
||||
rect.x = x_; |
||||
rect.y = y_; |
||||
rect.w = w_; |
||||
rect.h = h_; |
||||
} |
||||
void run(SDL_Surface* surface) |
||||
{ |
||||
SDL_FillRect(surface, &this->rect, SDL_MapRGB(surface->format, 0xFF, 0xFF, 0xFF)); |
||||
} |
||||
}; |
Loading…
Reference in new issue