Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- global ConfirmationScreen = {};
- function ConfirmationScreen.create( params )
- {
- callback = params.callback;
- data =
- {
- question = params.question,
- callback = callback,
- };
- data.menu = GameMenu.create
- ([
- { text = "Yes", action = function() use(data){ data.callback( true ); data.menu = null; } },
- { text = "No", action = function() use(data){ data.callback( false ); data.menu = null; } },
- ],
- { x = 384, width = 256, y = 384 });
- data.menu.mouseon = 1;
- return class( data, ConfirmationScreen );
- }
- function ConfirmationScreen.on_event( e )
- {
- if( this.menu )
- this.menu.on_event( e );
- // inhibit all events
- return false;
- }
- function ConfirmationScreen.draw( delta )
- {
- if( !this.menu )
- return true;
- draw_color_rect_wh( 0, 0, 9999, 9999, 0.5, 0.5, 0.5, 0.5 );
- draw_text_rect( this.question, g_GameFont, [1,1,1], DT_CENTER | DT_VCENTER, 128, W - 128, 128, H/2 );
- this.menu.draw( delta );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement