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 / Different Resolution, Different Sprite Size!

Author
Message
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 7th May 2012 17:47 Edited at: 7th May 2012 17:48
I have an odd one, where sprite sizes change when I set Fullscreen to 0 or 1.

Scenario 1, as it should be:

rem Specify the initial device width
width=720
rem Specify the initial device height
height=450
// Specify whether to use fullscreen mode
fullscreen=0
...
setVirtualResolution(720,450)


Scenario 2, sprites are twice the size they should be:


rem Specify the initial device width
width=720
rem Specify the initial device height
height=450
// Specify whether to use fullscreen mode
fullscreen=1
...
setVirtualResolution(720,450)



I use SetSpriteSize() to set the ball sizes, so they should be identical irrespective of the screensize. The size is 30, and this is correct when fullscreen = 0. The relative size when running fullscreen is 60 (actual size 120 on a 1440-wide screen).

I've looked back at other projects and this has not been a problem, so I am baffled. I do not think this is an issue with 1.07.

Attachments

Login to view attachments
Hodgey
14
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 8th May 2012 01:34
If you print the sprite width and height of one of the balls in fullscreen mode, what does it report? It should say '30' for the width.

DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 9th May 2012 05:01
I have not seen this myself. I have seen another similar thread though. Perhaps it may be related to system hardware? Seems an odd thing to crop up now though. Perhaps a demo, so others can test it on other machines to see what happens?

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 12th May 2012 18:47
I resolved this issue, I don't know if it is a bug or by design.

GetImage() creates an image from your actual screen resolution, not the virtual screen resolution. So for me:

Virtual Screen Resolution = 720,450
Actual Screen Resolution = 1440, 900

With Fullscreen = 0, I get my 30x30 image
With fullscreen = 1, getImage requests 30x30, but the resulting image is 60x60.

DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 12th May 2012 20:10
Ah, I think DB had similar issues when grabbing full screen images. It grabbed according to your desktop res rather than the one you had set in DB. So any saved images were huge.

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 12th May 2012 22:15
That's an odd bug. I haven't been using fullscreen but it would make sense since the "virtual" resolution is just a scale to set positioning by, not an actual value.

The problem is that if you use getImage() on a full screen and select the full "virtual" screen size you would expect the image to be the full current resolution not 720x450. I would therefore guess this is not a bug but inherited by design.

DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 13th May 2012 08:12
I myself have got 1/4 size images on my android, compared to how it looks on the PC. I didn't notice it in Obliterator as I tend to set the size of each sprite. If you just load an image now and create a sprite from it without specifying the size, it seems to shrink the sprite(on android). If you set the sprite size after, it seems to fix it. But in 1065 a sprite was always the same as the image size unless you changed it. So it seems like something has been altered during the update.

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 13th May 2012 10:55
We didn't have getImage() in V1065. If you don't set the size of a sprite it defaults to the size of the image.

Impetus73
12
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 13th May 2012 11:36
No baxslash, in the later releases, it goes to ca 1/4'th of the size of the image, over a certain size. I had 1280x800 res, and a 1280x800 pic, it got the size of a stamp in the corner, until I added setspritesize(sprite,1280,800), so it's an error.

----------------
AGK user - novice
Did Amiga / AMOS programming in the 90's, just started programming again with AGK.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 13th May 2012 13:02
OK, I haven't had that error myself.

Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 14th May 2012 17:34
Quote: "GetImage() creates an image from your actual screen resolution, not the virtual screen resolution."


This is by design, since a virtual resolution of 100x100 (the default percentage resolution) could fill the whole screen on an iPhone and iPad which as far as OpenGL is concerned are using different resolutions. So the GetImage command will return different image sizes for GetImage(0,0,100,100), but using SetSPriteSize(ID,100,100) would make that image fill the screen at perfect quality for that device.

For example GetImage(0,0,100,100) on an iPhone would return a 320x480 image which is perfect for full screen iPhone. On an iPad it would return 768x1024 which is perfect for full screen iPad.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 15th May 2012 00:15
Thanks Paul, that makes sense.

