Advanced animations GDI/DX Screen Saver written in VB6-VBForums
Results 1 to 2 of 2

Thread: Advanced animations GDI/DX Screen Saver written in VB6

Threaded View

  1. #1

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    4,987

    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.

    • Run the project


    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.

    Config

    You can do some small modifications in the Form_Load event of FrmMain.frm:-
    Code:
    Private Sub Form_Load()
        Load FrmPlayGround
    '    FrmPlayGround.Show
            
        SetSoundOn
        'Set AllCreatures.CustomBackGround = LoadPicture(App.Path + "\backgrounds\fantasy-landscape01.jpg")
        'AllCreatures.DarkenBackground 100
        
        Set AllCreatures.CustomBackground = GetWallPaper
        
        Set pvtAllCre = AllCreatures
        
        With AllCreatures
            .Renderer = GE_GDI
            .App_hWnd = Me.hwnd
            .Output_hWnd = GetDesktop_hwnd
            '.MaxPopulation = 5
            .LightningOn = True
        End With
        
    End Sub
    • 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.


    Final Words

    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.
    So enjoy.

    Download
    VB - Desktop Animations.zip - 30.50MB
    Last edited by Niya; Apr 13th, 2014 at 01:00 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.