aboutsummaryrefslogtreecommitdiffstats
path: root/tests/simplegame.cpp
blob: 7ca8db7751d1483f64b1832080857ad9642a6967 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <yage.cpp>

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();

        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();
    }
}