diff options
Diffstat (limited to 'View.cpp')
-rw-r--r-- | View.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
@@ -1,4 +1,4 @@ -#include <SDL2/SDL.h> +#include <SDL3/SDL.h> #include <thread> #include "View.h" @@ -22,7 +22,7 @@ void View::work() { while (this->open) { for (SDL_Event e; SDL_PollEvent(&e);) { - if (e.type == SDL_QUIT) { + if (e.type == SDL_EVENT_QUIT) { this->open = false; return; } @@ -40,13 +40,11 @@ void View::window_init() { SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS); this->window = SDL_CreateWindow( "dpa", - SDL_WINDOWPOS_UNDEFINED, - SDL_WINDOWPOS_UNDEFINED, this->width, this->height, - SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL + SDL_WINDOW_OPENGL ); - this->renderer = SDL_CreateRenderer(this->window, -1, SDL_RENDERER_ACCELERATED); + this->renderer = SDL_CreateRenderer(this->window, NULL); } void View::window_deinit() { @@ -81,11 +79,11 @@ void View::draw_end() { void View::draw_rect(Rectangle r, Color c) { SDL_SetRenderDrawColor(this->renderer, c.red, c.green, c.blue, 255); - SDL_Rect rect = { - .x = static_cast<int>(r.x), - .y = static_cast<int>(r.y), - .w = static_cast<int>(r.width), - .h = static_cast<int>(r.height), + SDL_FRect rect = { + .x = static_cast<float>(r.x), + .y = static_cast<float>(r.y), + .w = static_cast<float>(r.width), + .h = static_cast<float>(r.height), }; SDL_RenderFillRect(this->renderer, &rect); } |