1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
#include "odfaeg/Graphics/sdlRenderWindow.hpp"
#include <SDL2/SDL.h>
using namespace odfaeg::core;
using namespace odfaeg::math;
using namespace odfaeg::physic;
using namespace odfaeg::graphic;
using namespace odfaeg::audio;
bool end = false;
void renderingThread(SDLRenderWindow* mainWindow)
{
while (!end)
{
mainWindow->clear();
// Up until now everything was drawn behind the scenes.
// This will show the new, red contents of the window.
mainWindow->display();
}
}
int main (int argv, char* argc[]) {
SDL_Init(SDL_INIT_VIDEO);
SDLRenderWindow rw(800, 600, "SDL window");
SDL_Event event;
std::thread theThread(&renderingThread, &rw);
while(!end) {
SDL_PollEvent(&event);
if (event.window.event == SDL_WINDOWEVENT_CLOSE)
end = true;
}
theThread.join();
SDL_Quit();
return 0;
} |
Partager