Some last element test code for C
@@ -24,22 +24,31 @@ void demo_ui_update() {
// input_hand(handed_right).root;
ui_window_begin("Main", window_pose, vec2{ 24 }*cm2m);
+ ui_image(ui_sprite, vec2{ 6,0 }*cm2m);
+
ui_button("Testing!"); ui_sameline();
static char buffer[128] = {};
ui_input("text", buffer, 128, {16*cm2m,ui_line_height()});
- vec2 size = { 8 * cm2m * (cosf(time_getf())*0.5f+0.5f) + 1*cm2m, 6 * cm2m * (sinf(time_getf()) * 0.5f + 0.5f) + 1 * cm2m };
- bounds_t bounds = ui_layout_reserve(size);
static ui_btn_layout_ layout = ui_btn_layout_left;
- if (ui_button_img_at("Find", ui_search_sprite, layout, bounds.center + bounds.dimensions / 2, size))
+ if (ui_button_img("Find", ui_search_sprite, layout))
layout = (ui_btn_layout_)((layout + 1) % 3);
static float val = 0.5f;
static float val2 = 0.5f;
ui_hslider("slider", val, 0, 1, 0.2f, 72*mm2m, ui_confirm_pinch); ui_sameline();
ui_hslider("slider2", val2, 0, 1, 0, 72*mm2m, ui_confirm_push);
- if (input_key(key_mouse_left) & button_state_active)
- ui_image(ui_sprite, vec2{ 6,0 }*cm2m);
+
+ ui_panel_begin();
+ ui_label("Last Element Focus");
+ static float val3 = 0.5f;
+ ui_hslider("slider3", val3, 0, 1, 0.2f, 0, ui_confirm_pinch);
+ if (ui_last_element_hand_used(handed_left ) & button_state_active) ui_label("Left!");
+ if (ui_last_element_hand_used(handed_right) & button_state_active) ui_label("Right!");
+ if (ui_last_element_focused ( ) & button_state_active) ui_label("Focused!");
+ if (ui_last_element_active ( ) & button_state_active) ui_label("Active!");
+ ui_panel_end();
+
if (ui_button("Press me!")) {
ui_button("DYNAMIC BUTTON!!");
}
