remove old sdl_deleter from Controller

This commit is contained in:
scawful
2024-08-09 19:17:44 -04:00
parent 579a7a9607
commit 0ea1c13cea
2 changed files with 5 additions and 22 deletions

View File

@@ -330,7 +330,7 @@ void Controller::OnInput() {
case SDL_WINDOWEVENT:
switch (event.window.event) {
case SDL_WINDOWEVENT_CLOSE:
CloseWindow();
active_ = false;
break;
case SDL_WINDOWEVENT_SIZE_CHANGED:
ChangeWindowSizeEvent(event);
@@ -404,14 +404,14 @@ absl::Status Controller::CreateSDL_Window() {
int screenWidth = displayMode.w * 0.8;
int screenHeight = displayMode.h * 0.8;
window_ = std::unique_ptr<SDL_Window, sdl_deleter>(
window_ = std::unique_ptr<SDL_Window, core::SDL_Deleter>(
SDL_CreateWindow("Yet Another Zelda3 Editor", // window title
SDL_WINDOWPOS_UNDEFINED, // initial x position
SDL_WINDOWPOS_UNDEFINED, // initial y position
screenWidth, // width, in pixels
screenHeight, // height, in pixels
SDL_WINDOW_RESIZABLE),
sdl_deleter());
core::SDL_Deleter());
if (window_ == nullptr) {
return absl::InternalError(
absl::StrFormat("SDL_CreateWindow: %s\n", SDL_GetError()));

View File

@@ -3,14 +3,13 @@
#include <SDL.h>
#include <memory>
#include "imgui/backends/imgui_impl_sdl2.h"
#include "imgui/backends/imgui_impl_sdlrenderer2.h"
#include "imgui/imconfig.h"
#include "imgui/imgui.h"
#include "imgui/imgui_internal.h"
#include <memory>
#include "absl/status/status.h"
#include "app/core/common.h"
#include "app/core/platform/renderer.h"
@@ -56,22 +55,6 @@ class Controller : public ExperimentFlags {
auto window() -> SDL_Window * { return window_.get(); }
private:
struct sdl_deleter {
void operator()(SDL_Window *p) const {
if (p) {
SDL_DestroyWindow(p);
}
}
void operator()(SDL_Renderer *p) const {
if (p) {
SDL_DestroyRenderer(p);
}
}
void operator()(SDL_Texture *p) const { SDL_DestroyTexture(p); }
};
void CloseWindow() { active_ = false; }
friend int ::main(int argc, char **argv);
bool active_;