Last active
August 29, 2015 13:57
-
-
Save taesiri/9543436 to your computer and use it in GitHub Desktop.
SDL2 Basic OpenGL Window
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Compile Command | |
# Mac Os X | |
g++ source.cpp -L/usr/local/lib -lSDL2 | |
^ | |
Link to Library Directory | |
# SDL2 Installation using brew | |
brew install sdl2 | |
brew link sdl2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SDL2/SDL.h> | |
#include <stdio.h> | |
int main(int argc, char* argv[]) { | |
SDL_Window *window; | |
SDL_Init(SDL_INIT_VIDEO); | |
window = SDL_CreateWindow("SDL Window", | |
SDL_WINDOWPOS_UNDEFINED, | |
SDL_WINDOWPOS_UNDEFINED, | |
640, 480, | |
SDL_WINDOW_OPENGL); | |
if(window == NULL) { | |
printf("Could not initialize Window %s/n", SDL_GetError()); | |
return 1; | |
} | |
SDL_Delay(3000); | |
SDL_DestroyWindow(window); | |
SDL_Quit(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment