Resize Images

Irrlicht.Net is no longer developed or supported, Irrlicht.Net Cross Platform is a much more complete wrapper. Please ask your C# related questions on their forums first.
Locked
Mr. Y

Resize Images

Post 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
Dances
Posts: 454
Joined: Sat Jul 02, 2005 1:45 am
Location: Canada
Contact:

Post 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...
Mr. Y

Post by Mr. Y »

... and the same problem with the hud... there must be a way to resize textures!
Devion
Posts: 9
Joined: Sat Sep 17, 2005 5:54 pm
Location: Netherlands
Contact:

Post by Devion »

Tried a lot.. looks like there isn't a function in IrrLicht to resize 2D images :x
Mr. Y

Post by Mr. Y »

Nikoooooooooooo :D
Locked