SDLU/SDLU_Example/main.cpp

34 lines
673 B
C++
Raw Normal View History

2020-05-16 10:34:20 +00:00
#include "header.hpp"
int main(int argc, char** argv)
{
2020-05-16 18:49:04 +00:00
SDL_Init(SDL_INIT_VIDEO);
2020-05-16 18:09:21 +00:00
MyWindow window(800, 800, "Test");
SDL_SetWindowTitle(window.GetWindow(), "New Title");
2020-05-16 22:16:56 +00:00
window.SetMouseCursorGrabbed(true);
2020-05-16 18:09:21 +00:00
SDL_Event event;
2020-05-17 10:25:09 +00:00
float t = 0.f;
2020-05-16 21:36:21 +00:00
while (window.IsOpen())
{
2020-05-16 21:36:21 +00:00
while (window.PollEvent(&event))
2020-05-16 18:49:04 +00:00
{
2020-05-16 21:36:21 +00:00
switch (event.window.event)
{
case SDL_WINDOWEVENT_CLOSE:
window.Close();
break;
}
2020-05-16 18:49:04 +00:00
}
2020-05-16 21:36:21 +00:00
2020-05-17 10:25:09 +00:00
window.Clear(sdlu::Color::FromHSV(floor(t), 100, 100));
2020-05-16 21:36:21 +00:00
window.Display();
2020-05-17 10:25:09 +00:00
t += 0.01;
}
2020-05-16 18:09:21 +00:00
2020-05-16 18:49:04 +00:00
SDL_Quit();
2020-05-16 10:34:20 +00:00
return 0;
}