Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, dpn), 1,328 guests, and 10 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19053 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Round buttons #271351
06/12/09 14:44
06/12/09 14:44
Joined: Mar 2004
Posts: 206
The Netherlands
R
Roy Offline OP
Member
Roy  Offline OP
Member
R

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: Roy] #271371
06/12/09 17:35
06/12/09 17:35
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline
Serious User
DLively  Offline
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
Hi,

Not sure how to go abouts doing that, but you can try this.

Put a window over the button panel, so the box just fits inside cirle, and make it so that your pointer has to be in the window in order for the click to work.


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: Round buttons [Re: DLively] #271513
06/13/09 16:34
06/13/09 16:34
Joined: Mar 2004
Posts: 206
The Netherlands
R
Roy Offline OP
Member
Roy  Offline OP
Member
R

Joined: Mar 2004
Posts: 206
The Netherlands
I don't think that works, because
- Windows are rectangles too.
- The shape i want to use is not a circle (that was just an example), but a far more complex shape.

Re: Round buttons [Re: Roy] #271516
06/13/09 16:51
06/13/09 16:51
Joined: May 2009
Posts: 1,816
at my pc (duh)
darkinferno Offline
Serious User
darkinferno  Offline
Serious User

Joined: May 2009
Posts: 1,816
at my pc (duh)
well you could try using more panels with varying angles, panel A angle=0, panels B angle=45 and onwards, maybe repeat this to fill all the gaps... sounds plausible to me

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 Offline
Senior Expert
Quad  Offline
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
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
not tetsten but it need to be somthing like this

Code:

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
J
Jaeger Offline
Member
Jaeger  Offline
Member
J

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! smile

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. smile

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] #271556
06/13/09 20:46
06/13/09 20:46
Joined: Feb 2009
Posts: 2,154
Damocles_ Offline
Expert
Damocles_  Offline
Expert

Joined: Feb 2009
Posts: 2,154
A cheap method is to "slice" up the button into several
parts (lets say 6), and create 6 buttons, that
do the same function.

Its not perfectly round, but closer to a circle, and
you dont need a seperate function to calculate a distance,
-> so you can use the standard buttons.

you can then further blend in a panel-image, to simulate
the "highlighting" of the button, when clicking it.

Re: Round buttons [Re: Damocles_] #271563
06/13/09 22:46
06/13/09 22:46
Joined: May 2009
Posts: 258
Chicago
J
Jaeger Offline
Member
Jaeger  Offline
Member
J

Joined: May 2009
Posts: 258
Chicago
There's really no need. That's a bunch of work for nothing.

I tested my remarks a minute ago. It is correct. You can make a .tga image 2048x2048 pixels that has only a tiny dot in the center, with the rest transparent. Nothing will happen while you're over the transparent parts, but when the mouse is over the little dot, you can click the button and activate the function you assigned. I can do the same thing with a dollar sign, a cross, a sombrero, or a leprechaun button. It doesn't matter. The mouse does NOT detect the transparent parts of a button. Please, just use .tga images with transparent parts... It's soooo easy...

NO need for a "circular image", NO need for window(s), NO need to "slice" up anything...

Re: Round buttons [Re: Jaeger] #271572
06/13/09 23:45
06/13/09 23:45
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
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
Page 1 of 2 1 2

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1