[Obsolete] Perfect 1:1 Window Scaling

Post your own tutorials, guides and demos.

Post » Sun Jul 18, 2010 12:41 am

This is now an obsolete topic. Recent changes in Construct Classic have solved this problem. Perfect window scaling is possible by simply changing the client width and height.

For your convenience, this is copy/pasted in the .cap

The problem with 1:1 window resizing is that DisplayWidth/Height return the actual resolution of the window while Window.Width/Height return the resolution of the window + the window handle (You know, the border and the thing with the x on it!).

Notice at the bottom of the layout the fact that the window size is NOT a multiple of 128x128 like it should be. This is how Window.Width/Height measures it. This includes the windows handle/border.

To use the Window: Set Width action, we must determine the width and the height of the border and add it to the multiplied DisplayWidth/Height AFTER we multiply it to scale the screen. If we don't, the game is slight stretched out of proportion. You probably won't notice this on a regular game, but on a retro/pixel game, it's ever-so-obvious that something is wrong.

Also, as a limited time offer, I show you how to properly center the screen after a window resize! Megaman included for example, and for awesomeness.

Good luck with your games!

Love,
greyspot

Created in Construct 0.99.91.

Opps, updated the .cap
Combined silly things like "set x" and "set y" to "set position." Same with width and height to size.greyspot2011-07-25 20:54:19
B
3
S
1
G
2
Posts: 57
Reputation: 964

Post » Sun Jul 18, 2010 3:08 am

you can circumvent the whole border problem by disabling captions, then it has no border to measure and returns the size you put properly, as youd normally expect.
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610

Post » Sun Jul 18, 2010 3:12 am

Did this a while back. :D
viewtopic.php?f=8&t=4891
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Post » Sun Jul 18, 2010 6:39 am

Hey, have you looked closely at Window object? David added some features to it, such as ClientWidth and ClientHeight, which is the actual viewable area without borders and stuff. ;)
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Mon Jul 19, 2010 6:35 pm

First of all thanks greyspot for trying to nail this... I'm looking for something like this for quite a while.

But... [color=#FF8000:47d71ti3]your formula seems to have a problem..[/color:47d71ti3] Althought aparently it's scaling correctly, infact the aspect ratio isn't being maintained. The image below show's how when doubled or tripled the window actually adds random vertical and horizontal rows of pixels, thus distorting it.



As you can see marked in the left image with a red line there's an extra row of pixels added with the doubling method. I really wish there was a simple and effective way to scale pixel perfect an app in Construct, with or without captions. :idea:
B
6
S
1
G
2
Posts: 22
Reputation: 976

Post » Tue Jul 20, 2010 2:41 pm

did you even read mipey's post -_-
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610

Post » Fri Jul 23, 2010 4:25 am

Craaaap. I though I had it that time. I didn't even notice :/

[quote="QuaziGNRLnose":2tftp5mi]did you even read mipey's post -_-[/quote:2tftp5mi]

I still have that .cap in my "examples" folder :D
I did this because it wasn't quite right for my needs.
Mainly:

1. Doesn't work any more. Could edit it, but meh.
2. Even though I totally left that out, this was meant to work with window borders. It's a lot easier without window borders. I can't tell you how much I hate it when a game has no window border, unless it is fullscreen of course. I can't reposition it, minimize it for a minute, or close it easily without going through stupid in-game menus (assuming Alt+F4 doesn't work). Sure, I got the task bar, but c'mon now...

Oh well, back to the drawing board, as I fail at more community contributions D:
B
3
S
1
G
2
Posts: 57
Reputation: 964

Post » Fri Jul 23, 2010 9:52 am

Sometimes it is better to start anew and try new approach as new features are made available. If I have time, I'll whip a fresh example together.

If I don't forget to. :P
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Mon Jul 26, 2010 1:26 am

So, uhm, I'm having a problem, and I feel that it's pretty serious.

I was attempting to do window scaling for my pixel game. I wanted to give the user the option to play in a regular window(320x320) or a doubled window(640x640), for those who like to see everything at 2x size. However, no matter how many times I tried, my results turned out blurry as heck. It seemed that regardless of whether I chose point sampling or linear sampling, I had the same results. I had thought that what I was trying to do was a very simple thing. I was just setting the client height and width to double what they already were.

So, in effort to solve my problem, I checked this post. The first thing I did was take a look at the Megaman example provided. However, when I opened it, and tried the enlarged settings, they looked blurry as well. At this point, I became quite confused.

It seems to me that point sampling does not work on my computer or something. To me, linear and point sampling look exactly the same, regardless of whether I'm viewing my .cap or the one provided in this post. Point sampling appears blurry, just as linear.

I consulted the IRC channel, and someone using a dual monitor set up tried my .cap. According to him, when he moved the window to one screen, point sampling worked. However, when he moved the window to his opposite screen, it no longer worked(as if one screen was using point and the other was using linear). This, to me, was even more confusing.

My conclusion is just that point sampling is broken.

Here, is a screencap of a tile scaled to double size in paint(right), and one scaled to double size using point sampling in construct(left). As you can see, point sampling is blurry.


And lastly, here is the .cap of my project, set to point sampling. On my screen it appears blurry when the client is doubled(press Z). But, on your screen, it may appear correct, I really am not sure.
http://www.2shared.com/file/83D0GEoO/Juice.html
(Note that in order to downlaod the .cap on that page, you must scroll to the bottom and find "click here." Otherwise, you'll end up downloading a toolbar, or a robot dancing to Miley Cirus.)

If any additional details or screencaps are needed, please let me know.

Thanks in advance.
B
3
G
3
Posts: 18
Reputation: 911

Post » Mon Jul 26, 2010 4:36 am

@Silhouette
The burring is due to how your graphics driver resizes windows.

Here is a way to have 2:1 scaling [u:1bbuufdj]without[/u:1bbuufdj] any filtering:
* Check "unbounded scrolling" in the layout properties.
Then run these actions:
[code:1bbuufdj]-> System: Set Zoom to (200, 200)
-> System: Set layout size to 640 x 640
-> System: Change display size to 640 x 640
-> System: Scroll to X 0
-> System: Scroll to Y 0[/code:1bbuufdj]
B
79
S
24
G
54
Posts: 4,747
Reputation: 40,757

Next

Return to Your tutorials & example files

Who is online

Users browsing this forum: No registered users and 1 guest