summaryrefslogtreecommitdiff
path: root/src/states/titleState.cpp
blob: fe78d456c455322cd5cdb042d3f593e3a596b0b5 (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
#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)
{
    context.textures->load(Textures::Id::Base_Font, "assets/img/Font/Font.png");
    auto &fontTexture = context.textures->get(Textures::Id::Base_Font);
    Graphics::TextureFont::Descr fontDescr {"abcdefghijklmnopqrstuvwxyz1234567890!?.,$ ", 6,7};
    auto font = new Graphics::TextureFont(fontTexture, fontDescr);
    context.textureFonts->manage(Fonts::Id::Base_Font, font);
}

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

}

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

    ui.initImUI();

    Graphics::TextureFont &font = context_.textureFonts->get(Fonts::Id::Base_Font);

    radioState = ui.radioButton(context_.window,
            font, 21,
            "this is\nthe whole thing or maybe is just another bullshit code it doesn't work",
            radioState,
            sf::Vector2i(0,100), sf::Vector2i(200,50));

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

    ui.finishImUI();
}

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