Von04 Posted January 23, 2012 Share Posted January 23, 2012 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: Initialize(); RegisterAbstractPath("Your SDK Location Here"); before the line: InitializeComponent(); 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. Enjoy! Click here to download this file 2 Quote 3d world studio. 3ds Max 8. GTX 260. Visual Studio 2010. Dual Core 2.6 Mhz processor. Link to comment Share on other sites More sharing options...
Pixel Perfect Posted January 23, 2012 Share Posted January 23, 2012 Many thanks for this and all the work you've put into it. Will give me a lot more flexibility for making tools. Nice work Quote Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++ Link to comment Share on other sites More sharing options...
Recommended Posts
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.