Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Sprites in Screen coordinates

Author
Message
XANAX 2B
21
Years of Service
User Offline
Joined: 20th Jun 2003
Location: Corsica (France)
Posted: 21st Sep 2016 09:43
Hello community

In a program, i've set up a fixed Virtual Resolution of 1280x960, within a window of 1920x1080.

I try to :
1) Draw my graphics in an image with the same size as the Virtual Resolution.
2) Put the rendered image in a Sprite
3) Scale the Sprite to fit the window's size

My problem is that Sprites are based on the Virtual Resolution.
I don't know how to calculate its new Size & its new Position for it to fit the window.

Any idea of how to calculate that, please ?
My Freewares here : http://www.retro-bruno.com
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 21st Sep 2016 11:07
?
if you resize the window the virtual resolution still stay at his size.
GetVirtualWidth ()
GetVirtualHeight ()
SetScissor(0,0,0,0) without black bars
GetScreenBoundsBottom
GetScreenBoundsLeft
GetScreenBoundsRight
GetScreenBoundsTop
AGK (Steam) V2.0.20 : Windows 10 Pro 64 Bit : AMD (16.3.2) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
XANAX 2B
21
Years of Service
User Offline
Joined: 20th Jun 2003
Location: Corsica (France)
Posted: 21st Sep 2016 18:44
Quote: "
SetVirtualResolution

Description

The default approach for the coordinate system in AppGameKit is to use a percentage based system where 0,0 represents the top left corner and 100,100 the bottom right. The alternative approach is to treat the platform with a fixed resolution e.g. 320 x 480. Any platforms that don't match this resolution will be scaled to fit as much as possible with black borders where necessary."


It seams that the virtual resolution is scaled to fit the window (under windows), changing all. How to get around this problem ?
My Freewares here : http://www.retro-bruno.com
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 22nd Sep 2016 09:52 Edited at: 22nd Sep 2016 09:57
the idee behind this virtual resolution was that you have one resolution for all devices. but it not solve the different display aspect ratios.
if you use SetDisplayAspect( aspect ) the view should look ok also if you resize the window.

i believe u will have a fix size sprite inside a window if the window resize? may you can disable resize.
SetWindowAllowResize ( mode )
SetWindowSize ( width, height, fullscreen )

GetDeviceWidth() change also if you resized the window.
AGK (Steam) V2.0.20 : Windows 10 Pro 64 Bit : AMD (16.3.2) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)

Login to post a reply

Server time is: 2024-11-25 02:04:19
Your offset time is: 2024-11-25 02:04:19