All pastes #355860 Raw Edit

VB Tutorial 1

public text v1 · immutable
·published 2007-02-14 19:55 UTC
rendered paste body
Imports IrrlichtNETCP
Module main
    Sub main()
        'Declare Device Settings. I declared them like this for neatness.
        'Driver type
        Dim dtDriver As DriverType = DriverType.Direct3D9
        'Screen Resolution
        Dim dmRes As New Dimension2D(1280, 1024)
        'Colour Depth
        Dim intBits As Integer = 32
        'Fullscreen
        Dim boolFullScreen As Boolean = True
        'Stencil
        Dim boolStencil As Boolean = True
        'Vsync
        Dim boolVSync As Boolean = True
        'Antialiasing
        Dim boolAntialias As Boolean = True

        'create the device
        Dim device As New IrrlichtDevice(dtDriver, dmRes, intBits, boolFullScreen, boolStencil, boolVSync, boolAntialias)

        device.Resizeable = True
        device.WindowCaption = "Hello World Irrlicht NET CP VB Conversion"
        'change the working directory to the media directory.
        'I copied the media directory into my bin folder.
        device.FileSystem.WorkingDirectory = "media"

        Dim driver As VideoDriver = device.VideoDriver
        Dim smgr As SceneManager = device.SceneManager
        Dim guienv As GUIEnvironment = device.GUIEnvironment

        guienv.AddStaticText("Hello World! Welcome to the Irrlicht NET CP VB Conversion!", _
            New Rect(New Position2D(10, 10), New Dimension2D(200, 22)), True, True, guienv.RootElement, -1, False)

        Dim mesh As AnimatedMesh = smgr.GetMesh("sydney.md2")
        Dim node As AnimatedMeshSceneNode = smgr.AddAnimatedMeshSceneNode(mesh)



        If Not node.Null Then
            node.SetMaterialFlag(MaterialFlag.Lighting, False)
            node.SetFrameLoop(0, 30)
            node.SetMaterialTexture(0, driver.GetTexture("sydney.bmp"))
        End If

        Dim cam As CameraSceneNode = smgr.AddCameraSceneNode(smgr.RootSceneNode)
        cam.Position = New Vector3D(0, 30, -40)
        cam.Target = New Vector3D(0, 5, 0)

        Do While device.Run()
            driver.BeginScene(True, True, New Color(255, 100, 101, 140))
            smgr.DrawAll()
            guienv.DrawAll()
            driver.EndScene()
        Loop
        'In the end, delete the Irrlicht device.
        device.Dispose()
    End Sub
End Module