pre opengl

This commit is contained in:
MichaelFisher1997 2025-01-05 02:27:36 +00:00
parent 71968a3b42
commit 18298f046a

View File

@ -7,13 +7,13 @@ SdlWindow::SdlWindow(const char* title, int width, int height)
m_isRunning(false), m_isRunning(false),
m_isFullscreen(false), m_isFullscreen(false),
m_width(width), m_width(width),
m_height(height) m_height(height),
m_glContect(nullptr)
{ {
// 1. Initialize SDL // 1. Set attributes
if (SDL_Init(SDL_INIT_VIDEO) < 0) { SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
std::cerr << "Failed to init SDL2: " << SDL_GetError() << std::endl; SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
return; SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
}
// 2. Create the window // 2. Create the window
m_window = SDL_CreateWindow( m_window = SDL_CreateWindow(
@ -22,7 +22,7 @@ SdlWindow::SdlWindow(const char* title, int width, int height)
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
width, width,
height, height,
SDL_WINDOW_SHOWN SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE
); );
if (!m_window) { if (!m_window) {
std::cerr << "Failed to create window: " << SDL_GetError() << std::endl; std::cerr << "Failed to create window: " << SDL_GetError() << std::endl;