erebusman
12
Years of Service
User Offline
Joined: 23rd Jul 2011
Location: Sacramento, CA
Posted: 29th Jun 2012 06:34 Edited at: 29th Jun 2012 06:37
I'm having the same problem but here is what I noticed :


I loaded my mainmenu.png screen which is a 1024x768 image

Example 1:


Expected Result: I put 100,100 it should scale to 100% of the 800x600 virtual resolution.
Actual Result: Example 1 code results in a 100x100 stamp sized main menu in the upper left

Example 2:


Expected Result: I put 100,-1 it should scale to 100% of the 800 virtual resolution and scale the 600 proportionately.
Actual Result: Example 2 also results in what looks like a 100x100 stamp sized image in the upper left corner

Example 3: *This should not work like this AT ALL according to the documentation*



Expected Result: I put 800,600 it should not work at all, this is outside of the documented parameters acceptable for this command
Actual Result: In example 3 now it scales my image to 800x600 to match the virtual resolution fitting the screen perfectly!



This is either incorrectly documented or a bug.
Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 29th Jun 2012 12:06 Edited at: 29th Jun 2012 12:08
AFAIK, once you use SetVirtualResolution(), all your sizes are in relation to that resolution. If you DO NOT use SetVirtualResolution(), then your sizes are a percentage of the screen.

So (100,100) can be either virtual pixels, or percentage, but not both.

See the help on SetDisplayAspect() for how this works.

Some days, the bear will eat you.
Some days, you'll eat the bear.
Today, I'm eating the bear!
Hodgey
14
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 29th Jun 2012 13:09
Quote: "I put 100,100 it should scale to 100% of the 800x600 virtual resolution."

Not exactly. If you replace setVirtualResolution(800,600) with setDisplayAspect(-1), then it should scale to the 100% of the screen. If you use a virtual resolution then you will be dealing pixels, hence why its sized down to 100 pixels by 100 pixels.

setDiplayAspect (default) = percentage
setVirtualResolution = pixels

So basically what Rich said.

Quote: "Example 3: *This should not work like this AT ALL according to the documentation*"

Why not?

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 29th Jun 2012 17:32
Quote: "this is outside of the documented parameters acceptable for this command"


You are confusing the default (percentage system) and the virtual system. If you were using the percentage system, setting the size to 800x600 would not be correct. But, in your third example you use the command 'agk::SetVirtualResolution(800,600);'. This sets you up to be using the virtual pixel based system. So, setting your image size to the maximum size of your system is allowed.

Cheers,
Ancient Lady
AGK Community Tester
erebusman
12
Years of Service
User Offline
Joined: 23rd Jul 2011
Location: Sacramento, CA
Posted: 29th Jun 2012 18:59
Thanks for the clarification folks.

I think this could be clearer in the documentation -- obviously why I came to the conclusion that I did!

Thanks
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 29th Jun 2012 19:19
From the SetSpriteSize documentation page:
Quote: "In the default coordinate system a width and height of 100,100 would fill the entire drawable screen (this can be changed using SetVirtualResolution)."


Cheers,
Ancient Lady
AGK Community Tester
anwserman
12
Years of Service
User Offline
Joined: 20th May 2011
Location: Wisconsin
Posted: 29th Jun 2012 22:29
Ok, could someone explain to me how or why anyone would use the percentage based system? I understand that it will always completely fill up the screen, but how does one make a tile-based game off of percentages?

To me, if I make a 32x32 pixel tile, I know it's 32x32. But how do I position it accordingly? I feel I'd have to figure out what the resolution of the screen is, divide it by 32, and then that's my unit for movement.

It just seems more complicated :/

Hi there. My name is Dug. I have just met you, and I love you.
Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 29th Jun 2012 23:14 Edited at: 29th Jun 2012 23:15
Well, if you change your screen resolution, you don't have to worry about changing the size or location of your sprites.

