How do I crop the game until integer scale is possible?

Get help using Construct 2

Post » Tue Jan 10, 2017 1:18 am

Hello,

I've got an interesting task that I need some help with.

I need to keep my game pixel perfect, so Integer Scaling works nicely for that. However I am trying to make it so that it doesn't pop immediately to the next multiple down showing large black bars, but instead will crop the game until that next integer multiple is possible, and THEN it will pop to that scale, and continue the cropping. This way there are no black bars, and it will only be cropped if the window is off-aspect.

Is this possible? I'm struggling to figure out how I might be able to do this by manipulating the camera using the WindowHeight and WindowWidth, but it hasn't been very successful yet.

Any suggestions are welcome.
B
12
S
4
Posts: 48
Reputation: 910

Post » Tue Jan 10, 2017 4:32 am

Found some moderate success using the Crop fullscreen mode, along side Magicam to set the layout zoom on tick based on "round(WindowWidth / GameWidth)", while also keeping the player centered.
B
12
S
4
Posts: 48
Reputation: 910

Post » Fri Feb 24, 2017 8:15 pm

Valhallen wrote:Found some moderate success using the Crop fullscreen mode, along side Magicam to set the layout zoom on tick based on "round(WindowWidth / GameWidth)", while also keeping the player centered.

I'm trying to figure out how to use crop instead of integer and keep my pixels square instead of some of them going into rectangles. Someone else mentioned using the scale integer divided by browser.DevicePixelRatio but this didn't work for me. I'm using Magicam also, and I want to use 1920x1080 screen size, but scale using Magicam. This way I should be able to use subpixels for smooth motion, without having pixels resized badly. DId this method work okay for you?
B
41
S
12
G
14
Posts: 1,120
Reputation: 11,259

Post » Sun Feb 26, 2017 10:40 am

Valhallen wrote:Found some moderate success using the Crop fullscreen mode, along side Magicam to set the layout zoom on tick based on "round(WindowWidth / GameWidth)", while also keeping the player centered.

Also, what project settings did you use?
B
41
S
12
G
14
Posts: 1,120
Reputation: 11,259

Post » Sun Feb 26, 2017 11:50 am

A scale outer integer mode has been asked for before. It would be a great addition so essentialy it would scale to the next integer size outside the window instead of inside as we have it now. Nothing has come of this request though.
B
43
S
23
G
20
Posts: 735
Reputation: 12,027

Post » Sun Feb 26, 2017 12:48 pm

Ethan wrote:A scale outer integer mode has been asked for before. It would be a great addition so essentialy it would scale to the next integer size outside the window instead of inside as we have it now. Nothing has come of this request though.

I mean, I'd be happy enough if I could keep the smooth scrolling AND actually have the game upscale the pixels properly on integer mode, but it doesn't work on high quality scale mode at all, they get distorted.
B
41
S
12
G
14
Posts: 1,120
Reputation: 11,259

Post » Mon Feb 27, 2017 7:35 pm

Ethan wrote:A scale outer integer mode has been asked for before. It would be a great addition so essentialy it would scale to the next integer size outside the window instead of inside as we have it now. Nothing has come of this request though.


Yes that's more precisely the effect I was searching for. I'm happy to see I'm not the only one trying to do this, and that it actually has a name. Too bad it's gone unimplemented.

Zebbi wrote:
Valhallen wrote:Found some moderate success using the Crop fullscreen mode, along side Magicam to set the layout zoom on tick based on "round(WindowWidth / GameWidth)", while also keeping the player centered.

Also, what project settings did you use?


Basically I've got my Magicam setting zoom based on the size of the window. Anytime the width or height surpasses a multiple of the true game resolution, the zoom increases by 1.

So if your game is 100 pixels wide, and your window is stretched to 530 pixels wide, it would be zoom = round(530 / 100), which would result in the camera being zoomed to 5x normal. As long as you keep your zoom at integer values, your pixels will stay square. I then have my project's mode set to Crop. I can give you more details once I'm home, but that's really the gist of it.

I believe I take (windowWidth / nativeWidth) and then compare it to (windowHeight / nativeHeight). Which ever is bigger is what I use as the new zoom. I may do some shenanigans involving checking if the current platform is mobile for some small-format changes, but not much else.
B
12
S
4
Posts: 48
Reputation: 910


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 48 guests