Dear all! I'm working on a Windows machine with Win 7 x64 and strawberry perl 5.12.2.
I wrote a script to change the current app's screen resolution (see below). When the resolution is changed via the resize command from SDLx::App, then I cannot close the window by the tiny red cross in the upper right corner of the windows title bar anymore. Every time I try to click on it, my mouse is dragged back into the window, off the title bar. When I minimize the app and bring it back to top again, everything works fine. Do I have to update the app somehow to make it work? And, is it possible to make an app resizable without allowing the user to manually resize the window by dragging the window borders? Here is the script: [code] #!perl use strict; use warnings; use SDL; use SDL::Events; use SDLx::App; use SDLx::Rect; use SDLx::Text; my $app = SDLx::App->new( title => 'screen resolutions', exit_on_quit => 1, resizeable => 1, ); my %res = ( '1024x768' => SDLx::Text->new( text => '1024x768', x => 0, y => 0, align => 'left', ), '1680x1050' => SDLx::Text->new( text => '1680x1050', x => 0, y => 20, align => 'left', ), '1280x720' => SDLx::Text->new( text => '1680x720', x => 0, y => 40, align => 'left', ), '1280x768' => SDLx::Text->new( text => '1680x768', x => 0, y => 60, align => 'left', ), '1280x800' => SDLx::Text->new( text => '1280x800', x => 0, y => 80, align => 'left', ), '640x480' => SDLx::Text->new( text => '640x480', x => 0, y => 100, align => 'left', ), ); my $current_res = SDLx::Text->new( text => 'current resolution = ' . $app->w . 'x' . $app->h, x => 200, y => 200, align => 'left', ); $app->add_event_handler(sub{ my ( $event, $app ) = @_; if( $event->type == SDL_MOUSEBUTTONDOWN and $event->button_button == SDL_BUTTON_LEFT) { if( $event->button_x > 0 && $event->button_x < 100 ) { if( $event->button_y > 0 && $event->button_y < 20 ) { $current_res->text("current resolution = 1024x768"); $app->resize( 1024, 768 ); }elsif( $event->button_y > 20 && $event->button_y < 40 ) { $current_res->text("current resolution = 1680x1050"); $app->resize( 1680, 1050 ); }elsif( $event->button_y > 40 && $event->button_y < 60 ) { $current_res->text("current resolution = 1280x720"); $app->resize( 1280, 720 ); }elsif( $event->button_y > 60 && $event->button_y < 80 ) { $current_res->text("current resolution = 1280x768"); $app->resize( 1280, 768 ); }elsif( $event->button_y > 80 && $event->button_y < 100 ) { $current_res->text("current resolution = 1280x800"); $app->resize( 1280, 800 ); }elsif( $event->button_y > 100 && $event->button_y < 120 ) { $current_res->text("current resolution = 640x480"); $app->resize( 640, 480 ); } } } }); $app->add_show_handler(sub { # first, we clear the screen $app->draw_rect( [0, 0, $app->w, $app->h], 0x000000FF ); # render available screen resolution options $res{$_}->write_to($app) for keys(%res); # render current screen resolution $current_res->write_to($app); # finally, we update the screen $app->update; }); $app->run(); exit(0); [/code] Kind regards, Alex