exit
authorhgn <hgodden00@gmail.com>
Thu, 20 Mar 2025 03:31:04 +0000 (03:31 +0000)
committerhgn <hgodden00@gmail.com>
Thu, 20 Mar 2025 03:31:04 +0000 (03:31 +0000)
shaders/workshop_compositor.fs
src/board_maker.c
src/board_maker.h

index fd5ddf8d8463ef222b721b492bd53f73634b33bc..9a1ed10e20d92733553eba66146855372418aecb 100644 (file)
@@ -11,6 +11,11 @@ void main()
 {
    vec4 c = texture( uTexMain, aUv.xy );
 
+   if( uDecal == 0 )
+   {
+      c.rgb = c.rgb*uColour.rgb;
+   }
+
    if( uDecal == 1 )
    {
       vec4 d = texture( uTexDecal, aUv.zw );
index 45a4fe4112f5e6fc50493975085c4d1827107a98..1d6cde53c3c3cea1eb9ee251201207cc3e158fba 100644 (file)
@@ -456,6 +456,15 @@ void _board_maker_ui( ui_context *ctx )
       ui_fill( ctx, bib, colour );
    }
 
+   ui_rect quit_box;
+   ui_split( panel, k_ui_axis_h, -24, 0, panel, quit_box );
+
+   bool quit_me = 0;
+   if( ui_button_text( ctx, quit_box, "Exit", 1 ) == k_ui_button_click )
+   {
+      quit_me = 1;
+   }
+
    if( _board_maker.ui_state == k_board_maker_ui_state_pick_colour )
    {
       _board_maker.pop_panel[0] = root[0] + root[2] + 8;
@@ -598,6 +607,12 @@ void _board_maker_ui( ui_context *ctx )
    ui_rect box = { vg.window_x-(400+8),8, 400,400 };
    ui_image( ctx, box, &_board_maker.compositor_fb.attachments[0].id );
    ui_outline( ctx, box, 1, ui_colour( ctx, k_ui_fg ), 0 );
+
+   if( quit_me )
+   {
+      if( world_clear_event( k_world_event_board_maker ) )
+         _board_maker_close();
+   }
 }
 
 void _board_maker_open(void)
@@ -625,3 +640,25 @@ void _board_maker_open(void)
    browser->mode = k_filebrowser_mode_pick_file;
    browser->filter = 0x1 << k_media_type_image;
 }
+
+void _board_maker_close(void)
+{
+   for( u32 i=0; i<k_workshop_shader_part_max; i ++ )
+   {
+      struct board_maker_decal *decal = &_board_maker.decals[i];
+      clear_decal( decal );
+   }
+   vg_framebuffer_free( &_board_maker.compositor_fb );
+
+   free( _board_maker.browser );
+   _board_maker.browser = NULL;
+
+   vg_allocator_free( _board_maker.static_heap );
+   vg_allocator_free( _board_maker.template_heap );
+
+   _board_maker.static_heap = NULL;
+   _board_maker.template_heap = NULL;
+   _board_maker.state = k_board_maker_state_not_ready;
+   mdl_sync_std_unload( &_board_maker.template_mdl );
+   _board_maker.model_loaded = 0;
+}
index 0f9ad871dec8bfe3a5cb0602cb4d8dea9b29dcdf..48763dac5cfa874ed2b5ef44a962227974c90d50 100644 (file)
@@ -93,3 +93,4 @@ void _board_maker_pre_update(void);
 void _board_maker_render( world_instance *world, vg_camera *cam );
 void _board_maker_ui( ui_context *ctx );
 void _board_maker_open(void);
+void _board_maker_close(void);