Jump to content

Custom control for rendering leadwerks and c++/cli windows forms.


Recommended Posts

File Name: Custom control for rendering leadwerks and c++/cli windows forms.

File Submitter: Von04

File Submitted: 22 Jan 2012

File Category: Tools


This is a custom control which renders leadwerks to custom control using a custom buffer and a c++ window form application. It has been tested on 2008 and 2010 c++ express, 2010 visual studio professional and c# all versions.


How to use:


1. Create a windows form application.


2. Add the LEControl.Dll file to your projects release/debug folder, whichever one your running.


3. Add Shaders.Pak, Scripts Folder, Engine.dll, Engine.Cpp, and Engine.h to your project directory.


4. Go to the Form designer and open up the Toolbox.


5. Right-click and select Choose Items.


6. After the Choose Items dialog appears (usually takes awhile) selecte the Browse... button.


7. Navigate to your projects Release/Debug folder and select LEControl.Dll.


8. A new control should now appear called LEControl. Click OK. LEControl should now be added to your toolbox.


9. Drag a LEControl onto your windows form. In the example, I renamed from lecontrol1 to Window.


10. Go to the new controls events (click the lightning bolt icon) and double click the Paint event.


11. The newly created function is now your leadwerks rendering loop. Add your code here that you would normally have inside your main loop. There is no need to add the actual rendering code, because the control sets that up automatically. Just enter code for modifying entites e.g.


12. Go back to the control events and double-click the Resize event. Inside the newly created function add the line: Window->ResizeBuffers(); This is assuming that you renamed your control Window. Otherwise add the line: lecontrol1->ResizeBuffers(); This will resize the custom buffer to match the size of the control.


13. See the Example.Cpp file to see how to #include "Engine.Cpp".


14. In your Form1.h file make sure your add #include "Engine.h" at the top of the file.


15. In the Form1 constructor add:


RegisterAbstractPath("Your SDK Location Here");

before the line:



16. After InitializeComponent() add the line:

Window->InitializeLeadwerks(true); // Uses framework

or Window->IntializeLeadwerks(false); // no framework


17. InitializeLeadwerks sets up leadwerks creating world and cameras for you. See the Form1.h file included with the zip pack for an example for accessing the different camera and worlds.


18. Run your form and that should be it.


This control has been tested on c++ 2008 and 2010 express, 2010 Visual Studio Professional, and all years of C#. If you have any suggestions and encounter any bugs please post them here.




Click here to download this file

  • Upvote 2

3d world studio. 3ds Max 8. GTX 260. Visual Studio 2010. Dual Core 2.6 Mhz processor.

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.

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...