Create a new module project in Visual Basic .Net and then paste this code into your empty source file. Make sure to reference irrlicht.Net.dll
This program should execute and show a white box at an angle, by pressing any key a VB message box will pop up with the id of the key.
Code: Select all
Imports Irrlicht
Imports Irrlicht.Video
Imports Irrlicht.Core
Imports Irrlicht.Scene
Module Module1
Sub main()
Dim device As New IrrlichtDevice(Irrlicht.Video.DriverType.OPENGL) ' Start the Engine
''' Setup Event Receiver '''
device.EventReceiver = New MyEventReceiver
''' Window Settings '''
device.ResizeAble = True
device.WindowCaption = "Event Test"
''' Setup Main Camera '''
Dim cam As ICameraSceneNode = device.SceneManager.AddCameraSceneNode(Nothing, New Vector3D(0, 10, 0), New Vector3D(5, 0, 0), -1)
''' Create Simple Block Node '''
Dim node As ISceneNode = device.SceneManager.AddTestSceneNode(15, Nothing, -1, New Vector3D(30, -15, 0))
node.Scale = New Vector3D(0.5, 0.5, 0.5)
''' FPS '''
Dim fps As Integer = 0
While device.Run() = True
If device.WindowActive Then
device.VideoDriver.BeginScene(True, True, New Color(0, 100, 100, 100))
device.SceneManager.DrawAll()
device.VideoDriver.EndScene()
''' Update the FPS Counter in the Window Bar '''
If (fps <> device.VideoDriver.FPS) Then
fps = device.VideoDriver.FPS
device.WindowCaption = "Event Test [" + device.VideoDriver.Name + "] fps:" + fps.ToString
End If
End If
End While
End Sub
End Module
Public Class MyEventReceiver
Implements IEventReceiver
Public Function OnEvent(ByVal e As [Event]) As Boolean Implements IEventReceiver.OnEvent
If e.Type = EventType.KeyInput Then
MsgBox(e.Key())
Return True
End If
Return False
End Function
End Class