44 lines
1000 B
C++
44 lines
1000 B
C++
#include <SDL3/SDL.h>
|
|
#include <GL/gl.h>
|
|
|
|
int main() {
|
|
SDL_Init(SDL_INIT_VIDEO);
|
|
|
|
// SETUP 8-bit colors
|
|
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_DOUBLEBUFFER, 1);
|
|
|
|
SDL_Window* window = SDL_CreateWindow(
|
|
"Cinecraft",
|
|
800, 600,
|
|
SDL_WINDOW_OPENGL
|
|
);
|
|
|
|
SDL_GLContext context = SDL_GL_CreateContext(window);
|
|
|
|
bool running = true;
|
|
SDL_Event e;
|
|
|
|
while (running) {
|
|
while (SDL_PollEvent(&e)) {
|
|
if (e.type == SDL_EVENT_QUIT) {
|
|
running = false;
|
|
}
|
|
}
|
|
|
|
glClearColor(0.1f, 0.2f, 0.3f, 1.0f);
|
|
glClear(GL_COLOR_BUFFER_BIT);
|
|
|
|
SDL_GL_SwapWindow(window);
|
|
}
|
|
|
|
SDL_GL_DestroyContext(context);
|
|
SDL_DestroyWindow(window);
|
|
SDL_Quit();
|
|
|
|
return 0;
|
|
} |