aboutsummaryrefslogtreecommitdiff
path: root/examples/particle_system/main.cpp
blob: 1477a20177cca74a23cd2dfbb70abd171af4803f (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include "jin.h"

using namespace JinEngine::AI;
using namespace JinEngine::Game;
using namespace JinEngine::Input;
using namespace JinEngine::Graphics;
using namespace JinEngine::Graphics::Particles;

ParticleSystem* p;

void onLoad()
{
    StateMachine sm;
    sm.addState("Run");
    sm.addState("Idle");
    sm.addState("Sleep");
    sm.addState("Jump");
    sm.addParameteri("run");
    sm.addParameteri("idle");
    sm.addTransitioni("Empty", "Idle", "run", 1);
    sm.addTransitioni("Run", "Idle", "run", 1);
}

void onEvent(Event* e)
{
    static Application* Application = Application::get();
    if (e->type == EventType::QUIT)
        Application->stop();
}

void onUpdate(int ms)
{
}

void onDraw()
{
    
}

int main(int argc, char* argv[])
{
    Application* Application = Application::get();
    Application::Setting setting;
    setting.loader = onLoad;
    setting.eventHandler = onEvent;
    setting.updater = onUpdate;
    setting.drawer = onDraw;
    Application->init(&setting);

    Window* wnd = Window::get();
    Window::Setting wndSetting;
    wndSetting.width = 600;
    wndSetting.height = 512;
    wndSetting.title = "Jin v0.1.1";
    wndSetting.fps = 60;
    wndSetting.vsync = false;
    wndSetting.fullscreen = false;
    wndSetting.resizable = false;
    wnd->init(&wndSetting);

    Application->run();

    Application->quit();
    wnd->quit();

    return 0;
}