Setting up Irrlicht with Delphi 2005

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Specis
Posts: 4
Joined: Wed Jan 12, 2005 9:12 pm
Location: Glasgow - Scotland - UK
Contact:

Setting up Irrlicht with Delphi 2005

Post by Specis »

Ok maybe this has been answered elsewhere but on a search i couldnt find anything,

Im trying to Irrlicht from within Delphi 2005, so im trying to use the .net version and tbh im utterly insure how to include Irrlicht with Delphi.

I know i've probably missed something stupid on my part :) but i thought i would post and ask see if anyone else has got it working yet.
WalterWzK
Posts: 72
Joined: Wed Jan 12, 2005 2:57 pm
Location: Netherlands
Contact:

Post by WalterWzK »

Welcome to the party Specis...

Im a Visual Basic .NET 2005 user and have been here a couple of weeks ago.
First thing before you start is that it will take a few weeks before you can seriously begin developping because the current level of .NET supported code is at 2%... I've had personal contact with Niko (Founder and programmer of the engine) and he told me he is releasing the 0.8 version (upcoming release) at the middle or end of next month.. by then the .NET level of coding rises up to 100 or nearly 100%. Conclusion: if you need it real bad right now you'll have to consider another engine.

But in case your work is just on a non-professional level for education or other purpouses than lets get started:

First thing you have got to do is copy the original irrlicht.dll and the .NET-Wrapper dll into your project folder, next to your binary. Now you'll have to create a reference to the .NET-Wrapper by opening the reference-tab at the right upper corner of your delphi-application (its in a window called Solution Explorer, first click 'My project' and than 'References')
Choose to browse manualy to the required reference and double click the wrapper DLL.

Now create a form or module and at the top place the following code:

Code: Select all

Imports Irrlicht
Imports Irrlicht.Core
Imports Irrlicht.Video
Imports Irrlicht.Scene
Now create a main-sub if you have a blank module, or goto the main-sub if you have a form.

Here you can begin with setting up a device like this:

Code: Select all

Dim Engine As New Irrlicht.IrrlichtDevice(DriverType.OPENGL)
between the code above and below you can configure the engine by setting its windowcaption or stuff like that, and load models. But im sure you can translate the tutorials into .NET just like me...

Just let me give you a little more code below how to run the engine so you can get going:

Code: Select all

  // Start the engine and let the poop hit the fan!
  Engine.Run()

        '3D-Loop this draws all frames one at a time....
        While Engine.Run = True

            'Scene has to be drawn, we'll do that here in the loop
            Engine.VideoDriver.BeginScene(True, True, New Color(0, 0, 0, 0))
            Engine.SceneManager.DrawAll()

            'Wanna draw a 2D Image? Well that has got to be done here:
            '--- Gun Image
                Dim hudGun As ITexture = Engine.VideoDriver.GetTexture(Application.StartupPath & "\data\hud\wpn_rifle.bmp")
                Engine.VideoDriver.MakeColorKeyTexture(hudGun, New Position2D(1, 1))
                Engine.VideoDriver.Draw2DImage(hudGun, New Position2D(Engine.VideoDriver.ScreenSize.Width - 99, Engine.VideoDriver.ScreenSize.Height - 57), New Rect(0, 0, 89, 47), New Color(255, 255, 255, 255), True)

            'Scene has been drawn and we can end it for this frame
            Engine.VideoDriver.EndScene()

            'Wanna have a Realtime FPS as a caption? Try this:
            Engine.WindowCaption = "My Project - FPS: " & engine.VideoDriver.FPS

        End While

        'When we end up here it means that the engine has been stopped
        'So we can clean up the mess and show or main form again
        frmMain.Show()

Good luck mate!
Current Project: Don Salvatore's Mafia
Genre: 3D Shooter \ RTS
Programming Language: VB .NET
Engine: Irrlicht 11 [.NET Wrapper]
Specis
Posts: 4
Joined: Wed Jan 12, 2005 9:12 pm
Location: Glasgow - Scotland - UK
Contact:

Post by Specis »

Couldnt quite understand your method, but tis ok i found another method using the .net assembly import feature of Delphi 2005. i Used that to generate a .pas file for Irrlicht.NET.dll and i can use that happily from within my Delphi projects. But thanx for your help though.

And maybe we can have some input from the Dev's on the correct way to use the .NET dll from within Delphi?
Post Reply