Prevent window resize?


#1

Is there a way to prevent window resize when building the app on desktop? My use case is I have a mobile game and my settings have a 16:9 ratio, but every time I click “build” in the editor, the app window is a square and I need to manually resize it down. I want the app to run in the specified 16:9 ratio and ONLY that ratio. Is this possible?


#2

Hmm, how can the app window open squared? Is the resolution in game.project larger than your screen? The DefOS extension has support for resize, lock etc


#3

The resolution I have set is 720 x 1280 and I’m on a 13-inch macbook pro so I don’t think that resolution should have any problem fitting on my screen. But thanks for the DefOS suggestion, looks like I might be able to resolve it with that.


#4

Ok, but it’s very strange if you have a 720x1280 resolution in game.project and the window opens up completely squared. Are you sure the window isn’t compacted to fit the screen resolution?


#5

I’ve uploaded 3 images: my settings, the default resolution, and my desired resolution. Can you see anything wrong with my settings that might be causing the square resolution shown in the 2nd image?




#6

sorry for bumping, but I had this issue too everytime I build, the width is offset


Then I need to drag it manually (480x800)


#7

What’s the values in game.project and what is your screen resolution?


#8
[bootstrap]
main_collection = /main/loader.collectionc

[script]
shared_state = 1

[display]
width = 480
height = 800

[project]
dependencies = https://github.com/PlayFab/LuaSdk/raw/master/Defold/PlayFabClientSdk.zip


#9

What’s the resolution of your screen/display/monitor? If it is less than or equal to 800 pixels then it would mean that when the window is opened it will not be able to take up the full 800 pixels specified in game.project (due to title bar and other things).


#10

Ah my bad, ya my screen resolution is 1366x768 (16:9)
Then as you said, it will not be able to take up the full 800px.
So, there is solution for this minor issue? even my screen not providing full pixel…

thanks


#11

One obvious solution would be to increase the screen resolution :slight_smile:

Another would be to use DefOS and resize the window if game.project specified width and height is larger than screen resolution. You could then automatically resize the window to maintain aspect ratio. I think maybe @Pkeod has done something like this already?


#12

Yes, it is very easy to do what @reydvires wants with DefOS. Just detect if the game is running in debug mode on macOS for example and then auto set the view size to whatever you want with the DefOS functions.


#13

Ah, but it seems an issue in Linux maybe?


#14

@ChaosYu might know what’s up with that.