added glfw support
This commit is contained in:
parent
f941e90f08
commit
76c67ce5e3
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[submodule "deps/glfw"]
|
||||
path = deps/glfw
|
||||
url = https://github.com/glfw/glfw/
|
@ -1,7 +1,12 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
add_subdirectory("deps/glfw")
|
||||
project(Raycaster VERSION 0.1)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
add_executable(raycaster src/main.cpp)
|
||||
configure_file(src/RaycasterConfig.h.in RaycasterConfig.h)
|
||||
target_include_directories(raycaster PUBLIC "${PROJECT_BINARY_DIR}")
|
||||
target_include_directories(raycaster PUBLIC
|
||||
"${PROJECT_BINARY_DIR}"
|
||||
"deps/glfw/include"
|
||||
)
|
||||
target_link_libraries(raycaster glfw)
|
1
deps/glfw
vendored
Submodule
1
deps/glfw
vendored
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit b35641f4a3c62aa86a0b3c983d163bc0fe36026d
|
16
src/main.cpp
16
src/main.cpp
@ -1,7 +1,23 @@
|
||||
#include <iostream>
|
||||
#include "RaycasterConfig.h"
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
int main(int argc, char *argv[]){
|
||||
std::cout << Raycaster_VERSION_MAJOR << "." << Raycaster_VERSION_MINOR << std::endl;
|
||||
if(!glfwInit()){
|
||||
std::cout << "GLFW Init failed" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", NULL, NULL);
|
||||
if (!window){
|
||||
std::cout << "GLFW Window creation failed" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
glfwMakeContextCurrent(window);
|
||||
while(!glfwWindowShouldClose(window)){
|
||||
glfwPollEvents();
|
||||
glfwSwapBuffers(window);
|
||||
}
|
||||
glfwTerminate();
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user