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 / V107 - Code examples

Author
Message
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 5th May 2012 01:55
And is the app the right way up, or upside down when you try to grab the image?
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 5th May 2012 09:21
the right way up. but there are black borders on the side on Windows, which i think are causing the error.

i thought that on Windows if i specify agk::SetVirtualResolution (640, 960) it will always be a fixed box no matter what the aspect ratio.

on 4:3 screen it works fine without black borders on the sides, on 16:9 it causes a black border. I think I must add some extra command to take care of this right?
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 5th May 2012 10:22
No, if you specify the resolution then the aspect ratio of your game is set to that. If the aspect ratio set by the setup.agc does not match or you go fullscreen and your monitor has another aspect ratio then you will get black borders.

bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 5th May 2012 10:29
Baxslash, I am using T2, there is no setup.agc there.

I am in Windowed mode, no fullscreen.

But somehow it is affecting the outcome and causing black border on 16:9 if i use 640x960 res.

4:3 works fine without black borders.

This is something to investigate!!!
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 5th May 2012 10:35
GETIMAGE now WORKS using 1071...

... At least on Windows7 & Nvidia!

What I found is that the background colour IS actually effecting the outcome of how SetSpriteColorAlpha works. If I have a BLACK background (this is the default color if you do not use any SetClearColor command), then the GETIMAGE is blackish-dark.

I have to set SetClearColor() to a colour close to the image to get the right transparency effect! This way it works ok!

So my question is, what alpha blend mode is AppGameKit using?
And will there be different blend modes in the future as I noticed some people requesting them in the past?


Also i would like to get some more info on the best way to use DrawSprite(), Update() and Render() with GETIMAGE as I don't know the official correct way to do it.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 5th May 2012 10:45
Sprites are not rendered to the buffer until you use render() or sync(). If you use drawSprite() it will render the sprite in its current position to the buffer. There are a few ways this combination can be used.

Render()
DrawSprite()
Sync()

... To draw specific sprites like my draw commands on top of the current scene.

drawSprite()
GetImage()
ClearScreen()

... To draw a set of sprites, get a combined image and continue without it being visible in your game.

I would read up the help files as they helped me understand the best order to do certain operations.

bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 5th May 2012 10:46
Or to make a more direct question: Is it possible to add an alpha parameter to SetClearColor() and be able to set the background to 0 transparency like in Photoshop?
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 5th May 2012 10:55
That would be a good improvement!

bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 5th May 2012 15:24
Paul GetImage seems to be working on Windows7 & Nvidia now using 1071! Thanks a lot!!!

On iOS it's working on ipad3 with iOS 5.1 but it's NOT working on iphone 3gs with ios 4.2.

GetImage is not getting anything. It's totally blank/transparent.

I tried all possible combinations of Render() & DrawSprite()

Any ideas?!
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 5th May 2012 16:42
By default the back buffer clear always sets the alpha to 0.

Quote: "On iOS it's working on ipad3 with iOS 5.1 but it's NOT working on iphone 3gs with ios 4.2.

GetImage is not getting anything. It's totally blank/transparent."


One possible explaination is that the 3gs has a non-alpha back buffer and is using an alpha of 0 for the entire image even if a sprite should have overwritten it. A good test to see if this is the case would be to use the SetImageMask command to replace the alpha channel with something else and see if the color channels actually got filled out. Or using SetSpriteTransparency( ID, 0 ) might work also.
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 5th May 2012 17:30
Paul will test & report back. thanks
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 6th May 2012 16:57
Paul I am back after some testing on iOS.

SetSpriteTransparency (ID, 0) removes the transparency and produces a black background in the sprite.

So what does this mean?

The transparent GetImage() problem happens on iphone 3gs ios 4.2 and also on the simulator so you can check out Baxslash's example too.

Login to post a reply

Server time is: 2024-11-23 11:16:18
Your offset time is: 2024-11-23 11:16:18