Page 1 of 1

Resize Images

Posted: Thu Aug 18, 2005 3:35 pm
by Mr. Y
Hi,

I need to resize a image for a crosshair. The crosshair should have the size of the screen (sniping-zoom).

Code: Select all


Dim Scope As Irrlicht.Video.ITexture
driver = Device.VideoDriver

driver.Draw2DImage(Scope, New Core.Position2D(0, 0), New Irrlicht.Core.Rect(0, 0, 1280, 1024, New Irrlicht.Video.Color(100, 255, 255, 255), True)

This work but only for a screen with 1280x1024 Pix.

Thank You

Posted: Thu Aug 18, 2005 4:17 pm
by Dances
The easy way out would be to draw an image of the crosshair's outline and then center it on the screen and render black pixels all around it. Something like:

(pseudocode because I don't know .net)

Code: Select all

load image of crosshair; (put black around it in a square and use white for transparencies!)
load image of one black pixel;
crosshairX = (XRes / 2) - (half width of crosshair);
crosshairY = (YRes / 2) - (half height of crosshair);

then in the draw loop

if (scope == true)
{
draw(crosshair, (crosshairX,crosshairY));
draw(black, (0,0), rect<s32>(0,0,height of crosshair, YRes)
//^^Repeat above until all four sides are covered
}
The problem with this method is that the crosshair will appear smaller on higher resolutions.

You could also have an image for every supported resolution...

Posted: Thu Aug 18, 2005 9:27 pm
by Mr. Y
... and the same problem with the hud... there must be a way to resize textures!

Posted: Mon Sep 19, 2005 9:14 pm
by Devion
Tried a lot.. looks like there isn't a function in IrrLicht to resize 2D images :x

Posted: Tue Sep 20, 2005 11:55 am
by Mr. Y
Nikoooooooooooo :D