hud?

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
The Hellcat
Posts: 33
Joined: Sat Oct 16, 2004 11:52 pm
Location: Earth

hud?

Post by The Hellcat »

hey all, im working on my hud my right now, got some questions.

do you think it would be better to create separate images for each resolution?
OR
is there a way to scale images?

thanks all
HTML/CSS/Javascript/ASP/PHP/SQL/XML/QBasic
Next Up: C++
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Post by Tyn »

There's no scaling of images as of yet so you will have to create seperate HUD images for each resolution you want to support.
The Hellcat
Posts: 33
Joined: Sat Oct 16, 2004 11:52 pm
Location: Earth

Post by The Hellcat »

oki doki, no problemo

EDIT:
okay...is there a way to determine which part of the image I'm looking at, say if i had a 512x512 image and i wanted to show a 256x256 part of it?
HTML/CSS/Javascript/ASP/PHP/SQL/XML/QBasic
Next Up: C++
Guest

Post by Guest »

yes you can display areas of images in irrlicht
The Hellcat
Posts: 33
Joined: Sat Oct 16, 2004 11:52 pm
Location: Earth

Post by The Hellcat »

cool, where does it show that in the API, or can u help me out
HTML/CSS/Javascript/ASP/PHP/SQL/XML/QBasic
Next Up: C++
Harry_Mystic
Posts: 32
Joined: Sun Nov 23, 2003 10:23 pm

Post by Harry_Mystic »

I'm not sure if this is what you want to do but if you have seperate images for each resolution you can change the path irrlicht is looking to.

Create to subfolders in you media folder and change path regarding the resolution:
if 800x 600
device->getFileSystem()->changeWorkingDirectoryTo("./media/gfx800x600/");

else if 1024 x 768
device->getFileSystem()->changeWorkingDirectoryTo("./media/gfx1024x768/");

Then load the images without path
backgroundTexture = driver->getTexture("background.tga");

Use the same names for big and small images.

Problem if you want to change the path later in the game. Say you are in "./media/gfx800x600/" and you change the res to 1024x768 you have to set the path to "../1024x768".
But maybe you can get the working directory at the start of your game/application (getWorkingDirectory), save to a string and then add the gfx path. Dont know if and how this works.

Hope this helps
The Hellcat
Posts: 33
Joined: Sat Oct 16, 2004 11:52 pm
Location: Earth

Post by The Hellcat »

hey, thats actually a nice idea, might have to mess around with that in the future. what im really looking for now i guess is a way to only show one area of an image. i cant for the life of me figure out how to do that by looking through the docs....
HTML/CSS/Javascript/ASP/PHP/SQL/XML/QBasic
Next Up: C++
Harry_Mystic
Posts: 32
Joined: Sun Nov 23, 2003 10:23 pm

Post by Harry_Mystic »

Search for draw2DImage in the API.

Code: Select all

driver->draw2DImage(texture,         // the image
core::rect<s32>(0, 0, 50, 50),       // Destination on screen
core::rect<s32>(50,50,100,100),      // Rect from image
0,
video::SColor(255,255,255,255),
true);
Is that what you are looking for?
The Hellcat
Posts: 33
Joined: Sat Oct 16, 2004 11:52 pm
Location: Earth

Post by The Hellcat »

ah-ha....i was using the GUIImage instead......now that should help! thx
HTML/CSS/Javascript/ASP/PHP/SQL/XML/QBasic
Next Up: C++
The Hellcat
Posts: 33
Joined: Sat Oct 16, 2004 11:52 pm
Location: Earth

Post by The Hellcat »

okay, im getting all sorts of errors using it...

EDIT: Okay, compiling problems fixed, now it just doesnt even show up! haha hmm...
HTML/CSS/Javascript/ASP/PHP/SQL/XML/QBasic
Next Up: C++
Harry_Mystic
Posts: 32
Joined: Sun Nov 23, 2003 10:23 pm

Post by Harry_Mystic »

Where do you call this function?
In the while(device->run())?
I use it in a custom button class and have put it in the draw() function, it works fine.
The Hellcat
Posts: 33
Joined: Sat Oct 16, 2004 11:52 pm
Location: Earth

Post by The Hellcat »

i have it in a custom class (my game loop).
HTML/CSS/Javascript/ASP/PHP/SQL/XML/QBasic
Next Up: C++
Post Reply