Cut IGUIImage

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
nannolo
Posts: 27
Joined: Thu Mar 20, 2008 7:56 pm
Location: Burning Hell

Cut IGUIImage

Post by nannolo »

Hi everybody
I'm creating a compass for a first person shooter game
it's a inline compass like the cod4 one or the rabcat one

I used an IGUIImage to display the compass image
and i'm translating it to show the pointer
now i need to cut off some part of the image
something like a resize of the showing area of the image
without scaling the image

Somebody can help me?
I haven't find anything like that on the API
Fury.
Posts: 25
Joined: Mon Dec 20, 2010 2:03 pm

Post by Fury. »

just show a picture with a hole above/under the compass.

you can have a different picture for every resolution and load the needed or just resize every picture at runtime before showing it.
nannolo
Posts: 27
Joined: Thu Mar 20, 2008 7:56 pm
Location: Burning Hell

Post by nannolo »

Hi
I don't want to hide the exceded parts with another picture
I want to cut them :) before showing them on the screen
Fury.
Posts: 25
Joined: Mon Dec 20, 2010 2:03 pm

Post by Fury. »

1) yuo need a mask and a shader that merge the mask and the picture...
in that case why don't use a pre-cutted image?

2) every part you want to cut is a separed gui element. just use the api to remove it from rendering.
nannolo
Posts: 27
Joined: Thu Mar 20, 2008 7:56 pm
Location: Burning Hell

Post by nannolo »

:/ but the image will translate on the left and on the right

cutting manually previously i think is too laborously and hard to mantain if i want to change graphics

http://sanje.comuv.com/irrtest/test.png

this is the actual image
Fury.
Posts: 25
Joined: Mon Dec 20, 2010 2:03 pm

Post by Fury. »

you need just to change UV.

the texture coordinates in the picture. it is simple if you know how to do that.
in your case this is simple
nannolo
Posts: 27
Joined: Thu Mar 20, 2008 7:56 pm
Location: Burning Hell

Post by nannolo »

:/ I haven't find how to move UV texture on IGUIElements yet
Lonesome Ducky
Competition winner
Posts: 1123
Joined: Sun Jun 10, 2007 11:14 pm

Post by Lonesome Ducky »

Well, IGUIImages are clipped to the rectangle of their parents. You could try creating a blank gui element, set its rect to the area you want to see, then set it as the parent of your image.
nannolo
Posts: 27
Joined: Thu Mar 20, 2008 7:56 pm
Location: Burning Hell

Post by nannolo »

Thanks ducky i got the wanted effect using an empty image rect as parent for the compass :D
Post Reply