aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2017-12-25 12:27:32 +0000
committerYann Herklotz <ymherklotz@gmail.com>2017-12-25 12:27:32 +0000
commit022a4bdd81332ce67d799be6a06afb42ae45ac2e (patch)
tree52aab4ac82cd99d49a94eff8734ec904e0adde54
parent16915d86d4b866c1fcce7523b0d34e8343ff52fc (diff)
downloadYAGE-022a4bdd81332ce67d799be6a06afb42ae45ac2e.tar.gz
YAGE-022a4bdd81332ce67d799be6a06afb42ae45ac2e.zip
[Build] Added examples and improved build for them.
-rw-r--r--examples/CMakeLists.txt12
-rw-r--r--examples/shooter/main.cpp22
-rw-r--r--yage/core/glslprogram.cpp2
3 files changed, 33 insertions, 3 deletions
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 16b20795..a75f6528 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,2 +1,10 @@
-add_executable(simplegame simplegame/main.cpp)
-target_link_libraries(simplegame yage)
+function(make_example name)
+
+ file(GLOB SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${name}/*.cpp)
+ add_executable(${name} ${SOURCES})
+ target_link_libraries(${name} yage)
+
+endfunction(make_test)
+
+make_example(simplegame)
+make_example(shooter)
diff --git a/examples/shooter/main.cpp b/examples/shooter/main.cpp
new file mode 100644
index 00000000..d28af83e
--- /dev/null
+++ b/examples/shooter/main.cpp
@@ -0,0 +1,22 @@
+#include <yage/yage.h>
+
+#include <iostream>
+
+using std::cout;
+
+int main(int argc, char** argv)
+{
+ cout << "Starting Shooter example...\n";
+
+ yage::Window window;
+ window.create("Shooter example", 1920, 1080);
+
+ while(!window.shouldClose()) {
+ window.pollEvents();
+ window.clearBuffer();
+
+
+
+ window.swapBuffer();
+ }
+}
diff --git a/yage/core/glslprogram.cpp b/yage/core/glslprogram.cpp
index c47de808..13abbba3 100644
--- a/yage/core/glslprogram.cpp
+++ b/yage/core/glslprogram.cpp
@@ -142,7 +142,7 @@ void GlslProgram::linkShaders()
std::string error_log_str((const char *)&error_log[0]);
- throw std::runtime_error("Could not link program : " + error_log_str);
+ throw std::runtime_error("Could not link program: " + error_log_str);
}
// detach shaders after successful link