Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///game_resize(view,zoom)
- // braffolk
- //First of all lets check if gui width or height is not equal to window width or height , if not then let's make them equal
- /*
- view_wport[argument0] = window_get_width();
- view_hport[argument0] = window_get_height();
- view_wview[argument0] = (view_wport[argument0]/argument1);
- view_hview[argument0] = (view_hport[argument0]/argument1);
- if( surface_get_width( application_surface ) != view_wview[argument0] or surface_get_height( application_surface ) != view_hview[argument0] ){
- surface_resize( application_surface , view_wview[argument0] , view_hview[argument0] );
- display_set_gui_size( view_wview[argument0] , view_hview[argument0] );
- return true;
- }
- exit;*/
- var zoom = argument1;
- var ww = floor(window_get_width()/zoom);
- var hh = floor(window_get_height()/zoom);
- if( ww = 0 or hh = 0 ){
- return false;
- }
- /* if( window_get_width() < 640 or window_get_height() < 480 ){
- window_set_size( clamp( window_get_width() , 640 , 9999 ) , clamp( window_get_height() , 480 , 9999 ) );
- var ww = floor(window_get_width()/zoom);
- var hh = floor(window_get_height()/zoom);
- }*/
- if ( view_wview[ argument0 ] != ww or view_hview[ argument0 ] != hh ){
- /*
- * We need to save window position and size for later usage
- * Because using display_reset() window size and position will be reset to what it was before.
- */
- /*var xx = window_get_x();
- var yy = window_get_y();
- var w = window_get_width();
- var h = window_get_height();*/
- /*
- * display_reset() is the key for pixel perfect resizing
- * Now we reset the display , without that it will look blurry and awful.
- */
- //display_reset( 0 , false );
- /*
- * Finally we set window size and position back to what it was before then we make view sizes and display_gui sizes equal to window sizes, and it's done!
- */
- //window_set_rectangle( xx , yy , w , h );
- surface_resize( application_surface , ww , hh )
- view_wview[argument0] = ww;
- view_hview[argument0] = hh;
- view_wport[argument0] = ww*zoom;
- view_hport[argument0] = hh*zoom;
- display_set_gui_size( ww , hh );
- //display_reset( 0 , false );
- return true;
- }
- return false;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement