make test program more interesting
This commit is contained in:
parent
eec776ba46
commit
441d4091cb
1 changed files with 20 additions and 13 deletions
33
src/main.cpp
33
src/main.cpp
|
@ -10,17 +10,19 @@ int main() {
|
|||
Raven::Layout main_layout {};
|
||||
Raven::Widget new_row { Raven::ControlWidgetType::NewRow };
|
||||
Raven::Window window {};
|
||||
Raven::Widget main_widget {};
|
||||
Raven::Button button {"click meeeeeeeeeeee"};
|
||||
Raven::Button impostor_button {"other button"};
|
||||
Raven::Label label {"click it!"};
|
||||
|
||||
int times_clicked = 0;
|
||||
Raven::Widget main_widget {};
|
||||
Raven::Button add_button {"add"};
|
||||
Raven::Button subtract_button {"subtract"};
|
||||
Raven::Label label {"0"};
|
||||
|
||||
int number = 0;
|
||||
|
||||
|
||||
window.spawn_window();
|
||||
|
||||
button.set_current_geometry(Raven::Box(0, 0, 100, 30));
|
||||
impostor_button.set_current_geometry(Raven::Box(0, 0, 100, 30));
|
||||
add_button.set_current_geometry(Raven::Box(0, 0, 100, 30));
|
||||
subtract_button.set_current_geometry(Raven::Box(0, 0, 100, 30));
|
||||
label.set_current_geometry(Raven::Box(0, 0, 100, 20));
|
||||
|
||||
main_layout.set_margin(6.0);
|
||||
|
@ -28,15 +30,20 @@ int main() {
|
|||
main_widget.set_layout(&main_layout);
|
||||
window.set_main_widget(&main_widget);
|
||||
|
||||
button.on_click = [&]() {
|
||||
times_clicked++;
|
||||
label.set_text(std::to_string(times_clicked));
|
||||
add_button.on_click = [&]() {
|
||||
number++;
|
||||
label.set_text(std::to_string(number));
|
||||
};
|
||||
|
||||
main_widget.add_child(&button);
|
||||
main_widget.add_child(&label);
|
||||
subtract_button.on_click = [&]() {
|
||||
number--;
|
||||
label.set_text(std::to_string(number));
|
||||
};
|
||||
|
||||
main_widget.add_child(&add_button);
|
||||
main_widget.add_child(&subtract_button);
|
||||
main_widget.add_child(&new_row);
|
||||
main_widget.add_child(&impostor_button);
|
||||
main_widget.add_child(&label);
|
||||
|
||||
|
||||
window.run(true);
|
||||
|
|
Loading…
Reference in a new issue