Added qmake project files
This commit is contained in:
10
FluckyGameOpenGL.pro
Normal file
10
FluckyGameOpenGL.pro
Normal file
@@ -0,0 +1,10 @@
|
||||
TARGET = FluckyGameOpenGL
|
||||
TEMPLATE = app
|
||||
CONFIG -= qt
|
||||
DEFINES -= UNICODE QT_LARGEFILE_SUPPORT
|
||||
|
||||
HEADERS +=
|
||||
|
||||
SOURCES += main.cpp
|
||||
|
||||
LIBS += -lstdc++ -lGL -lGLEW -lSDL2
|
47
main.cpp
Normal file
47
main.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include <GL/glew.h>
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
const int width = 800;
|
||||
const int height = 600;
|
||||
const std::string title = "Flucky Game";
|
||||
|
||||
int main()
|
||||
{
|
||||
SDL_Init(SDL_INIT_EVERYTHING);
|
||||
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
||||
|
||||
SDL_Window *window = SDL_CreateWindow(title.c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, width, height, SDL_WINDOW_OPENGL);
|
||||
SDL_GLContext glContext = SDL_GL_CreateContext(window);
|
||||
|
||||
GLenum status = glewInit();
|
||||
if(status != GLEW_OK)
|
||||
{
|
||||
std::cerr << "Glew has some sort of problem!" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
while(true)
|
||||
{
|
||||
glClearColor(.5f, .5f, 1.f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
SDL_GL_SwapWindow(window);
|
||||
|
||||
SDL_Event e;
|
||||
if(SDL_PollEvent(&e))
|
||||
{
|
||||
if(e.type == SDL_QUIT)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SDL_GL_DeleteContext(glContext);
|
||||
SDL_DestroyWindow(window);
|
||||
SDL_Quit();
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user