Posted: 23rd Nov 2011 8:24
Here's my code for displaying a sprite on screen in AGK. Resolution is set at 640x320 and the sprite is way too large.
+ Code Snippet
SetDisplayAspect( 0.66 )

shipImg = loadImage("ship.png")
shipId = createSprite(shipImg)
setSpriteAnimation(shipId, 32, 32, 7)

do

    Sync()
loop


The sprite is only 32x32 pixels, and as you can see in the image it looks just fine at the same resolution in DBP. I checked the size in photoshop and it seems to be scaled up exactly 3x large in AppGameKit, 96x96.





Alright, think I fixed it. Had to call setVirtualResolution. So what's the point of setting the values in setup.agc?
Posted: 23rd Nov 2011 8:33
It's because you're using the SetDisplayAspect instead of the SetVirtualResolution command. So either replace the former with the latter or try this:

+ Code Snippet
// using percentage system i.e 100x100
SetDisplayAspect( 0.66 )

// get the screen width
ScreenWidth as float
ScreenWidth = GetDeviceWidth()

// declare and set a ratio
ratio as float
ratio = 100.0 / ScreenWidth


shipImg = loadImage("ship.png")
shipId = createSprite(shipImg)

// scale the sprite to the ratio
SetSpriteScale( shipId, ratio, ratio)

setSpriteAnimation(shipId, 32, 32, 7)

do

    Sync()
loop

In short this works out the ratio difference and scales the sprite accordingly.

Edit- forgot to mention two things:
1. When you use the percentage resolution (ie setdisplayaspect) it treats the window as 100x100 instead of the dimensions you see in the setup.agc.
2. I haven't actually run the code but it is based off what I used in my projects.
Posted: 23rd Nov 2011 23:49
Alright, think I fixed it. Had to call setVirtualResolution. So what's the point of setting the values in setup.agc?

Its more or less an resolution you get while coding in windows.
Its pretty hard to debugg your game in windows if its 320x240 in an high resolution in windows.
You can also test how your game gets scaled on various devices.
Are you working on an remake of the amiga clasic ?
Posted: 24th Nov 2011 0:46
ts more or less an resolution you get while coding in windows.

I actually think that it sets the physical resolution of the application and then you get to set virtual resolutions or use the percentage system. On windows the values in the setup.agc file determine the size of the window if in windowed mode.
Posted: 24th Nov 2011 15:44
Set virtual resolution, sets the resolution your game is working with internally in the game.

The config file sets the resolution of your windows-device, the resolution the windows program is emulating.

Mobiles and tabs all have different resolutions, therefore the windows program should be able to have the same.