Irrlicht Engine logo

Tutorial: Integrating Newton Physics into Dev-C++ by Philipp Schneider

This small tutorial will explain, how to integrate the Newton Physics SDK into Dev-C++. If you are using Irrlicht Engine, you can do this, after setting up Dev-C++ with Irrlicht, which you find here: http://irrlicht.sourceforge.net/tut_devcpp.html.

Step 1 - Setting Dev-C++ compiler options
Start Dev-C++, and integrate the Irrlicht Engine files, as you can read in the upon tutorial, after starting a new project. Then click Project - Project Options. In the Project Options window click on the 'Parameter' tab, to open the parameter page. Click on 'Add object' (or how its called, under the list of 'Linker'), there you select the Newton LIB file. Search where you installed Newton SDK and go to sdk/dll, there you select Newton.lib. For example this could be C:/Program Files/NewtonSDK/sdk/dll/Newton.lib. 
After that steps, click at 'Directory'-tab in the Project Options window, there click in the sub-tab 'Include Directories'. Enter the include directory to Newton SDK (which is /sdk), that can be for example C:\Program Files\NewtonSDK\sdk.
Now copy the DLL from Newton SDK, either to C:\Windows\System\Newton.dll - depending on windows installation, or copy this DLL from \sdk\dll\Newton.dll to the path, where your project is located (the DLL file can be for example located at: E:\Program Files\NewtonSDK\sdk\dll\Newton.dll). Don't forget to copy the right Irrlicht.dll into the path, too!

Step 2 - Testing and compiling
So far, that Newton SDK is integrated in Dev-C++, we can try to compile. Copy the following source to main.cpp and compile it:

#include <Irrlicht.h>
#include "newton.h"

static NewtonWorld* nWorld;

using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

int main()
{
   nWorld = NewtonCreate (NULL, NULL);
   IrrlichtDevice *device = createDevice(EDT_SOFTWARE,
                            dimension2d<s32>(640,480), false);

   IVideoDriver* driver = device->getVideoDriver();
   ISceneManager* smgr = device->getSceneManager();

   while(device->run())
   {
      driver->beginScene(true, true, video::SColor(0,0,0,0));
      smgr->drawAll();
      driver->endScene();
   }
   device->drop();
   return 0;
}

When it compiles and runs, the integration was successful.
This tutorial gave you only an advice, how to integrate Newton to Dev-C++, so far it doesn't do anything.

For a further tutorial, using Newton with Irrlicht, take a look here: http://irrlicht.sourceforge.net/tut_newton.html.

If there are any questions or notices, feel free to email me: support@pssoftware.net
Written by Philipp Schneider
 

 

 

 


Valid XHTML 1.0! Valid CSS!


Irrlicht Engine and Irrlicht Engine webpage © 2003-2005 by Nikolaus Gebhardt