From 915c18b874c0fd4fab5da60e416ecf405512a8f7 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 11 Nov 2022 19:41:28 +0000 Subject: Extract SDL_Application helper into libilt --- application/main.cpp | 31 +++---------------------------- 1 file changed, 3 insertions(+), 28 deletions(-) (limited to 'application/main.cpp') diff --git a/application/main.cpp b/application/main.cpp index a70fd35..224c4f7 100644 --- a/application/main.cpp +++ b/application/main.cpp @@ -1,4 +1,3 @@ -#include #include #include #include @@ -21,6 +20,7 @@ #include // IWYU pragma: keep #include #include +#include #include #include #include @@ -28,33 +28,8 @@ static const int DISPLAY_WIDTH = 1280; static const int DISPLAY_HEIGHT = 1024; -class SDL_Application : public GameState { +class MainApplication : public GameState, public ApplicationBase { public: - SDL_Application() - { - SDL_Init(SDL_INIT_EVERYTHING); - - SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); - SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); - SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); - SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8); - SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, 32); - SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); - SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); - - SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 5); - } - - ~SDL_Application() - { - SDL_Quit(); - } - - NO_COPY(SDL_Application); - NO_MOVE(SDL_Application); - using Windows = Collection; int run() @@ -135,5 +110,5 @@ private: int main(int, char **) { - return std::make_shared()->run(); + return std::make_shared()->run(); } -- cgit v1.2.3