simulation/main.cpp

39 lines
637 B
C++
Raw Permalink Normal View History

2022-10-30 23:44:30 +01:00
#include "Window.h"
#include "Entity.h"
2022-11-02 07:44:57 +01:00
#include <SDL2/SDL_render.h>
2022-10-30 23:44:30 +01:00
#include <functional>
#include <SDL2/SDL.h>
2022-11-02 07:44:57 +01:00
Entity* ent;
bool my_setup(Window* win){
ent = new Entity({10,10}, {5,0}, {0,2});
return true;
}
2022-10-30 23:44:30 +01:00
bool my_Draw(Window* win){
2022-11-02 07:44:57 +01:00
2022-10-30 23:44:30 +01:00
SDL_Renderer* ren = win->GetRenderer();
2022-11-02 07:44:57 +01:00
/* if(win->step){ */
ent->Update();
win->step = false;
/* } */
Vec2 ent_pos = ent->GetPos();
2022-10-30 23:44:30 +01:00
SDL_SetRenderDrawColor(ren, 0xff, 0x00, 0x00, 0x00);
2022-11-02 07:44:57 +01:00
win->DrawCircle(ren, ent_pos.x, ent_pos.y, 5, true);
2022-10-30 23:44:30 +01:00
return true;
}
int main(int argc, char *argv[])
{
2022-11-02 07:44:57 +01:00
Window win("test", 100, 100);
win.Draw(my_setup, my_Draw);
2022-10-30 23:44:30 +01:00
2022-11-02 07:44:57 +01:00
delete ent;
2022-10-30 23:44:30 +01:00
return 0;
}