View Single Post
Old 21 November 2005, 12:39   #15
AGF [PC] Games Developer
DaphydTheBard's Avatar
Join Date: Nov 2005
Location: Birmingham, UK
Age: 39
Posts: 58
Send a message via MSN to DaphydTheBard
'Anarchy Engine - RenderDevice Class

Below is the source code for the primary class, ae_RenderDevice.

To use my engine in your VB project, you need to set references to DirectX7, and DirectX8, with the reference to DirectX7 FIRST.

Save the code below into a class in your project and call it clsAE_RenderDevice (It's IMPERATIVE that the class names' are correct as they cross-reference each other!).

Then, to use the class in your project, declare it as follows:

Private aeRD As New clsAE_RenderDevice

To setup the display, call the following function from your start-up code:

aeRD.Create Me.hWnd, 640, 480, False

The first parameter is the Handle of the Form (or PictureBox) that you are using for your display.

Second and Third parameters are screen dimensions, and last parameter is a boolean indicating if the display should be full-screen (TRUE) or windowed (FALSE).


Calling this function in your Forms' OnLoad event will lead to problems, as the form is not yet visible. What I do is have a timer on the form, which fires once only after the form is loaded, that sets up the display, and then switches itself off.

You can hide the Windows' Mouse Pointer like this:

aeRD.CursorVisible = False

When you're program is finished, you can clean up as follows:

aeRD.CursorVisible = True

This will switch the display back to windows (if in fullscreen mode) and will show the cursor again.

Basic rendering output to the display is done as follows:


'Draw your non 3d sprites here, including background, etc.


'Then draw your 3d sprites, and special effects, etc.


That's basically it for this class - there is further functionality, such as the ability to GET and SET pixels (which is quite fast as it automates bitmap surface locking as and when needed).

The Flip() function can also take optional parameters to do split-screen gaming and earthquake effects. I'll cover these more later on, when I post some example code.
DaphydTheBard is offline  
Page generated in 0.06187 seconds with 9 queries