This is for everyone who makes a low-res game and is annoyed by that blur that happens if you size up the screen or gets graphical glitches if they use tiles and use the viewport to size up the view.
- ALWAYS MAKE THIS OPTIONAL. ALWAYS!
Apparently not all computers handle surfaces with no problems and even if they usually do, if the video memory is messed up, it'll glitch until the computer is being restarted.
Don't look at me I have no idea why that is the case, it's a game maker related problem I have no explanation for. See this post.
It's alright though, it only takes one script call to switch it on and off. But make sure you actually use it in the options somewhere in your game!
The resizing is on by default, to switch it off simply call "scr_toggle_resize();" after initializing it, before going to the menu room (that your game undoubtedly has, right? Right?)
- Don't activate"Use synchronization to avoid tearing" if you use this! It'll tremendously slow the game down!
Once again, game maker related issue that I have no clue why it happens.
- Also due to the view being resetted, the native gm object following won't work. You have to make your own system for view handling.
- I'm not entirely sure about it but I think gm-native transitions won't work propperly with this either.
- If you get a black screen, that's probably because of your game deactivating the screen controlling instance.
instance_activate_object(global.screencontroller);right after de-activating all instances to solve that.
That should always keep the controller object activated, regardless of what sprite or position it has.
How to use the scripts:
scr_resize_init(w,h): Initializes the system.
Call it when your game starts.
w: view width, h: view height.
scr_resize_init_gm7(w,h): If you use gamemaker 7 or 8, use this script to initialize the system because gm7+ handles surfaces differently.
scr_room_goto_resize(room,w,h,wport,hport): Always use this instead of room_goto and use it at least once so the system has an effect!
wport: width of the screen hport: height of the screen room: room to go to.
wport and hport are how big you want the screen to be, not how big the view is so you want to make it bigger than width and height to increase the size of the view.
scr_toggle_resize(w,h): Toggles the resizing.
Always call scr_room_goto_resize() directly after that for it to have an effect.
Otherwise the view won't resize which can lead to your game being displayed in the top left corner of the much larger screen.
scr_texture_set_interpolation(interpolation): Use this instead of texture_set_interpolation()!
Sets 'interpolate colors between pixels' without blurring the resized surface.
It's off by default because usually hard pixels is what you want if you use this.
The next few scripts are specifically for while-loops that freeze the game and do some drawing within them (pause menus and such).
If your game doesn't do that, you won't need them.
scr_screen_redraw(): Completely replaces screen_redraw()!
It draws the stretched surface to the screen or acts like the normal 'screen_redraw' if the system isn't active.
scr_resize_start_drawing()/scr_resize_stop_drawing(): For drawing when the game is frozen by a while loop (paused).
Use scr_screen_redraw() BEFORE calling scr_resize_start_drawing(), IF you use it to redraw the screen because everything between start and stop will be drawn to the surface to stretch it properly.
If you redraw the screen within that, it cancels that effect and your game suddenly becomes a tiny speck in the top left corner of the screen.
Call scr_resize_start_drawing(), draw the stuff, then call scr_resize_stop_drawing().
Keep in mind that this does NOT replace screen_refresh(), you still have to call that afterwards to update the screen.
Hope this helps someone.
Edited by 9_6, 26 September 2010 - 04:30 PM.