Jump to content

VB.NET


wayneg
 Share

Recommended Posts

  • 1 month later...

Maybe I'm not doing this right ?

 

I have Visual Studio 2008 Professional Installed.

I downloaded VB2010 Express.

Ran LEbuilder and it created the project and auto launched 2008, ended that.

Went to the project folder and opened leproject1.vbproj witn vb2010, it then wants to do a conversion, afterwords list the following errors:

 

Warning 1 The parent file, 'app.myapp', for file 'app\Application.Designer.vb' cannot be found in the project file. leproject1

Warning 2 A custom tool 'MyApplicationCodeGenerator' is associated with file 'app\Application.myapp', but the output of the custom tool was not found in the project. You may try re-running the custom tool by right-clicking on the file in the Solution Explorer and choosing Run Custom Tool.

Error 3 'Sub Main' was not found in 'leproject1.leproject1'. leproject1

Error 4 Identifier expected. C:\leproject1\leproject1.vb 3 8 leproject1

 

Imports LeadwerksEngine

Module @(wayne)

   Sub UpdateCallback(ByVal ent As TEntity)
       LE.TurnEntity(ent, New TVec3(LE.AppSpeed() * 0.5F))
   End Sub

   Sub ErrOut(ByVal message As String)
       Console.WriteLine(message)
   End Sub

   Sub Main()

       Dim ScreenWidth As Integer = 800
       Dim ScreenHeight As Integer = 800
       Dim MediaDir As String = "C:/Program Files/Leadwerks Engine SDK"
       Dim AppTitle As String = "leproject1"

       ' Initialize
       LE.Initialize()
       LE.SetAppTitle(AppTitle)
       LE.RegisterAbstractPath(MediaDir)

       ' Set graphics mode        
       If LE.Graphics(ScreenWidth, ScreenHeight) = 0 Then
           ErrOut("Failed to set graphics mode.")
           Return
       End If


       ' Create framework object and set it to a global object so other scripts can access it
       Dim fw As LeadwerksEngine.TFramework = LE.CreateFramework()
       If fw.IsValid = False Then
           ErrOut("Failed to initialize engine.")
           Return
       End If

       ' Set Lua framework object        
       LE.SetGlobalObject("fw", fw.Handle)

       ' Set Lua framework variable        
       Dim lua As Object = LE.GetLuaState()
       LE.lua_pushobject(lua, fw.Handle)
       LE.lua_setglobal(lua, "fw")
       LE.lua_pop(lua, 1)

       ' Get framework main camera        
       Dim camera As LeadwerksEngine.TCamera = LE.GetLayerCamera(LE.GetFrameworkLayer(0))
       LE.PositionEntity(camera, New LeadwerksEngine.TVec3(0, 0, -2))

       ' Create cube
       Dim material As LeadwerksEngine.TMaterial = LE.LoadMaterial("abstract::cobblestones.mat")
       Dim mesh As LeadwerksEngine.TMesh = LE.CreateCube()
       LE.PaintEntity(mesh, material)

       ' Apply Callback
       Dim cb As LE.EntityUpdateWorldCallback = New LE.EntityUpdateWorldCallback(AddressOf UpdateCallback)
       LE.SetEntityCallback(mesh.Entity, cb)

       ' Create ground
       Dim ground As LeadwerksEngine.TMesh = LE.CreateCube()
       LE.ScaleEntity(ground, New TVec3(10, 1, 10))
       LE.PositionEntity(ground, New TVec3(0, -2, 0))
       LE.PaintEntity(ground, material)

       ' Add some light
       Dim light As TLight = LE.CreateDirectionalLight()
       LE.RotateEntity(light, New TVec3(45, 45, 45))

       ' Spin cube until user hits Escape
       While (LE.KeyHit() = False And LE.AppTerminate() = False)
           If LE.AppSuspended() = False Then

               LE.UpdateFramework()
               LE.RenderFramework()

               LE.DrawText("Visual Basic LE.NET", 0, 20)
               LE.Flip(0)

           End If
       End While
       LE.Terminate()
   End Sub

End Module

post-115-0-73321800-1317253145_thumb.jpg

Link to comment
Share on other sites

I can't repeat your problem.

I can see that your module name seems weird. @(wayne) will give problems.

 

Here is my output when using LEBuilder and VB.NET. Project name was set to 'vbtest'

 

Imports LeadwerksEngine

Module vbtest

   Sub UpdateCallback(ent As TEntity)
       LE.TurnEntity(ent, New TVec3(LE.AppSpeed() * 0.5F))
   End Sub

Sub ErrOut(ByVal message As String)
       Console.WriteLine(message)
   End Sub

   Sub Main()

       Dim ScreenWidth As Integer = 800
       Dim ScreenHeight As Integer = 800
       Dim MediaDir As String = "C:/GameDevel"
       Dim AppTitle As String = "vbtest"

       ' Initialize'
       LE.Initialize()
       LE.SetAppTitle(AppTitle)
       LE.RegisterAbstractPath(MediaDir)

       ' Set graphics mode'        
       If LE.Graphics(ScreenWidth, ScreenHeight) = 0 Then
           ErrOut("Failed to set graphics mode.")
           Return
       End If


       ' Create framework object and set it to a global object so other scripts can access it'
       Dim fw As LeadwerksEngine.TFramework = LE.CreateFramework()
       If fw.IsValid = False Then
           ErrOut("Failed to initialize engine.")
           Return
       End If

       ' Set Lua framework object  '      
       LE.SetGlobalObject("fw", fw.Handle)

       ' Set Lua framework variable        
       Dim lua As Object = LE.GetLuaState()
       LE.lua_pushobject(lua, fw.Handle)
       LE.lua_setglobal(lua, "fw")
       LE.lua_pop(lua, 1)

       ' Get framework main camera '       
       Dim camera As LeadwerksEngine.TCamera = LE.GetLayerCamera(LE.GetFrameworkLayer(0))
       LE.PositionEntity(camera, New LeadwerksEngine.TVec3(0, 0, -2))

       ' Create cube
       Dim material As LeadwerksEngine.TMaterial = LE.LoadMaterial( "abstract::cobblestones.mat" )
       Dim mesh As LeadwerksEngine.TMesh = LE.CreateCube()
       LE.PaintEntity(mesh, material)

       ' Apply Callback'
       Dim cb As LE.EntityUpdateWorldCallback = New LE.EntityUpdateWorldCallback(AddressOf UpdateCallback)
       LE.SetEntityCallback(mesh.Entity, cb)

       ' Create ground'
       Dim ground As LeadwerksEngine.TMesh = LE.CreateCube()
       LE.ScaleEntity(ground, New TVec3(10, 1, 10))
       LE.PositionEntity(ground, New TVec3(0, -2, 0))
       LE.PaintEntity(ground, material)

       ' Add some light'
       Dim light As TLight = LE.CreateDirectionalLight()
       LE.RotateEntity(light, New TVec3(45, 45, 45))

       ' Spin cube until user hits Escape'
       While (LE.KeyHit() = False And LE.AppTerminate() = False)
           If LE.AppSuspended() = False Then

               LE.UpdateFramework()
               LE.RenderFramework()

               LE.DrawText("Visual Basic LE.NET", 0, 20)
			LE.Flip(0)

           End If
       End While
	LE.Terminate()
   End Sub

End Module

Roland Strålberg
Website: https://rstralberg.com

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...