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 / An example of using SetImageMask to create a window

Author
Message
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 28th May 2012 22:22 Edited at: 28th May 2012 22:25
This code shows how SetImageMask may be used to create a window for showing stuff.

SetPhysicsDebugOn() is used so that you can 'see' the hidden image.

I set the restitution over 1 so that the moving object gains energy.



Here are the images:
simple.png -


bluesun.png -


EDIT: the mask file is 'invisible', so use the download to get it.

Cheers,
Ancient Lady

Attachments

Login to view attachments
Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 29th May 2012 05:39
Say, if you END your program inside the loop, does it even do the cleanup code?
Marl
12
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 29th May 2012 06:16 Edited at: 29th May 2012 06:18
Quote: "Say, if you END your program inside the loop, does it even do the cleanup code?"

Well spotted Rich.

She did a Switch (obscure Matrix reference) (http://en.wikipedia.org/wiki/List_of_minor_characters_in_the_Matrix_series#Switch)

She got an end when what she needed was an exit
Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 29th May 2012 07:27 Edited at: 29th May 2012 07:30
Good one, Marl!

Here's another example of using SetImageMask()

Save this image as MyImg.png in the media folder. (It includes the mask AND the bricks together, the code splits them)



Attachments

Login to view attachments
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 29th May 2012 10:38
Some great examples guys, thanks for sharing!

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 29th May 2012 17:39
You are so right Rich.

Yup, Marl, it should have been 'exit'.

I had grabbed the print/touch bits from another piece of test code that used no media and didn't think to change it.

'Copy/Paste/Edit' can be our friend, if your remember the 'edit' part.

Cheers,
Ancient Lady

Login to post a reply

Server time is: 2024-04-18 21:43:13
Your offset time is: 2024-04-18 21:43:13