summaryrefslogtreecommitdiff
path: root/src/states/titleState.cpp
blob: d96c8401796f5cba2121571b6d5202ae7d6e2ee6 (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
#include "titleState.h"
#include <SFML/Graphics.hpp>

#include <string>

TitleState::TitleState(StateStack &stack, State::Context context)
    : State(stack, context)
    // TODO: Initialize UI properly to zeros
    //, ui(0,0,false,false,0,0)
{

}

void TitleState::update(sf::Time dt){

}

void TitleState::render(){
    static bool radioState = false;

    ui.initImUI();

    if (ui.button(context_.window, 17, "Button 1", sf::Vector2i(0,0), sf::Vector2i(200,100)) ){
        printf("Button 1 pressed!!\n");
    }
    if (ui.button(context_.window, 18, "Button 2", sf::Vector2i(0,200), sf::Vector2i(200,100)) ){
        printf("Button 2 pressed!!\n");
    }
    if (ui.button(context_.window, 19, "Button 3", sf::Vector2i(0,400), sf::Vector2i(200,100)) ){
        printf("Button 3 pressed!!\n");
    }


    radioState = ui.radioButton(context_.window, 21, "Radio", radioState,
            sf::Vector2i(0,800), sf::Vector2i(200,100));

    if (radioState){
        ui.button(context_.window, 20, "Hidden button", sf::Vector2i(0,600), sf::Vector2i(200,100));
    }

    ui.finishImUI();
}

void TitleState::handleEvent(const sf::Event &event){
    ui.handleEvent(event);
}