+static int world_button_exec( struct world_button *btn, v2f texture, enum world_button_status *status )
+{
+ int triggered = 0;
+ int is_hovering = v2i_eq( (v2i){ world.tile_x, world.tile_y }, btn->position );
+
+ // Set up light targets before logic runs
+ if( btn->state )
+ btn->light_target = is_hovering? 0.9f: 0.8f;
+ else
+ btn->light_target = is_hovering? 0.2f: 0.0f;
+
+ if( vg_get_button( "primary" ) && is_hovering )
+ btn->light_target = 1.0f;
+
+ // Process click action
+ if( is_hovering )
+ {
+ if( vg_get_button_down( "primary" ) && is_hovering )
+ {
+ btn->click_grab = 1;
+ }
+ else if( btn->click_grab && vg_get_button_up( "primary" ) )
+ {
+ // Click event
+ *status = btn->state? k_world_button_on_disable: k_world_button_on_enable;
+
+ if( btn->mode == k_world_button_mode_toggle )
+ btn->state ^= 0x1;
+
+ sfx_set_play( &audio_clicks, &audio_system_ui, btn->state? 1:0 );
+ triggered = 1;
+ }
+ }
+ if( vg_get_button_up( "primary" ) )
+ btn->click_grab = 0;
+
+ // Drawing stage
+ v4f final_colour;
+
+ btn->light = vg_lerpf( btn->light, btn->light_target, vg_time_delta*26.0f );
+
+ v3_copy( btn->colour, final_colour );
+ final_colour[3] = btn->light;
+
+ glUniform4f( SHADER_UNIFORM( shader_buttons, "uOffset" ),
+ btn->position[0],
+ btn->position[1],
+ texture[0],
+ texture[1]
+ );
+ glUniform4fv( SHADER_UNIFORM( shader_buttons, "uColour" ), 1, final_colour );
+ draw_mesh( 0, 2 );
+
+ return triggered;
+}
+
+/*