You will ALWAYS be able to fit 10 sprites, each at 10% size, across the screen, no matter how many pixels your device displays.

And 50%, 50% is ALWAYS going to be the center of your screen, no matter how many pixels it is wide or tall.

And so on...

That's a good reason to use for the percentage system.

It is a bit more work to set up, but can be more flexible.

Some days, the bear will eat you.
Some days, you'll eat the bear.
Today, I'm eating the bear!
erebusman
12
Years of Service
User Offline
Joined: 23rd Jul 2011
Location: Sacramento, CA
Posted: 30th Jun 2012 03:15 Edited at: 30th Jun 2012 03:17
@ Hodgey ; re: the quote why this should not work according to documentation. This was answered by Ancient Lady above; however her bolding the relevant portion essential creates an emphasis that changed the way I read it.

I'm sure I won't be the only person to misread it so I still feel the documentation could be clearer myself

I wish the documentation was in Wiki form that the community could help maintain!!

Especially in AppGameKit there are often not-context sensitive examples OR the example is very short to not include context of the example in a working program ; some times this context would be extremely important and relevant. Like say ... in this specific case!



Moving forward though I have now made this code



this code ALSO results in a stamp sized icon in the upper left of the window.

Note I attempted to use SetDisplayAspect to values of -1 (as suggested) as well as to match my display of 1.33, neither worked.

NOTE: I am using the VS2010 template as my project base ...

I then investigated the Core.cpp and found



So I commented those two lines out; and then it complains the device_width and device_height are not set...

Any tips on what I can adjust next to get percentage based system to work?

EDIT: I just realized I may be 'hijacking' the original thread so I can start my own thread if anyone feels I'm stepping on toes here? I sort of feel this resolution related discussion all being in one thread will help others so that is why I did not do so to begin with though .. let me know?
Hodgey
14
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 30th Jun 2012 03:39 Edited at: 30th Jun 2012 03:40
What happens when your run this:



Edit- I should say that for me, the entire screen is red with a white "Hello World" in the top left hand corner.

erebusman
12
Years of Service
User Offline
Joined: 23rd Jul 2011
Location: Sacramento, CA
Posted: 30th Jun 2012 04:18
@hodgey ; this creates a red square in upper left, with the words hello world halfway over it and halfway on black text

screenshot here http://infernohawke.com/erebus/punchy/2012/helloworld.jpg
Hodgey
14
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 30th Jun 2012 04:19
Ok, that's weird. Which version of AppGameKit are you using?

erebusman
12
Years of Service
User Offline
Joined: 23rd Jul 2011
Location: Sacramento, CA
Posted: 30th Jun 2012 04:44
build 107 .. ? is that good / bad?
Hodgey
14
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 30th Jun 2012 04:55
That should be fine. If you run this, what are the printed numbers?



erebusman
12
Years of Service
User Offline
Joined: 23rd Jul 2011
Location: Sacramento, CA
Posted: 30th Jun 2012 05:35 Edited at: 30th Jun 2012 05:35
@hodgey

Device width: 1024
Device height: 768
Virtual Width: 1024
Virtual Height: 768

NOTE: My actual desktop is 1680x1050 if that is important to know at all
Marl
12
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 30th Jun 2012 05:41
Have you tried setting the virtual resolution to 100,100

Wouldn't that be the same as using the percent system?
Hodgey
14
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 30th Jun 2012 06:08
@erebusman: That's really weird. Check that you aren't setting the VirtualResolution anywhere because it should read:

Device width: 1024
Device height: 768
Virtual Width: 100
Virtual Height: 100

Maybe upload the entire project?

@Marl:
Quote: "Wouldn't that be the same as using the percent system?"

Not exactly. You can change the aspect ratio to suit the percent system (and take up the entire screen without borders). With the virtual resolution of 100x100, to avoid borders, you'd have to have a screen with the ratio of 1.

Login to post a reply

Server time is: 2024-05-02 09:33:07
Your offset time is: 2024-05-02 09:33:07