git.haldean.org ana / dcb144b
start project Haldean Brown 1 year, 9 months ago
3 changed file(s) with 47 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 re
1 build
2 *.o
3 *.d
0 cmake_minimum_required(VERSION 3.7 FATAL_ERROR)
1 cmake_policy(VERSION 3.7)
2 project(ana VERSION 0.1.0 LANGUAGES CXX)
3
4 find_package(glm REQUIRED)
5 find_package(SDL2 REQUIRED)
6 find_package(GLEW REQUIRED)
7
8 add_executable(ana src/ana.cpp)
9 target_link_libraries(ana glm SDL2 GLEW)
0 #include <iostream>
1
2 #include <GL/glew.h>
3 #include <SDL2/SDL.h>
4
5 int main() {
6 SDL_Init(SDL_INIT_VIDEO);
7 SDL_Window *w = SDL_CreateWindow(
8 "ana", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
9 640, 480, SDL_WINDOW_RESIZABLE | SDL_WINDOW_OPENGL);
10 SDL_GL_CreateContext(w);
11
12 GLenum glew_status = glewInit();
13 if (glew_status != GLEW_OK) {
14 std::cerr << "[E] glewInit: "
15 << glewGetErrorString(glew_status)
16 << std::endl;
17 return EXIT_FAILURE;
18 }
19
20 bool ok = true;
21 while (ok) {
22 SDL_Event ev;
23 while (SDL_PollEvent(&ev)) {
24 if (ev.type == SDL_QUIT) {
25 ok = false;
26 }
27 }
28 // render(w);
29 }
30
31 return EXIT_SUCCESS;
32 }