This project is read-only.

Getting Started

After downloading and extracting the GdiGaming API zip file to a location on your hard drive, start a new Windows Forms Application project.

Setup the Form

Make a few minor changes to the default Form1 in the designer:
  • Set the FormBorderStyle to Fixed3D
  • Set the MaximizeBox to False
  • Set the Size to 810,630

Add the Assets Folder

Right click the project name in the Solution Explorer and select Add -> New Folder. Name the folder Assets. Now you can add any image or sound files used by the game to this folder by right clicking the folder and selecting Add -> Existing Item.

Add the GdiGaming Components

Next, right-click an item in the ToolBox and select Add Tab. Name the new tab "GdiGaming Components". Right-click this new tab and select "Choose Items...". When the dialog opens, click the Browse button, locate the GdiGaming.dll, and click OK. This will add the GameEngine and RenderCanvas items to the .Net Framework Components tab and should have them checked. Click OK again.

Now the GameEngine and RenderCanvas should be in your ToolBox and you can drag one of each onto Form1.

Configure the Engine and Canvas

Go to the properties for the RenderCanvas and set its Location to 0,0.

Go to the properties for the GameEngine, select its Canvas property and use the DropDown to select RenderCanvas1.

Add the Template Form Code

Now you can go to the Code View for Form1 and paste in the following template code:

Public Class Form1
    Private Sub Form1_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated
    End Sub

    Private Sub Form1_Deactivate(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Deactivate
        If GameEngine1.EngineState = GdiGaming.GameEngineState.Started Then
        End If
    End Sub

    Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        If Not GameEngine1.EngineState = GdiGaming.GameEngineState.Stopped Then
            e.Cancel = True
        End If
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Add the game's initial scene to the engine; replace "ExampleScene" with your custom scene
        GameEngine1.Scenes.Add(New ExampleScene)
    End Sub

    Private Sub GameEngine1_FrameComplete(ByVal sender As Object, ByVal e As GdiGaming.GameEngineEventArgs) Handles GameEngine1.FrameComplete
        'Uncomment the following line to easily monitor the framerate during development:
        'Me.Text = e.Engine.FrameRate.ToString
    End Sub

    Private Sub GameEngine1_GameStopped(ByVal sender As Object, ByVal e As System.EventArgs) Handles GameEngine1.GameStopped
    End Sub
End Class

This basic procedure can be used for each new game and you then only need to modify the Scene objects which are created during Form.Load.

Create Custom Game Objects

Finally begin creating your custom GameObjects and Scenes!

Last edited Dec 29, 2011 at 10:53 PM by ReedKimble, version 4


No comments yet.