Jump to content

Recommended Posts

Posted

Hello Community,

 

is there any documentation for the VB.net wrapper?

 

with little examples to use camera commands or other important functions?

I'm using Leadwerks engine 2.5 and Project builder with VB.net project creator.

 

it would be great if there is such a thing.

Please pm me or reply here.

 

Cheers,

Dennis

Posted

It should be the same as the C++ tutorials, just add "LE." in front of all engine commands.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Posted

The sample generated when using LEBuilder should give you a hint.

As Metatron says, its just a matter of adding LE. in front of the commands.

 

Here is the sample generated by LEBuilder.

 

 

Imports LeadwerksEngine

Module test

   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 = "test"

       ' 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

 

 

Hmm.. there seems to be a syntax color error in the

 tag in this board for VB code.

Parts of the code get colored green as comments while they are not.

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

Posted

Hmm.. there seems to be a syntax color error in the code tag in this board for VB code.

Parts of the code get colored green as comments while they are not.

 

just end your commented parts with a comma as well... like so:

       ' 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

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Posted

thanks guys.

is there also a possibility to hide the very annoying command prompt window?

regards,

I don't remember currently, but may be you can avoid the prompt using a Form application instead of Console application, though I think it isn't included a template for that but you can easily do that, just try to create a new Form application project, add the reference to LE.NET.dll (it is in the SDK folder) and put the example code in the Program.Start (I don't remember if it's the same as C#). As mentioned, I don't remember if it will avoid the console prompt, because it is created by the engine itself.

?? FRANCESCO CROCETTI ??

http://skaredcreations.com

Posted

I don't remember currently, but may be you can avoid the prompt using a Form application instead of Console application, though I think it isn't included a template for that but you can easily do that, just try to create a new Form application project, add the reference to LE.NET.dll (it is in the SDK folder) and put the example code in the Program.Start (I don't remember if it's the same as C#). As mentioned, I don't remember if it will avoid the console prompt, because it is created by the engine itself.

 

thanks will try tomorrow, do some more of you guys have that annoying command prompt window?

 

Cheers

Posted

With the standard project setup we pretty much all do I thnk. At least in C++ you do as well. I don't mind it too much tbh because I use it for debugging.

STS - Scarlet Thread Studios

AKA: Engineer Ken

 

Fact: Game Development is hard... very bloody hard.. If you are not prepared to accept that.. Please give up now!

Posted

The command-prompt window can be enabled/disabled by setting in your IDE windows/console app mode.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Posted

thanks will try tomorrow, do some more of you guys have that annoying command prompt window?

 

Cheers

Right click your project. Select "Properties...". In "Output type", select "Windows Application" instead of "Console Application".

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.

×
×
  • Create New...