UBBFriend: Email This Page to Someone!
  Computer Workshop User Forums
  EZGUI Source code
  Layers animation on desktop using EZGUI

Post New Topic  Post A Reply
profile | register | preferences | faq | search

next newest topic | next oldest topic
Author Topic:   Layers animation on desktop using EZGUI
Chris Boss
Administrator
posted 09-26-2008 01:58 PM     Click Here to See the Profile for Chris Boss     Edit/Delete Message Reply w/Quote
Here is an example of using the layered window feature of Windows XP or Vista to do some animation on the destop.

Window Layering allows Windows to make a Form appear transparent over other windows. You can define a transparent color or alphablend the form.

By using the S (Splash) property for a form, you display a form with no broders. Then create a Canvas control the same size as the form and you now have a work area for animation which take advantage of the Windows layering feature.

The demo animates sprites on a Canvas control. The form uses EZ_SetFormAttrEx to define the layering options. The Canvas background color is considered the transparent color for layering. The sprites are drawn without antialiasing, since you can't antialias to the desktop using this technique.

You can download the demo here:

http://cwsof.com/ezlayer3.zip

Unzip the file into its own folder.

Warning: The ezgui40.dll runtime is compressed in this file (using UPX), so don't let it overwrite your runtimes in the ezgui folders.

[This message has been edited by Chris Boss (edited 10-10-2008).]

Chris Boss
Administrator
posted 09-26-2008 02:03 PM     Click Here to See the Profile for Chris Boss     Edit/Delete Message Reply w/Quote
The source code is in the zip file.

Chris Boss
Administrator
posted 09-26-2008 02:13 PM     Click Here to See the Profile for Chris Boss     Edit/Delete Message Reply w/Quote
This is the key code in the forms event routine which sets the layer effect:

code:



SUB SFORM_Events(CID&, CMsg&, CVal&, Cancel&)
TestKeys CMsg&, CVal&
SELECT CASE CID&
CASE %EZ_Window
SELECT CASE CMsg&
CASE %EZ_GameLoop
SpriteDraw 0, CVal&
CASE %EZ_Loading
CASE %EZ_Loaded
EZ_SetFormAttrEx "SForm", EZ_ColorVal(8,0),0,"T"
CASE %EZ_Started
RunSprites
CASE %EZ_NoFocus
EZ_SetFormAttrEx "SForm", EZ_ColorVal(8,0),25,"TA"
CASE %EZ_Focus
EZ_SetFormAttrEx "SForm", EZ_ColorVal(8,0),0,"T"
CASE %EZ_Close
CASE ELSE
END SELECT
CASE ELSE
END SELECT
END SUB

Chris Boss
Administrator
posted 10-10-2008 08:38 PM     Click Here to See the Profile for Chris Boss     Edit/Delete Message Reply w/Quote
I updated this Demo!

It now works full screen, uses 18 sprites and animates the sprites using flips (you can animate sprites using multiple frames for realism).

I didn't have a chance to create a multiframed bitmap for the sprites yet, but when I do I will update this demo.

I also found that running full screen and with a layered window, updating each sprite one at a time is actually faster, than updating the entire screen at once (which requires a complex region).

This demo is quite fast.

All times are EST (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply
Hop to:

Contact Us | Computer Workshop ( EZGUI ) Home Page

Copyright 2000 to 2007 Christopher R. Boss

Powered by: Ultimate Bulletin Board, Version 5.44
© Infopop Corporation (formerly Madrona Park, Inc.), 1998 - 2000.