2d images PLEASE HELP!!!!

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
only1skingle
Posts: 25
Joined: Mon Sep 27, 2010 6:51 pm
Location: United Kingdom

2d images PLEASE HELP!!!!

Post by only1skingle »

hey everyone,

I have looked at the tutorials but im lost within the code!

I am trying to make a 2d image appear on my program screen.

I am using the following code:

driver->draw2DRectangle(video::SColor(0,255,0,0),
core::rect<s32>(100,20,200,40));

but it doesn't seem to work. :(
any advice/guidance or a perfect code sample on how to put a rectangle in my program would be great.

Thanks
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Post by Radikalizm »

Are you calling this code inside your drawing loop?
only1skingle
Posts: 25
Joined: Mon Sep 27, 2010 6:51 pm
Location: United Kingdom

Post by only1skingle »

yes

while(device->run() && driver)
{
if (device->isWindowActive())
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Post by Radikalizm »

And where inside your drawing loop are you calling this?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You also have full transparency enabled. Good chances that your rectangle is completely invisible, even if it's rendered.
only1skingle
Posts: 25
Joined: Mon Sep 27, 2010 6:51 pm
Location: United Kingdom

Post by only1skingle »

no worries, i have now got a square placed in my window

i started messing around with the numbers in here:

core::rect<s32>(100,390,210,440));

however i am now confused as to what each number does.

As i thought maybe the (1,2 were x and y
and 3,4)); were size

but this doesn't seem to be the case.

so what do they do??

thanks
only1skingle
Posts: 25
Joined: Mon Sep 27, 2010 6:51 pm
Location: United Kingdom

Post by only1skingle »

its the 4 points of the rectangle...right???
randomMesh
Posts: 1186
Joined: Fri Dec 29, 2006 12:04 am

Post by randomMesh »

only1skingle wrote:no worries, i have now got a square placed in my window

i started messing around with the numbers in here:

core::rect<s32>(100,390,210,440));

however i am now confused as to what each number does.

As i thought maybe the (1,2 were x and y
and 3,4)); were size

but this doesn't seem to be the case.

so what do they do??

thanks
Position and position + size. Have a look at the constructor: irr::core::rect

So a box with width 100 and height 10 at postion 10,1 would be like

Code: Select all

irr::core::rect<irr::s32>(10, 1, 10 + 100, 1 + 10)
Last edited by randomMesh on Mon Feb 14, 2011 5:40 pm, edited 1 time in total.
"Whoops..."
only1skingle
Posts: 25
Joined: Mon Sep 27, 2010 6:51 pm
Location: United Kingdom

Post by only1skingle »

thanks everyone for your help,
I really appreciate it :)
Bear_130278
Posts: 237
Joined: Mon Jan 16, 2006 1:18 pm
Location: Odessa,Russian Federation

Post by Bear_130278 »

Image
Do you like VODKA???
Image
Image
Post Reply