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 / I want to tell something!!!

Author
Message
Celena
4
Years of Service
User Offline
Joined: 9th Oct 2019
Location:
Posted: 9th Oct 2019 03:59
Where am I going wrong here ?

SetWindowSize( 256, 342, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
SetVirtualResolution( 256, 342 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
DrawBox(10, 10, 246, 332, 100, 100, 100, 100, 1)
GetImage(1, 0, 0, 256, 342)
CreateSprite(1, 1)
SetSpriteSize(1, 256, 342)
SetSpritePosition(1, 0, 0)
SaveImage(1,"box.png")

do
Print( ScreenFPS() )
Sync()

loop

I can save this box.png here like so - but the resulting image is 574 x 768, not 256 x 342 in size ?
(It's just a red box with a bit of a gap around the edges, almost full window size)
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 9th Oct 2019 10:05
Just ran your code and it worked fine for me. I got the right size image but you were not using a proper "Color". Change the lines:

With this I get a box in the image at the size expected. As to why you get an incorrect image size I am not sure. Are you using a scaled windows setting?
Using AppGameKit V2 Tier 1
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 12th Oct 2019 01:17 Edited at: 12th Oct 2019 01:24
Dunno if this applies but shouldnt there b a render() before getimage() ?

https://www.appgamekit.com/documentation/Reference/Image/GetImage.htm

TomToad
6
Years of Service
User Offline
Joined: 6th Jan 2018
Location:
Posted: 12th Oct 2019 08:09
Are you actually checking the correct file? AppGameKit is weird on where it saves stuff. On my computer, it saves to C:\Users\(username)\AppData\Local\AGKApps\(appname)\media.
If you are not sure, you can always look at the details of the image to see if it was created or modified at the correct time. For example, mine says Saturday, ‎October ‎12, ‎2019, ‏‎3:03:18 AM. If it instead said Tuesday, August 5,2004, then I'd know I was actually seeing an older image, and not the one that was just saved.

Login to post a reply

Server time is: 2024-04-26 14:53:22
Your offset time is: 2024-04-26 14:53:22