89 lines
No EOL
3.2 KiB
C++
Executable file
89 lines
No EOL
3.2 KiB
C++
Executable file
// This is only an Engine Testing Scene
|
|
// Please don't use this for your Game
|
|
|
|
#include "headers/scene_default.hpp"
|
|
|
|
namespace asloengine
|
|
{
|
|
|
|
SceneDefault::SceneDefault()
|
|
: Scene("SceneDefault") {}
|
|
|
|
void SceneDefault::on_load()
|
|
{
|
|
|
|
Layer base_layer;
|
|
Layer gui_layer;
|
|
|
|
button_texture = sf::Texture();
|
|
button_texture.loadFromFile("asloengine/builtin/assets/textures/texture_default_button.png");
|
|
|
|
button_font = sf::Font();
|
|
button_font.loadFromFile("asloengine/builtin/assets/fonts/nasalization_regular.ttf");
|
|
|
|
Button *btn1 = new Button("Login Button", "Login", button_font, button_texture);
|
|
//btn1->set_position(100, 50);
|
|
|
|
TextOnlyButton *tbtn1 = new TextOnlyButton("Exit Button", "Exit Game", button_font);
|
|
//tbtn1->set_position(100, 125);
|
|
|
|
TextObject *to1 = new TextObject("Info Text", "Aslo Engine Test", button_font);
|
|
//to1->set_position(630, 0);
|
|
//to1->set_origin(1, 0);
|
|
btn1->signal_on_clicked.connect_member(to1, &TextObject::set_text, sf::String("lulz"));
|
|
|
|
FramerateCounter *fctr1 = new FramerateCounter("fctr1", 5);
|
|
fctr1->signal_on_counter_updated.connect_member(to1, &TextObject::set_text);
|
|
fctr1->postfix = " FPS";
|
|
|
|
TextOnlyInputField *toif = new TextOnlyInputField("toif1", sf::Vector2f(100, 30), button_font, 30, 10, "input");
|
|
toif->set_position(200, 300);
|
|
|
|
InputField *if1 = new InputField("if_1", sf::Vector2f(200, 30), button_font, button_texture, 30, 20);
|
|
if1->set_position(100, 420);
|
|
if1->signal_on_focus.connect_member(to1, &TextObject::set_text, sf::String("gained focus"));
|
|
if1->signal_on_lost_focus.connect_member(to1, &TextObject::set_text, sf::String("lost focus"));
|
|
//if1->signal_on_text_changed.connect_member(this, &SceneDefault::on_test);
|
|
|
|
ScrollView *sc1 = new ScrollView("scroll1", sf::Vector2f(160, 160), 200);
|
|
sc1->set_position(640, 480);
|
|
sc1->set_origin(1, 1);
|
|
|
|
InputField *if2 = new InputField("if_2", sf::Vector2f(200, 30), button_font, button_texture, 30, 20);
|
|
//if2->set_position(20, 20);
|
|
if2->signal_on_focus.connect_member(to1, &TextObject::set_text, sf::String("gained focus"));
|
|
if2->signal_on_lost_focus.connect_member(to1, &TextObject::set_text, sf::String("lost focus"));
|
|
|
|
/*sc1->objects.emplace_back(if2);
|
|
|
|
base_layer.emplace_back(fctr1);
|
|
base_layer.emplace_back(btn1);
|
|
base_layer.emplace_back(tbtn1);
|
|
base_layer.emplace_back(to1);
|
|
base_layer.emplace_back(if1);
|
|
gui_layer.emplace_back(toif);
|
|
gui_layer.emplace_back(sc1);*/
|
|
|
|
GridContainer *container = new GridContainer("cont1", sf::Vector2u(2, 2), sf::Vector2f(300, 150));
|
|
container->set_position(30, 200);
|
|
container->add_object(to1);
|
|
container->add_object(if2);
|
|
container->add_object(btn1);
|
|
container->add_object(tbtn1);
|
|
|
|
|
|
base_layer.emplace_back(container);
|
|
|
|
layers.emplace_back(base_layer);
|
|
fixed_layers.emplace_back(gui_layer);
|
|
|
|
}
|
|
|
|
void SceneDefault::on_update(float delta_time)
|
|
{
|
|
|
|
//move_camera(sf::Vector2f(1, 2));
|
|
|
|
}
|
|
|
|
} |