aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/facade/SDLApp.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-11-07 20:08:09 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-11-07 20:08:09 +0100
commit1c4156ee127b14760ed3b1a0cd16ad12180c7ac6 (patch)
tree211505d5328f24c9f9beabf8f874d9e13ef92130 /src/crepe/facade/SDLApp.cpp
parent9df087ede0b539ecbd2778236c7d1143362b384d (diff)
parent3d2428af8e8d9d49b4ade52d4806a7dae4cf1ab8 (diff)
merge `master` into `loek/savemgr`
Diffstat (limited to 'src/crepe/facade/SDLApp.cpp')
-rw-r--r--src/crepe/facade/SDLApp.cpp71
1 files changed, 0 insertions, 71 deletions
diff --git a/src/crepe/facade/SDLApp.cpp b/src/crepe/facade/SDLApp.cpp
deleted file mode 100644
index c6ddeaa..0000000
--- a/src/crepe/facade/SDLApp.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-#include <iostream>
-
-#include "SDLApp.h"
-
-SDLApp::SDLApp(int window_width, int window_height)
- : window_width(window_width), window_height(window_height), window(nullptr),
- renderer(nullptr) {}
-
-// FIXME: why is there clean_up and ~SDLApp?
-SDLApp::~SDLApp() { clean_up(); }
-
-bool SDLApp::initialize() {
- if (SDL_Init(SDL_INIT_VIDEO) != 0) {
- // FIXME: throw exception
- std::cerr << "SDL Initialization Error: " << SDL_GetError()
- << std::endl;
- return false;
- }
-
- window = SDL_CreateWindow("Particle System", SDL_WINDOWPOS_CENTERED,
- SDL_WINDOWPOS_CENTERED, window_width,
- window_height, SDL_WINDOW_SHOWN);
- if (!window) {
- // FIXME: throw exception
- std::cerr << "Window Creation Error: " << SDL_GetError() << std::endl;
- return false;
- }
-
- renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
- if (!renderer) {
- // FIXME: throw exception
- std::cerr << "Renderer Creation Error: " << SDL_GetError() << std::endl;
- return false;
- }
-
- return true;
-}
-
-void SDLApp::handle_events(bool & running) {
- SDL_Event event;
- while (SDL_PollEvent(&event)) {
- if (event.type == SDL_QUIT) {
- running = false;
- }
- }
-}
-
-void SDLApp::clear_screen() {
- SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
- SDL_RenderClear(renderer);
-}
-
-void SDLApp::present_screen() { SDL_RenderPresent(renderer); }
-
-void SDLApp::draw_square(int x, int y, int size) {
- SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);
- SDL_Rect rect = {x, y, size, size};
- SDL_RenderFillRect(renderer, &rect);
-}
-
-SDL_Texture * square_texture = nullptr; // Load this with an image or create it
-
-void SDLApp::clean_up() {
- if (renderer) {
- SDL_DestroyRenderer(renderer);
- }
- if (window) {
- SDL_DestroyWindow(window);
- }
- SDL_Quit();
-}