Codeblocks help (Newton + build errors..)

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
Spanky
Posts: 5
Joined: Wed Jul 20, 2005 1:10 pm

Codeblocks help (Newton + build errors..)

Post by Spanky »

I've searched the forums and looked at the tutorials, but can't figure out how to properly integrate NewtonSDK int codeblocks!! If someone could explain or point me in the right direction? Thanks

Also, I've noticed that when I build my project codeblocks throws up errors in ISceneNode.h ?? The test app still compiles and runs, im just wondering...

Heres the test app, basically playing around on the terrain tut...

Code: Select all

#include <irrlicht.h>
#include <iostream.h>

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

#pragma comment(lib, "Irrlicht.lib")

int main(int argc, char** argv)
{
	IrrlichtDevice *device =
		createDevice(EDT_OPENGL, dimension2d<s32>(640, 480), 16,
			false, false, false, 0);

	device->setWindowCaption(L"Terrain");

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

    driver->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT, true);

    //Keys

    SKeyMap keyMap[8];
                 keyMap[0].Action = EKA_MOVE_FORWARD;
                 keyMap[0].KeyCode = KEY_UP;
                 keyMap[1].Action = EKA_MOVE_FORWARD;
                 keyMap[1].KeyCode = KEY_KEY_W;

                 keyMap[2].Action = EKA_MOVE_BACKWARD;
                 keyMap[2].KeyCode = KEY_DOWN;
                 keyMap[3].Action = EKA_MOVE_BACKWARD;
                 keyMap[3].KeyCode = KEY_KEY_S;

                 keyMap[4].Action = EKA_STRAFE_LEFT;
                 keyMap[4].KeyCode = KEY_LEFT;
                 keyMap[5].Action = EKA_STRAFE_LEFT;
                 keyMap[5].KeyCode = KEY_KEY_A;

                 keyMap[6].Action = EKA_STRAFE_RIGHT;
                 keyMap[6].KeyCode = KEY_RIGHT;
                 keyMap[7].Action = EKA_STRAFE_RIGHT;
                 keyMap[7].KeyCode = KEY_KEY_D;



    //camera
    scene::ICameraSceneNode* camera =
        smgr->addCameraSceneNodeFPS(0,100.0f,1200.0f,-1,keyMap,8);


    camera->setPosition(core::vector3df(1900*2,255*2,3700*2));
    camera->setTarget(core::vector3df(2397*2,343*2,2700*2));
    camera->setFarValue(12000.0f);

    //Kill cursor
    device->getCursorControl()->setVisible(false);

    //render
    scene::ITerrainSceneNode* terrain = smgr->addTerrainSceneNode(
        "media/terrain-heightmap.bmp");

    terrain->setScale(core::vector3df(40, 4.4f, 40));
    terrain->setMaterialFlag(video::EMF_LIGHTING, false);

    terrain->setMaterialTexture(0, driver->getTexture(
        "media/terrain-texture.jpg"));
    terrain->setMaterialTexture(1, driver->getTexture(
        "media/detailmap3.jpg"));

    terrain->setMaterialType(video::EMT_DETAIL_MAP);
    terrain->scaleTexture(1.0f, 20.0f);

    //FOG
    terrain->setMaterialFlag(video::EMF_FOG_ENABLE, true);
    driver->setFog(video::SColor(32, 160, 192, 212), true, 200.f, 1000.f, .005f, false, true);
    driver->setAmbientLight(video::SColorf(.3f, .3f, .3f, 1.f));

    // create triangle selector for the terrain
    scene::ITriangleSelector* selector =
        smgr->createTerrainTriangleSelector(terrain, 0);
    terrain->setTriangleSelector(selector);
    selector->drop();

    // create collision response animator and attach it to the camera
    scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(
        selector, camera, core::vector3df(60,100,60),
        core::vector3df(0,0,0),
        core::vector3df(0,50,0));
    camera->addAnimator(anim);
        anim->drop();

    // create skybox
    driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, false);

    smgr->addSkyBoxSceneNode(
        driver->getTexture("media/irrlicht2_up.jpg"),
        driver->getTexture("media/irrlicht2_dn.jpg"),
        driver->getTexture("media/irrlicht2_lf.jpg"),
        driver->getTexture("media/irrlicht2_rt.jpg"),
        driver->getTexture("media/irrlicht2_ft.jpg"),
        driver->getTexture("media/irrlicht2_bk.jpg"));

    driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, true);

    int lastFPS = -1;

	while(device->run())
	if (device->isWindowActive())
	{
		driver->beginScene(true, true, 0 );

		smgr->drawAll();
		env->drawAll();

		driver->endScene();

		// display frames per second in window title
		int fps = driver->getFPS();

		if (lastFPS != fps)
		{
			core::stringw str
			   = L"Terrain Renderer - Irrlicht Engine [";
			str += driver->getName();
			str += "] FPS:";
			str += fps;
			device->setWindowCaption(str.c_str());
			lastFPS = fps;
		}
	}

	device->drop();

	return 0;

}
Of all the things i've lost, i miss my mind the most...
Spanky
Posts: 5
Joined: Wed Jul 20, 2005 1:10 pm

Post by Spanky »

OK, I think i got it.

Go Project - build options
Directories Tab
Add the neccesary files to compiler and linker tabs.
Thats it (I think.. ;) )
Of all the things i've lost, i miss my mind the most...
Post Reply