aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt4
-rw-r--r--View.cpp20
2 files changed, 11 insertions, 13 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 681aae6..7aa3fd5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,7 +5,7 @@ set(CMAKE_CXX_STANDARD 20)
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
set(CMAKE_BUILD_TYPE Debug)
-find_package(SDL2 REQUIRED)
+find_package(SDL3 REQUIRED)
find_package(cpr REQUIRED)
find_package(pugixml REQUIRED)
# add_subdirectory(lib/SDL)
@@ -45,7 +45,7 @@ add_executable(main
)
target_link_libraries(main
- SDL2
+ SDL3
cpr
pugixml
)
diff --git a/View.cpp b/View.cpp
index c269643..fd80b79 100644
--- a/View.cpp
+++ b/View.cpp
@@ -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);
}