Some questions about Irrlicht

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
Nonee
Posts: 3
Joined: Sun Aug 03, 2014 3:32 pm

Some questions about Irrlicht

Post by Nonee »

Hello, I wanted to look some 3d video games' programmation (By the way, sorry for my english) and some functions demoralize me.
I want to specify that I searched what I want, but I didn't find anything.
Here we go : my first "problem" is this line :

Code: Select all

IrrlichtDevice *device = createDevice(EDT_DIRECT3D9, dimension2d<u32>(640, 480), 16, false, false, false, 0);
I don't know what mean "dimension2d<u32>", specialy the "u32"
My second is :

Code: Select all

guienv->addStaticText(L"Hello world", rect<s32>(10,10,200,22), false);
Again, I don't know what it means "rect<s32>"
My last is :

Code: Select all

driver->beginScene(true, true, SColor(0,255,255,255));
I don't know what is the first 0, it doesn't change anything...
Thanks for your responses and bybye :).
Seven
Posts: 1034
Joined: Mon Nov 14, 2005 2:03 pm

Re: Some questions about Irrlicht

Post by Seven »

warning : I am not an expert on this so read this as one amateur talking to another..........

you can define types that make reading easier (and portability across platforms)
#define myInt int // define the type myInt to be the same as int
so anywhere you would use int, you could use myInt
int a = 5;
myInt a = 5;

would be the same thing. of course, now you could change the myInt definition to be an unsigned int
#define myInt unsigned int // now the type myInt is the same as unsigned int
and everywhere that the program uses myInt would be automatically changed to use the same

remember that irrlicht is used across multiple platforms (unix, windows, ios) and if we expect an int to be 32 bits in size, we can setup defines to make sure.
if operating system is unix then define int = unix 32 bit size integer
if operating system is windows then define int = windows 32 bit size integer
now if the user changes platforms, he can define what the operating system is an viola! all of his types are correct


rect is a templated item. (read up on this one, it is used all over the place)
you could create a rect that uses float, int, bool or whatever you want.
in this case, you create a rect that uses int
........ rect<int> myRectangle(10,10,100,100);
or floats
........ rect<float> myRectangle(10.2f,10.2f,100.0f,100.0f);

same with dimension2d<int> means a dimension2d structure that uses int's as the variable type.


as for the driver->beginScene(true, true, SColor(0,255,255,255));

SColor is a structure that repsresents the alpha, red, green and blue components of a color.
the 0,255,255,255 tells the structure what values to have for each of the variables.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Some questions about Irrlicht

Post by CuteAlien »

First 2 questions are basically the same. In c++ you can create classses for new types. The names should give some hint what those are about - the first is if you need a dimension (aka width and height) and the second for when you need a rectangle (aka 4 corners). You can find the corresponding documentation here: http://irrlicht.sourceforge.net/docu/na ... 1core.html

The first value for SColor is the alpha-value which doesn't matter in this specific case. In other situations it allows controlling the transparency of a color. Documentation for SColor can be found here: http://irrlicht.sourceforge.net/docu/cl ... color.html
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Nonee
Posts: 3
Joined: Sun Aug 03, 2014 3:32 pm

Re: Some questions about Irrlicht

Post by Nonee »

Thank you two, I had already read the documentation, but I missed one thing :
typedef dimension2d< f32 > irr::core::dimension2df

Typedef for an f32 dimension.

typedef dimension2d< s32 > irr::core::dimension2di

Typedef for an integer dimension.

typedef dimension2d< u32 > irr::core::dimension2du

Typedef for an unsigned integer dimension.
My question is now what is "f32" ? I didn't find anything about that. Thank you again.
Seven
Posts: 1034
Joined: Mon Nov 14, 2005 2:03 pm

Re: Some questions about Irrlicht

Post by Seven »

32 bit float?
Nonee
Posts: 3
Joined: Sun Aug 03, 2014 3:32 pm

Re: Some questions about Irrlicht

Post by Nonee »

Oh, well, didn't think about it, but now... Yeah, I am a kind of idiot... Thank to you two :).
Post Reply