How do I find the scale?

0 favourites
  • 5 posts
From the Asset Store
Use this game pack to create your own game, modify the existing game or simply take a look and see how it was made.
  • I'm making a pixel art game with a small base resolution (640x360) with "letterbox integer scale" Fullscreen mode selected. I actually want it to be a bit more zoomed in than it is, and also want to use zoom effects that resolve onto integer scales (that is, that 1 pixel in the small resolution turns into an integer amount of pixels at larger resolutions evenly everywhere on the screen).

    My problem is just that I can't figure out how "zoomed" the actual window is--I would refer to the canvas size, but I can't seem to find an expression that refers to the canvas size in the engine, even though it's tracked in the debug menu (though it *does* have the default canvas size expressions.) is there some other way to do this I haven't considered or am not seeing?

    for instance if I fullscreen my game I know that the zoom is 4x (bc I know my resolution is 2560x1440), so I can add or remove 1 pixel width to every "base pixel" by changing the layout scale by increments of 1/4. obviously I won't know what resolution my players are playing at, so I want to be able to do it programmatically, with units of, say, 1/zoom, or something like 1/(canvasWidth/640). I just can't find the expression.

    Tagged:

  • thank you so much!!! I spent like 45 minutes looking for it before posting, never thought about checking other plugins! now I feel silly

    just for the record if someone needs in 4-5 years or whatever, what I was looking for specifically is PlatformInfo.CanvasCSSWidth

  • Are you sure you need CSSWidth and not DeviceWidth?

    Try changing the Text Size in Display Settings in Windows, and see if your game works correctly with different scale values.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • That does seem to be the case yeah. Never would've even known.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)