summaryrefslogtreecommitdiff
path: root/src/states/titleState.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/states/titleState.cpp')
-rw-r--r--src/states/titleState.cpp35
1 files changed, 28 insertions, 7 deletions
diff --git a/src/states/titleState.cpp b/src/states/titleState.cpp
index a0d17c8..d96c840 100644
--- a/src/states/titleState.cpp
+++ b/src/states/titleState.cpp
@@ -1,8 +1,12 @@
#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)
{
}
@@ -12,14 +16,31 @@ void TitleState::update(sf::Time dt){
}
void TitleState::render(){
- sf::RectangleShape rectangle;
- rectangle.setSize(sf::Vector2f(100, 50));
- rectangle.setOutlineColor(sf::Color::Red);
- rectangle.setOutlineThickness(5);
- rectangle.setPosition(10, 20);
- context_.window->draw(rectangle);
+ 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);
}