• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

GMS 1 Window (port) Size is dependant on initial room? (Room View)

Dr_Nomz

Member
I want to test out which type of room view I want, but no matter how much I change the port of the second room, it still remains the same size as the initial room.

Any idea how I can make it adhere to the second room's port?

Reason I need an initial room is for code reasons or my game won't run.
 

Dr_Nomz

Member
So using the room editor for view testing and window size is pointless? I guess I won't use it at all if it doesnt work.

I'll try some manual programming then.

EDIT: I have no idea how to fix it. All I know how to do is move the camera, not set the view and port size.
 
Last edited:

chamaeleon

Member
Maybe this in a Room Start event will be a starting point?
GML:
window_set_size(256, 256);
view_wport[0] = 256;
view_hport[0] = 256;
view_wview[0] = 256;
view_hview[0] = 256;
 

Dr_Nomz

Member
don't forget

GML:
surface_set_size(application_surface, 256, 256);
Yeah that doesn't exist in GMS 1.4.

I tried this:

GML:
///Set the window size.
var wide = 800;
var tall = 400;
window_set_size(wide,tall);
view_wport[0] = wide;
view_hport[0] = tall;
view_wview[0] = wide;
view_hview[0] = tall;
This seems to work, but it keeps generating stupid black bars on the sides, and squishes everything in between! So everything being displayed is skinnier than it should be.

Also the closest thing to what you used seems to be this, but it didn't work either:
surface_resize(application_surface,wide,tall);
 
Also the closest thing to what you used seems to be this, but it didn't work either:
surface_resize(application_surface,wide,tall);
Ah sorry I was working from memory. That is what I meant.

Resizing it to the correct size will fix a bug where the game is drawn at the right size but everything will look a little blurry.

This seems to work, but it keeps generating stupid black bars on the sides,
This is a setting in global game settings:
1626789615880.png

The black bars are from keep aspect ratio being checked.

if you set that setting, use this code:
GML:
///Set the window size.
var wide = 800;
var tall = 400;
window_set_size(wide,tall);
view_wport[0] = wide;
view_hport[0] = tall;
view_wview[0] = wide;
view_hview[0] = tall;
Make sure views are enabled in the room, and also resize the application surface, it should work
 

Dr_Nomz

Member
Turned it to Full Scale, really annoying that GMS has settings turned on by default that make everything look like 💩💩💩💩. Thanks dude, it's all working perfectly now with just that change.

Also what about views in the room? Do I have to change any settings there or JUST enable views?

Also what do you mean resize the app surface? Isn't the code already doing that right there?
 
Turned it to Full Scale, really annoying that GMS has settings turned on by default that make everything look like ****. Thanks dude, it's all working perfectly now with just that change.
Glad to hear it's working for you!

I think the reason behind it is: yes your game may look like dirt when it's rescaled, but it at least wouldn't break. If you haven't specifically programmed your game to adapt to different resolutions and aspect ratios, all sorts of things can go wrong.

Also what about views in the room? Do I have to change any settings there or JUST enable views?
I actually can't remember if you need to enable views, I think if you're not using views, all you have to do is resize the application surface and window and that's it. But I could be wrong, I usually use views.

Also what do you mean resize the app surface? Isn't the code already doing that right there?
This code is changing the camera dimensions:
GML:
///Set the window size.
var wide = 800;
var tall = 400;
view_wport[0] = wide;
view_hport[0] = tall;
view_wview[0] = wide;
view_hview[0] = tall;
This code is setting the final resolution of your game:
GML:
surface_resize(application_surface,wide,tall);
And this code changes the size of the actual window on your screen:
GML:
window_set_size(wide,tall);
If you want a pixel perfect result, the application surface should be the same size as the window, otherwise you will get distortion.[/code]
 

Dr_Nomz

Member
That's the thing though, I'm setting all that on Room Start (since I just want to change the resolution once) but using surface resize with window_set_size freezes it. EDIT: Weird, that only happened earlier when that other setting in GMS was default, now I can use both functions together with no issue. That's really weird.

NEW question: I just set the dimensions to absurd sizes for testing, and while I had no issues (other than it didn't look right at 10k x 5k) for some reason using surface_resize throws an error if it's too big.
GML:
___________________________________________
############################################################################################
ERROR in
action number 1
of Other Event: Room Start
for object obj_Control:

Invalid surface dimensions
 at gml_Object_obj_Control_StartRoomEvent_1 (line 9) - surface_resize(application_surface,wide,tall);
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_obj_Control_StartRoomEvent_1 (line 9)
So why is it doing that? What does it mean? Can I not have the surface any size I want, or is it limited to only being below ten thousand pixels large? (Note: I am not planning on making anything with a surface that large, I'm just doing this out of curiosity)
 
I'm not sure what the maximum dimensions are but it's possible that it cannot be larger than the texture page size defined in global settings

Also if you're using auto scale code that sets the application surface to the window size (e.g. user resizes the window, code detects and adjusts), make sure you check first that the window size is not 0,0 which will occur when the window is minimised, producing an error that looks like that.
 
Top