-
Notifications
You must be signed in to change notification settings - Fork 2
Home
PuppyBreath is an easy to use and robust game engine framework for use in Windows Forms applications.
A basic walkthrough of creating a simple game can be found in the MSDN Forums: How To: Get Started with Video Game Development in Visual Basic .Net using the PuppyBreath framework
Install PuppyBreath from NuGet
Build the application to ensure that the ToolBox is populated with custom controls and then drag an instance of RenderCanvas from the ToolBox onto the Form1 designer instance in the editor.
See ReadMe.txt for current guidance as of V.0.4.0
[Obsolete] Use the following boilerplate code to replace the default Form1 code:
`Imports PuppyBreath
Public Class Form1 Private gameScenes As New Dictionary(Of String, GameScene)
Private Async Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
With RenderCanvas1.GetGameInput
.GetKeyMap("Up").AddRange({Keys.W, Keys.Up, Keys.NumPad8})
.GetKeyMap("Down").AddRange({Keys.S, Keys.Down, Keys.NumPad2})
.GetKeyMap("Left").AddRange({Keys.A, Keys.Left, Keys.NumPad4})
.GetKeyMap("Right").AddRange({Keys.D, Keys.Right, Keys.NumPad6})
End With
gameScenes("main") = CreateMainScene()
RenderCanvas1.ChangeScene(gameScenes("main"))
Await RenderCanvas1.BeginAsync()
End Sub
Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
RenderCanvas1.StopRenderer()
If RenderCanvas1.IsRunning Then e.Cancel = True
End Sub
Private Sub RenderCanvas1_RenderingComplete(sender As Object, e As EventArgs) Handles RenderCanvas1.RenderingComplete
Close()
End Sub
Private Sub Form1_Deactivate(sender As Object, e As EventArgs) Handles Me.Deactivate
RenderCanvas1.Pause()
End Sub
Private Sub Form1_Activated(sender As Object, e As EventArgs) Handles Me.Activated
RenderCanvas1.Resume()
End Sub
Private Function CreateMainScene() As GameScene
Dim scene As New GameScene
Return scene
End Function
End Class`
And just like that you're ready to start writing your game! Create GameObjects and Sprites and add them to the scene in the CreateMainScene method.
Your application can generally handle image assets in any manner because Sprite objects take a reference to System.Drawing.Image instances, however, audio assets must be located in a "Resources" folder at the root of the executable. Because of this it is best practice to store image assets in the same folder. You may choose to use the project resources and embed the asset files in the executable, however, audio files must be set to Copy to Output Directory because the audio player can only load the file by file path.
Until/unless an asset pipeline is added to the engine, it will remain best practice to add files to a folder called Resources within the project and set all files therein to Copy to Output Directory = Copy If Newer.