aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2017-11-12 22:30:20 +0000
committerYann Herklotz <ymherklotz@gmail.com>2017-11-12 22:30:20 +0000
commite68759a4101567a27e306eae0a907baa759ae80c (patch)
treec90733351cb7a8a02f91725118593c1c4f19c563 /tests
parent5fb7c972d44a3ce0a067101885d2e0c1966e7c89 (diff)
downloadYAGE-e68759a4101567a27e306eae0a907baa759ae80c.tar.gz
YAGE-e68759a4101567a27e306eae0a907baa759ae80c.zip
Designing simple preview game
Diffstat (limited to 'tests')
-rw-r--r--tests/logtest.cpp15
-rw-r--r--tests/resources/dngn_blood_fountain.pngbin0 -> 955 bytes
-rw-r--r--tests/simplegame.cpp14
-rw-r--r--tests/threadtest.cpp23
4 files changed, 46 insertions, 6 deletions
diff --git a/tests/logtest.cpp b/tests/logtest.cpp
index 9cd5288a..359311ec 100644
--- a/tests/logtest.cpp
+++ b/tests/logtest.cpp
@@ -1,3 +1,11 @@
+/* ----------------------------------------------------------------------------
+ * logtest.cpp
+ *
+ * Copyright (c) 2017 Yann Herklotz Grave <ymherklotz@gmail.com> -- MIT License
+ * See file LICENSE for more details
+ * ----------------------------------------------------------------------------
+ */
+
#include <yage.h>
#include <iostream>
@@ -5,10 +13,7 @@
int main()
{
gLog << "Hello World";
- yage::Logger l;
- l() << "Hello my name is Yann";
- std::cout << "#####################\n";
- gLog << "Yanananan";
- gLog << "Remove the top element";
+ gLog << "This is Yann";
+ std::cout << "Hello\n";
}
diff --git a/tests/resources/dngn_blood_fountain.png b/tests/resources/dngn_blood_fountain.png
new file mode 100644
index 00000000..7214fd47
--- /dev/null
+++ b/tests/resources/dngn_blood_fountain.png
Binary files differ
diff --git a/tests/simplegame.cpp b/tests/simplegame.cpp
index 0692574a..7ca8db77 100644
--- a/tests/simplegame.cpp
+++ b/tests/simplegame.cpp
@@ -5,14 +5,26 @@ using namespace yage;
int main()
{
Window window;
+ SpriteBatch sp;
+ GlslProgram program;
window.create("Simple Game", 800, 640);
+ sp.init();
+
+ program.compileShaders("/home/yannherklotz/Github/YAGE/tests/resources/simplegame.vert", "/home/yannherklotz/Github/YAGE/tests/resources/simplegame.vert");
+ program.addAttribute("vertex_position");
+ program.addAttribute("vertex_color");
+ program.addAttribute("vertex_uv");
+ program.linkShaders();
+
+ Texture fountain = ResourceManager::getTexture("/home/yannherklotz/Github/YAGE/tests/resources/dngn_blood_fountain.png");
while(!window.shouldClose()) {
window.clearBuffer();
- SpriteBatch sp;
sp.begin();
+ sp.draw(std::vector<float>({0, 0, 50, 50}), std::vector<float>({0, 0, 1, 1}), fountain.id, Color(), 0);
+ sp.render();
window.pollEvents();
window.swapBuffer();
diff --git a/tests/threadtest.cpp b/tests/threadtest.cpp
new file mode 100644
index 00000000..dd1877e5
--- /dev/null
+++ b/tests/threadtest.cpp
@@ -0,0 +1,23 @@
+#include <yage.h>
+
+#include <iostream>
+#include <thread>
+
+int main()
+{
+ int n = 5;
+
+ std::cout << "n before: " << n << "\n";
+
+ auto f = [&] () {
+ n = 8;
+ };
+
+ std::thread t1(f);
+
+ std::cout << "n after: " << n << "\n";
+
+ t1.join();
+
+ std::cout << "n after thread: " << n << "\n";
+}