Results 1 to 5 of 5

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

  1. #1

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    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.

  2. #2

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

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

    Re-uploaded to SkyDrive.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  3. #3
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,223

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

    The screensaver is great, I am using it as an example of GDI animation. Hoping to find it informative.

  4. #4

    Thread Starter
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

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

    Quote Originally Posted by yereverluvinuncleber View Post
    The screensaver is great, I am using it as an example of GDI animation. Hoping to find it informative.
    So you got it running I'm guessing?
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  5. #5
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,223

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

    The screensaver worked without effort but the game does not start. Not yet tried to fix it. I enjoyed what it did and how. It is worth resurrecting. I will use it as a guide for some work that I am attempting.

Posting Permissions

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



Click Here to Expand Forum to Full Width