From 0fc9eb828c0236d759698186dcbdefb2370e61b7 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Mon, 14 Oct 2024 17:49:20 +0200 Subject: upgrade SDL2 -> SDL3 --- View.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'View.cpp') diff --git a/View.cpp b/View.cpp index c269643..fd80b79 100644 --- a/View.cpp +++ b/View.cpp @@ -1,4 +1,4 @@ -#include +#include #include #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(r.x), - .y = static_cast(r.y), - .w = static_cast(r.width), - .h = static_cast(r.height), + SDL_FRect rect = { + .x = static_cast(r.x), + .y = static_cast(r.y), + .w = static_cast(r.width), + .h = static_cast(r.height), }; SDL_RenderFillRect(this->renderer, &rect); } -- cgit v1.2.3