Nov 22nd, 2011, 03:01 AM
Advanced animations GDI/DX Screen Saver written in VB6
Many years ago, I began learning about graphics based programming in Windows and what started as simple functions to do basic graphic related tasks culminated into a journey into coding animation, movement and special effects. I've had it for many years on my HD just doing nothing and I've decided to release so others may learn from it before I lose it in a HD crash or something.
What is it ?
One of the project files loads it as a screen saver but there is also a project file that animates it on the desktop. It loads a form with several buttons with the names of several creatures. Pressing these buttons will spawn the respective creatures and in the case where creatures are different they will fight with each other using projectiles. There are a number of effects you would see using alpha-blending and transparency like glow effects and lightning. There are also sound effects and music as well.
What is needed ?
You will need Visual Basic 6 with its latest service packs installed.
Also to get it running:-
- Extract the folder from the Zip file onto your Hard Drive
- Go into the FMOD folder and copy the DLL within to the System32 or System folder of your Windows folder.
- Go into the DX7 and 8 and run reg.bat. This registers the DirectX type libraries. Please note that this step may be unnecessary in Windows XP. Windows 7 and Windows Vista do not come with these type libraries.
- Now in the main folder load up "FlyingCreatures.vbp" into VB6. There are other project files in that folder, one of which is the screen saver. You can try that one as well but I recommend using the one I quoted.
At this point the form would show up with the buttons. Press them and minimize any application that may be obscuring your desktop to see the action.
You can do some small modifications in the Form_Load event of FrmMain.frm:-
Private Sub Form_Load()
'Set AllCreatures.CustomBackGround = LoadPicture(App.Path + "\backgrounds\fantasy-landscape01.jpg")
Set AllCreatures.CustomBackground = GetWallPaper
Set pvtAllCre = AllCreatures
.Renderer = GE_GDI
.App_hWnd = Me.hwnd
.Output_hWnd = GetDesktop_hwnd
'.MaxPopulation = 5
.LightningOn = True
- You can turn the sound off by changing "SetSoundOn" to "SetSoundOff"
- You can disable the lightning by setting .LightningOn to False
- You can change the renderer from using the slower GDI to the faster DirectX by changing .Renderer from "GE_GDI" to "GE_D3d". Note: For some reason the DirectX renderer doesnt work in Windows 7 for me. The last time it worked I was running it under Windows XP years ago. Its been years since ive actually played with this code so I cant really say whats wrong right off the bat. So if you are running Windows 7 I recommend using the GDI renderer if you cant get it to work with DX.
I just wanted to get this out because its just rotting away on my HD and it has all kinds of cool stuff in it. Use it to learn or you can even salvage the functions from it for your own use if you desire.
I commented it as much as I could but I can barely remember how the whole thing really works since it was many many years ago that I wrote this so dont expect me to be able to tell you how to make detailed changes to it. I can however explain the concepts behind various aspects of it like movement, special effects and such. You never really forget those. I just cant recall what certain routines do in detail anymore.
Also there are portions of this written in C++ because VB6 was just too slow to perform certain tasks. Its mainly image processing code for stuff like the glow effects for the GDI renderer.
VB - Desktop Animations.zip - 30.50MB
Click Here to Expand Forum to Full Width