Crosshair 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.
bal
Posts: 829
Joined: Fri Jun 18, 2004 5:19 pm
Location: Geluwe, Belgium

Post by bal »

Code: Select all

 driver->draw2DLine(irr::core::position2d(x,y,z), irr::core::position2d(x,y,z));
That's API code, you got to fill in the right numbers :)
Gameswhiz
Posts: 10
Joined: Thu Jul 01, 2004 6:39 pm

re

Post by Gameswhiz »

But here is the thing.I get an error error C2955: 'position2d' : use of class template requires template argument list whenever I try that code driver->draw2DLine(position2d(320,240,0), position2d(330,250,0)); So what could be the problem?
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Post by Tyn »

The fact that you haven't designated a type. To use an integer:

core::position2d<int> pos

It can be misleading that you need to use this since there is:

core::vector3df pos

But this is just a shortcut for

core::vector3d<core::f32> pos
Gameswhiz
Posts: 10
Joined: Thu Jul 01, 2004 6:39 pm

re:

Post by Gameswhiz »

Thanks I got it to compile and run now.I guess I should just fiddle with the numbers untill I can see the lines on the screen or are they meant to be there already?
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

Gameswhiz wrote:
Hi, I got the crosshair in the middle using draw2DRectangle but how do I resize the rectangle?
It is rendered every loop so just change its size. Define some wariables and pass them to function

like:

Code: Select all

int x1, x2, y1 ,y2;

if(something)
{
   x1 = 300;
   x2 = 500;
   y1 = 299;
   y2 = 301;
}

if(something else)
{
   x1 = 100;
   x2 = 700;
   y1 = 299;
   y2 = 301;
}

driver->draw2DRectangle( irr::video::SColor(100,255,100,100),  irr::core::rect<s32>(x1,y1,x2,y2) );
Post Reply