|
@@ -654,7 +654,7 @@ static void test12(GuiManager* mgr, Node* font) {
|
|
|
GuiLabel* l3 = GuiLabel::make_simple_text_label("down", font);
|
|
GuiLabel* l3 = GuiLabel::make_simple_text_label("down", font);
|
|
|
GuiLabel* l4 = GuiLabel::make_simple_text_label("downr", font);
|
|
GuiLabel* l4 = GuiLabel::make_simple_text_label("downr", font);
|
|
|
GuiLabel* l5 = GuiLabel::make_simple_text_label("none", font);
|
|
GuiLabel* l5 = GuiLabel::make_simple_text_label("none", font);
|
|
|
- GuiButton* b1 = new GuiButton("test3", l1, l2, l3, l4, l5);
|
|
|
|
|
|
|
+ GuiButton* b1 = new GuiButton("test12", l1, l2, l3, l4, l5);
|
|
|
b1->set_scale(0.1);
|
|
b1->set_scale(0.1);
|
|
|
b1->set_pos(LVector3f::rfu(-0.25, 0., 0.25));
|
|
b1->set_pos(LVector3f::rfu(-0.25, 0., 0.25));
|
|
|
l2->set_foreground_color(1., 1., 0., 1.);
|
|
l2->set_foreground_color(1., 1., 0., 1.);
|
|
@@ -669,6 +669,61 @@ static void test12(GuiManager* mgr, Node* font) {
|
|
|
b1->start_behavior();
|
|
b1->start_behavior();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+static void test13(GuiManager* mgr, Node* font) {
|
|
|
|
|
+ GuiLabel* ul = GuiLabel::make_simple_text_label("upup", font);
|
|
|
|
|
+ GuiSign* us = new GuiSign("up_arrow", ul);
|
|
|
|
|
+ us->set_scale(0.1);
|
|
|
|
|
+ GuiLabel* dl = GuiLabel::make_simple_text_label("dndn", font);
|
|
|
|
|
+ GuiSign* ds = new GuiSign("down_arrow", dl);
|
|
|
|
|
+ dl->set_scale(0.1);
|
|
|
|
|
+ lb1 = new GuiListBox("list_box", 4, us, ds);
|
|
|
|
|
+ GuiLabel* l1 = GuiLabel::make_simple_text_label("hyena", font);
|
|
|
|
|
+ GuiSign* s1 = new GuiSign("hyena", l1);
|
|
|
|
|
+ s1->set_scale(0.1);
|
|
|
|
|
+ GuiLabel* l2 = GuiLabel::make_simple_text_label("dingo", font);
|
|
|
|
|
+ GuiSign* s2 = new GuiSign("dingo", l2);
|
|
|
|
|
+ s2->set_scale(0.1);
|
|
|
|
|
+ GuiLabel* l3 = GuiLabel::make_simple_text_label("jackal", font);
|
|
|
|
|
+ GuiSign* s3 = new GuiSign("jackal", l3);
|
|
|
|
|
+ s3->set_scale(0.1);
|
|
|
|
|
+ GuiLabel* l4 = GuiLabel::make_simple_text_label("wolf", font);
|
|
|
|
|
+ GuiSign* s4 = new GuiSign("wolf", l4);
|
|
|
|
|
+ s4->set_scale(0.1);
|
|
|
|
|
+ GuiLabel* l5 = GuiLabel::make_simple_text_label("fox", font);
|
|
|
|
|
+ GuiSign* s5 = new GuiSign("fox", l5);
|
|
|
|
|
+ s5->set_scale(0.1);
|
|
|
|
|
+ float w, w1, w2;
|
|
|
|
|
+ w1 = l1->get_width();
|
|
|
|
|
+ w2 = l2->get_width();
|
|
|
|
|
+ w = (w1>w2)?w1:w2;
|
|
|
|
|
+ w2 = l3->get_width();
|
|
|
|
|
+ w = (w>w2)?w:w2;
|
|
|
|
|
+ w2 = l4->get_width();
|
|
|
|
|
+ w = (w>w2)?w:w2;
|
|
|
|
|
+ w2 = l5->get_width();
|
|
|
|
|
+ w = (w>w2)?w:w2;
|
|
|
|
|
+ l1->set_width(w);
|
|
|
|
|
+ l2->set_width(w);
|
|
|
|
|
+ l3->set_width(w);
|
|
|
|
|
+ l4->set_width(w);
|
|
|
|
|
+ l5->set_width(w);
|
|
|
|
|
+ ul->set_background_color(0., 0., 0., 1.);
|
|
|
|
|
+ dl->set_background_color(0., 0., 0., 1.);
|
|
|
|
|
+ l1->set_background_color(0., 0., 0., 1.);
|
|
|
|
|
+ l2->set_background_color(0., 0., 0., 1.);
|
|
|
|
|
+ l3->set_background_color(0., 0., 0., 1.);
|
|
|
|
|
+ l4->set_background_color(0., 0., 0., 1.);
|
|
|
|
|
+ l5->set_background_color(0., 0., 0., 1.);
|
|
|
|
|
+ lb1->add_item(s1);
|
|
|
|
|
+ lb1->add_item(s2);
|
|
|
|
|
+ lb1->add_item(s3);
|
|
|
|
|
+ lb1->add_item(s4);
|
|
|
|
|
+ lb1->add_item(s5);
|
|
|
|
|
+ lb1->thaw();
|
|
|
|
|
+ lb1->recompute();
|
|
|
|
|
+ lb1->manage(mgr, event_handler);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
static void setup_gui(void) {
|
|
static void setup_gui(void) {
|
|
|
GuiManager* mgr = GuiManager::get_ptr(main_win, mak, (Node*)0L);
|
|
GuiManager* mgr = GuiManager::get_ptr(main_win, mak, (Node*)0L);
|
|
|
PT_Node font = ModelPool::load_model("ttf-comic");
|
|
PT_Node font = ModelPool::load_model("ttf-comic");
|
|
@@ -696,9 +751,11 @@ static void setup_gui(void) {
|
|
|
// test 10
|
|
// test 10
|
|
|
// test10(mgr, font);
|
|
// test10(mgr, font);
|
|
|
// test 11
|
|
// test 11
|
|
|
- test11(mgr, font);
|
|
|
|
|
|
|
+ // test11(mgr, font);
|
|
|
// test 12
|
|
// test 12
|
|
|
// test12(mgr, font);
|
|
// test12(mgr, font);
|
|
|
|
|
+ // test 13
|
|
|
|
|
+ test13(mgr, font);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static void event_2(CPT_Event) {
|
|
static void event_2(CPT_Event) {
|
|
@@ -778,13 +835,13 @@ static void event_3(CPT_Event) {
|
|
|
}
|
|
}
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
-// for test 11
|
|
|
|
|
|
|
+// for test 11, 13
|
|
|
static void event_3(CPT_Event) {
|
|
static void event_3(CPT_Event) {
|
|
|
lb1->scroll_up();
|
|
lb1->scroll_up();
|
|
|
cout << *lb1;
|
|
cout << *lb1;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// for test11
|
|
|
|
|
|
|
+// for test11, 13
|
|
|
static void event_4(CPT_Event) {
|
|
static void event_4(CPT_Event) {
|
|
|
lb1->scroll_down();
|
|
lb1->scroll_down();
|
|
|
cout << *lb1;
|
|
cout << *lb1;
|
|
@@ -799,9 +856,9 @@ void gui_keys(EventHandler&) {
|
|
|
have_dlight = true;
|
|
have_dlight = true;
|
|
|
|
|
|
|
|
event_handler.add_hook("2", event_2);
|
|
event_handler.add_hook("2", event_2);
|
|
|
- // for tests 7-11
|
|
|
|
|
|
|
+ // for tests 7-11, 13
|
|
|
event_handler.add_hook("3", event_3);
|
|
event_handler.add_hook("3", event_3);
|
|
|
- // for test 11
|
|
|
|
|
|
|
+ // for test 11, 13
|
|
|
event_handler.add_hook("4", event_4);
|
|
event_handler.add_hook("4", event_4);
|
|
|
event_handler.add_hook("demo-event-thing", event_demo);
|
|
event_handler.add_hook("demo-event-thing", event_demo);
|
|
|
}
|
|
}
|