(C++) Irrlicht Skeleton App - All Users

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
Post Reply
Conquistador
Posts: 340
Joined: Wed Sep 28, 2005 4:38 pm
Location: Canada, Eh!

(C++) Irrlicht Skeleton App - All Users

Post by Conquistador »

Here's a working skeleton app that I use as a start point for my projects. Remember to set the include path for irrlicht.h!

Code: Select all

#include <irrlicht.h>

// Use namespaces
using namespace irr;
using namespace core;
using namespace video;
using namespace gui;
using namespace io;
using namespace scene;

int main()
{
	// Create a new Irrlicht Device
	IrrlichtDevice* Device = createDevice(
		EDT_OPENGL,                            // Device type
		dimension2d<s32>(800, 600),            // Window dimensions
		24,                                    // Color depth
		false,                                 // Fullscreen
		false,                                 // Stencil buffer
		false);                                // V-sync

	// Retrieve the driver, scene manager, etc
	IVideoDriver* Driver = Device->getVideoDriver();
	ISceneManager* SceneManager = Device->getSceneManager();
	IGUIEnvironment* GUIEnv = Device->getGUIEnvironment();

    // Main loop
    while (Device->run())
    {
        // Start the scene
        Driver->beginScene(true, true, SColor(255, 0, 0, 0));
    
        // Draw everything
        SceneManager->drawAll();
        GUIEnv->drawAll();
    
        // End the scene
        Driver->endScene();
    }

    // Drop the device
    Device->drop();

    return 0;
}
Last edited by Conquistador on Wed Feb 01, 2006 4:19 pm, edited 1 time in total.
Royal Hamilton Light Infantry - http://www.rhli.ca
Paris/Port Dover Pipes'n Drums - http://www.parisdover.ca
Guest

Post by Guest »

is there a reason why you drop the device and return 0 twice?
RLG unlogged

Post by RLG unlogged »

I'm thinking that was a copy and paste error. Decent basics, n00bs will love you!
Quall
Posts: 154
Joined: Mon Mar 07, 2005 10:16 pm

Post by Quall »

lol, great forum idea btw. The key input thread of the bug reports forum should be moved here.
Conquistador
Posts: 340
Joined: Wed Sep 28, 2005 4:38 pm
Location: Canada, Eh!

Post by Conquistador »

@GFX: That was a paste error, my bad. We's all human :D
@Quall: Yes, I think that's a good idea, I'll make the post soon.
Royal Hamilton Light Infantry - http://www.rhli.ca
Paris/Port Dover Pipes'n Drums - http://www.parisdover.ca
hellbound
Posts: 51
Joined: Sat Jun 24, 2006 7:39 am

Post by hellbound »

opengl is not as good as direct3d (i'm talking about the irrlicht implementation) ... you should change it to direct3d because some beginners might be frustrated that it is not as fast, etc
dawasw
Posts: 357
Joined: Tue Aug 10, 2004 4:39 pm
Location: Poland

Post by dawasw »

hellbound, on every system I tried Irrlicht (I have 3 at home) OpenGL in irrlicht is a way much faster tham Direct3d.

Futhermore Direct3d gives me many bugs in rendering 3d objects and stuff.

So my adivce is to use OpenGL from a start.
hellbound
Posts: 51
Joined: Sat Jun 24, 2006 7:39 am

Post by hellbound »

mmm... weird... i changed the grass node demo to d3d 9 and it worked two times faster , without any bugs...

a... btw... by using direct3d are there bugs with heightmaps - i mean when you get further the heightmap looses some complexity?
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

Very cool contribution! If only I had run into it 2 years ago!!! :(
hehehe, just kidding, I survived after all.

I agree with RLG unlogged, noobs will love it! :wink:
hxhieu
Posts: 4
Joined: Thu Jun 29, 2006 1:26 am

Post by hxhieu »

Its giving compiling error but its all ok when you add

Code: Select all

#pragma comment(lib, "Irrlicht.lib") ;
Correct me if I am wrong
Post Reply