fix elist3d

master
BuildTools 4 years ago
parent 004a7ac0f7
commit ef50f1afcf
  1. 6
      demo/demo.cpp
  2. 4
      main.cpp
  3. 6
      stuff/objects/entityList3D.h

@ -1,7 +1,7 @@
#include "demo.h" #include "demo.h"
void game::run(SDL_Renderer* renderer) void game::run(SDL_Renderer* renderer)
{ {/*
for (int i = 0; i < 360; i += 1) for (int i = 0; i < 360; i += 1)
{ {
float x = 1 * sinf(i); float x = 1 * sinf(i);
@ -11,7 +11,7 @@ void game::run(SDL_Renderer* renderer)
SDL_RenderDrawLine(renderer, ray2.start.x, ray2.start.y, ray2.end.x, ray2.end.y); SDL_RenderDrawLine(renderer, ray2.start.x, ray2.start.y, ray2.end.x, ray2.end.y);
} }
global::entList.at(0)->x = global::mousePos.x; global::entList.at(0)->x = global::mousePos.x;
global::entList.at(0)->y = global::mousePos.y; global::entList.at(0)->y = global::mousePos.y;*/
global::entList.run(renderer); //global::entList.run(renderer);
global::entList3D.run(renderer); global::entList3D.run(renderer);
} }

@ -18,8 +18,8 @@ int main(int argc, char** argv)
SETRENDER_WHITE; SETRENDER_WHITE;
SDL_Event eventHandler; SDL_Event eventHandler;
global::entList.push_back(&square(200, 200, 50)); //global::entList.push_back(&square(200, 200, 50));
//global::entList3D.push_back(&cube(200, 200, 200, 50)); global::entList3D.push_back(&cube(200, 200, 200, 50));
while (global::running) while (global::running)
{ {

@ -6,14 +6,14 @@
/* /*
entityList3D is the 3D entity container class entityList3D is the 3D entity container class
*/ */
class entityList3D : public std::vector<cube> class entityList3D : public std::vector<cube*>
{ {
public: public:
void run(SDL_Renderer* renderer) void run(SDL_Renderer* renderer)
{ {
for (cube entity : *this) for (cube* entity : *this)
{ {
entity.run(renderer); entity->run(renderer);
} }
} }
}; };
Loading…
Cancel
Save