Suggestion:Non-rectangular checks and GetPixelAt()

Started by Sektor 13, Sun 27/02/2005 17:11:05

Previous topic - Next topic

Sektor 13

hey what about you can click trought "transparent GUI", if you import GUI picture that has some transparent parts or just text (label). You could make different shaped buttons. Well you can make lets say triangular shaped button, but when you click on it it still acts as it isÃ,  rectangular..

brrr i hope you understand this :D

Edited by Gilbot:
The following discussions were originally part of this thread, which now belong to this new thread splitted from the original.

Gilbert

I think currently GUI clicks only check for rectangular regions (for speed purpose probably), so if a button is not rectangular in shape (well with transparent pixels actually) the check is still over the whole rectangular region.

Since this is considered as a feature request, I don't think it's a good idea to post it in this thread.

Rui 'Trovatore' Pires

...anyway, I'm not sure I'd like that. :P If I make a triangular button, I'd like checks to be made on it's surface only.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

SSH

Well, it's always possible to script up such things yourself. finding if a point is insdie a triangle is very easy, if you have 3 directed lines, just make sure the point is always to the left or to the right. Or, you could make them different colours and use RawGetPixelAt(x, y)

12

Rui 'Trovatore' Pires

A bit of a hassle for replicating a behaviour that makes a lot of sense and is already built in, no?
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

Gilbert

There's a RawGetPixelAt() function? Using a plugin?

SSH

Quote from: Gilbot V7000a on Tue 01/03/2005 01:30:13
There's a RawGetPixelAt() function? Using a plugin?

Oh... well in that case make it a SUGGESTION!
12

Gilbert

#7
I swear that there was (at least) once a discussion about it, but I had tried the search function without luck, so I gave up... :P

As far as I remember ther're some small difficulties in implementing the GetPixelAt() function. One problem is, when the game's run in hi-res (640 x 4*0, 800 x 600), each room/screen engine coordinate pair actually corresponds to 2 x 2 = 4 actually displayed pixels. In that case what value should the function return ? The colour of the top-left pixel, or an average colour of all four pixels ? Moreover, the returned colour would be interpreted differently depending on whether the game is in indexed colour mode (256 colours, so it returns the index) or direct colour mode (15bit+). It may be possible if that function works on coordinates of actually displayed pixels, but then the game's scripter might need to take care of different settings, as you can't (shouldn't) prevent the players from running a hi-res game in low-res, or vice versa.

So, in my opinion, this feature is not as easily implemented as expected, and may need indepth discussion of how it should be done until a consistent solution is found.

By the way, as I wrote before, as these are more likely feature requests than bug reports, I'll split these posts. (Edit:done)

Pumaman

Quote from: Sektor 13 on Sun 27/02/2005 17:11:05
hey what about you can click trought "transparent GUI", if you import GUI picture that has some transparent parts or just text (label). You could make different shaped buttons. Well you can make lets say triangular shaped button, but when you click on it it still acts as it is  rectangular..

If you have a transparent GUI with just a label on it or whatever, you can just un-check its Clickable setting for mouse clicks to go straight through it.

Allowing click-throughs of transparent areas of button graphics is an idea though, would other people find this useful?

Sektor 13

You can make it selectable, something like CLICK TROUGH TRANSPERENT (yes/no), it should be usefull, if you want to make GUI like  in HEXEN , but for adventure of course :D

Rui 'Trovatore' Pires

QuoteAllowing click-throughs of transparent areas of button graphics is an idea though, would other people find this useful?

Like, if the player clicks on a transparent bit o' GUI it acts as though he clicked on what's underneath? I thought that was what was already happening. :P
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

Gilbert

No, so that's actually what this thread is about,

Pumaman

No, this is if you click on a transparent part of a GUI button. At the moment GUI buttons have a rectangular check, but the question is an option for the button not to be activated if you click on a transparent pixel of its image.


Hollister Man

Actually I ran into this problem during a jam session with a buddy.  We were trying to make a 'rhomboid' GUI, basically a square turned on its side.  Its stylized, with an irregular border.  Because of this it gets basically triangular transparent sections in the 'corners' where the game still detects that the mouse is over the GUI, but it really doesn't look as if it were.

I know how to process click-through into background, but I really would prefer if there was a way to 'pretend' that the GUI background transparency actually controlled its boundaries.  Did that make any sense?  Like a skin on a program, if there's nothing in an area, it shouldn't respond as if there is something.

BTW: I got it to work by ignoring the GUI itself and detecting if the mouse was over a GUI element instead.  It works pretty nice now.
That's like looking through a microscope at a bacterial culture and seeing a THOUSAND DANCING HAMSTERS!

Your whole planet is gonna blow up!  Your whole DAMN planet...

scotch

The ToaK GUI gave yOke some trouble, I drew the buttons as overlapping non rectangular shapes, not sure how he managed it, but I'm sure he'd have appreciated ths feature too.

YOke

Heh. You bet I would! :)

I had to tweak the squares to fit the best possible way. If you click around in ToaK GUI you will notice that clicking the edges of some buttons will not activate the button.

Enlightenment is not something you earn, it's something you pay for the rest of your life.

Rui 'Trovatore' Pires

#17
Sorry to bring this us again, but I'd like some help and thought it wasn't worth it starting a new thread...

I need a Return-to-Zork-style interface - you'll find out why later in the GIP forum. So far so good, but you'll remember that the interaction pop-up window is made of lozanges(sp?)...
Code: ags

Ã,  Ã, /\
Ã,  /Ã,  \
Ã, /\Ã,  /\
/Ã,  \/Ã,  \
\Ã,  /\Ã,  /
Ã, \/Ã,  \/
Ã,  \Ã,  /
Ã,  Ã, \/

As you can see, this is a more serious problem - the GUI buttons actually overlap, though the images, naturally, do not. I REALLY need the "click-through" feature, and said so in the tracker just now. In the meantime, is there a work-around?
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

SSH

Write a formula in the GUI's click function to determine button by X and Y mouse position?
12

Rui 'Trovatore' Pires

#19
Yikes. Considering the GUI has 4 different shapes depending on how many actions there are to be performed, and that even just hovering the mouse above the buttons will make a message appear... I think I'll keep it on hold until CJ can add this. Pity. CJ, if you're there, is there any chance of this coming out anytime soon (read=2.71)?

I mean, SSH, that would essentially mean making stuff life "if (mouse.x>gInterface+2 && mouse.x<gInterface+10) " for EVERY Y coordinate, right? If not - if I'm making it harder than it needs be, as I use to - please tell me.

EDIT - The tough part is, I'll ALSO need these buttons:

Code: ags

--------
|Ã,  / |Ã,  /
| /Ã,  | /
|/Ã,  Ã, |/

Ã,  Ã, /|
Ã,  / |
/Ã,  Ã, |
----


...and the lower one is supposed to fit into the upper one... and this goes on in a grid of about 10x10 squares of dynamic dimensions.

Egad.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

SMF spam blocked by CleanTalk