2 registered members (AndrewAMD, dpn),
1,328
guests, and 10
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Round buttons
#271351
06/12/09 14:44
06/12/09 14:44
|
Joined: Mar 2004
Posts: 206 The Netherlands
Roy
OP
Member
|
OP
Member
Joined: Mar 2004
Posts: 206
The Netherlands
|
Hello,
I want to make a button, that's not a square. The only problem, however, is, that i want to be able to move over it, and so change the bitmap. But ONLY when you move over the 'not-overlay' part.
For example, a button that's a red circle. When the mouse moves over it, it has to become yellow, but ONLY when it moves over the circle, NOT over the black (square) area around it.
How can i do this? (just set the overlay flag doesn't work)
Thanks,
Roy
|
|
|
Re: Round buttons
[Re: darkinferno]
#271520
06/13/09 17:23
06/13/09 17:23
|
Joined: Oct 2007
Posts: 5,210 İstanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
|
use panels and check alpha channel of the panel image on mouse position then if it's on non-transparent parts of the panel change the panel image to "over" image and use panel clicked event... instead of a button.
3333333333
|
|
|
Re: Round buttons
[Re: darkinferno]
#271521
06/13/09 17:28
06/13/09 17:28
|
Joined: Jul 2007
Posts: 959 nl
flits
User
|
User
Joined: Jul 2007
Posts: 959
nl
|
not tetsten but it need to be somthing like this
BMAP* tbutton = "your_but.bmp"
var off_set[3];
function button_klikecd(var button_nm,PANEL* panel)
{
if(button_nm == 1)
{
off_set[0] = 10;
off_set[1] = 5;
}
if(vec_dist(vector(panel.pos_x+bmap_width(tbutton)/2+off_set[0],panel.pos_y+bmap_height(tbutton)/2+off_set[1],0),vector(mouse_pos.x,mous_pos.y,0)) < bmap_width(tbutton)/2)
{
//your button func
}
}
"empty"
|
|
|
Re: Round buttons
[Re: flits]
#271550
06/13/09 19:42
06/13/09 19:42
|
Joined: May 2009
Posts: 258 Chicago
Jaeger
Member
|
Member
Joined: May 2009
Posts: 258
Chicago
|
Um... Transparent parts of a button are NOT detected by the mouse. All images are squares, because your screen is a quadrangle (rectangle/square). You can't make a circular image, unless you've got some kind of special software (which I have no clue where to get, or how much it costs). But you don't need that anyway... Make SURE that the transparent parts are FULLY transparent. If it's 99.99% transparent, the mouse will still detect it. But anything fully, 100% transparent is not detected. I think the best thing would be to use targa (.tga) images, instead of .bmp or .pcx. Targas are of better quality anyway. But it will allow you to have REAL transparent parts, instead of using black for transparent. And you won't need to use "OVERLAY" either, just "flags = SHOW;" (or "VISIBLE" for older versions). I'm assuming you have something like Gimp or Photoshop... God forbid you're using MS-Paint! But trust me, I've made many a button. You DON'T need a "circular image", or any "alternately shaped images" for your button. A regular .tga with real transparencies is the best thing. Try to avoid using other formats with black RGB(0,0,0) for transparent with the "OVERLAY" flag. It often makes ugly looking buttons with jagged, misshapen edges anyways. I know this info is correct, because I've even used text for a button before. The mouse wouldn't detect the button unless I was directly over a letter, a non-transparent part. So I would make a background layer, and set opacity to 1%, so you couldn't see it, but the mouse would still detect the button between letters. P.S.- If you're using your own mouse cursor bmap, you might need to set mouse_spot. See manual. You can define which part of the mouse bmap is the "hotspot". Maybe irrelevant for your project, but maybe not...
|
|
|
Re: Round buttons
[Re: Jaeger]
#271572
06/13/09 23:45
06/13/09 23:45
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Jaeger, if youve still got that test code there, cant you try it again WITH THE OVERLAY FLAG ON. I know its not needed, but I think it interferes with the alpha-transparency detection is it is on...
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|