Gamestudio Links
Zorro Links
Newest Posts
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
4 registered members (degenerate_762, AbrahamR, AndrewAMD, ozgur), 667 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
mouse over button - What's Wrong #307033
01/26/10 18:12
01/26/10 18:12
Joined: Nov 2008
Posts: 109
J
JGGamer Offline OP
Member
JGGamer  Offline OP
Member
J

Joined: Nov 2008
Posts: 109
Someone, please, I need help with this problem. I can't get it figured.

Code:
BMAP* cursorImage = "cursor.pcx";
PANEL* panel_testButton =
{
	layer = 100;
	scale_x = 0.7;
	scale_y = 0.7;
	button (0, 0, "test.tga", "test.tga", "test_light.tga", NULL, NULL, NULL); 
	flags = OVERLAY | TRANSLUCENT;
	alpha = 100;
}

function main()
{
	mouse_map = cursorImage; //set the mouse pointer bitmap
	mouse_mode = 2; // use mouse
	
	// set the rotation center at the panel center
	panel_testButton.center_x = panel_testButton.size_x * 0.5;
	panel_testButton.center_y = panel_testButton.size_y * 0.5;
	// set the size of the button
	panel_testButton.size_x = panel_testButton.center_x * 1.6;
	panel_testButton.size_y = panel_testButton.center_y * 1.6;
	// set position
	panel_testButton.pos_x = (screen_size.x)/2-50;
	panel_testButton.pos_y = (screen_size.y)/2+200;
	
	// start loop
	while(1)
	{
		
		// mouse cursor pos
		mouse_pos.x = mouse_cursor.x; // allow the mouse pointer to move
		mouse_pos.y = mouse_cursor.y; // on the x and y axis
		wait(1); //loop
	}
}



Is there something wrong with this code? When I move the mouse over the button, it does not change as it ought to. Help please.

Re: mouse over button - What's Wrong [Re: JGGamer] #307036
01/26/10 18:32
01/26/10 18:32
Joined: Dec 2008
Posts: 605
47°19'02.40" N 8°32'54.67" E...
hopfel Offline
User
hopfel  Offline
User

Joined: Dec 2008
Posts: 605
47°19'02.40" N 8°32'54.67" E...
first, this one:
vec_set(mouse_pos,mouse_cursor);

and not:
mouse_pos.x = mouse_cursor.x;
mouse_pos.y = mouse_cursor.y;

It's the same, but more professional XD

And to your problem:

try it without this scale-, center- and alpha-things. So you can be sure, where the fault is.


Hilf mir, dir zu helfen!
Re: mouse over button - What's Wrong [Re: hopfel] #307094
01/27/10 03:22
01/27/10 03:22
Joined: Nov 2008
Posts: 109
J
JGGamer Offline OP
Member
JGGamer  Offline OP
Member
J

Joined: Nov 2008
Posts: 109
Nothing doing.
I removed everything, including scale, alpha, etc., still no change.
Could the camera's angle and position have anything to do with it?

Re: mouse over button - What's Wrong [Re: JGGamer] #307125
01/27/10 11:51
01/27/10 11:51
Joined: Mar 2007
Posts: 112
MikeS Offline
Member
MikeS  Offline
Member

Joined: Mar 2007
Posts: 112
button (0, 0, "test.tga", "test.tga", "test_light.tga", NULL , NULL, NULL);

Here you had to define an function which shall be called when pressing the button. define this, and your button should work.

Greetings

Mike

Re: mouse over button - What's Wrong [Re: MikeS] #307130
01/27/10 12:37
01/27/10 12:37
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
Quote:

button (0, 0, "test.tga", "test.tga", "test_light.tga", NULL , NULL, NULL);

Here you had to define an function which shall be called when pressing the button. define this, and your button should work.

That's not his problem. His problem is that when he hovers over the button, that it doesn't change to the 'bmap_over' image.

I know it might sound dumb but double check your files again just to make sure that 'over' image isn't in fact a copy of the 'off' image.

To see if it's a mouse problem, set mouse_mode to 4 rather than 2, and remove the stuff afterwards like 'mouse_pos.x = mouse_cursor.x'.

Last edited by DJBMASTER; 01/27/10 12:38.
Re: mouse over button - What's Wrong [Re: DJBMASTER] #307133
01/27/10 12:47
01/27/10 12:47
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
I see in your Profile you using Version 7.05 (Warez). In this Version are a lot of bugs, make a update to the newest Version.

Last edited by Widi; 01/27/10 12:53.
Re: mouse over button - What's Wrong [Re: Widi] #307136
01/27/10 13:25
01/27/10 13:25
Joined: Mar 2007
Posts: 112
MikeS Offline
Member
MikeS  Offline
Member

Joined: Mar 2007
Posts: 112
Ähm, i see, the bmaps for button off and button over are both the same, so you should change it. actually only the bmap for button click changes, and i think you cannot click and see its changes without a function defined which the button shall call.

Quote:

from the manual
button(x, y, bmapOn, bmapOff, bmapOver, functionOn, functionOff, functionOver);


edit: ah, ok, the bmaps are ok.

but maybe has to do with the flags? translucent and overlay?

Trie it with show only



Last edited by MikeS; 01/27/10 13:33.
Re: mouse over button - What's Wrong [Re: MikeS] #307200
01/27/10 18:57
01/27/10 18:57
Joined: Nov 2008
Posts: 109
J
JGGamer Offline OP
Member
JGGamer  Offline OP
Member
J

Joined: Nov 2008
Posts: 109
I had tried all you mentioned DJBMASTER, and it didn't work.
Maybe the problem is as Widi said.
I'm going to have to get some money and purchase the latest version.
Thanks

Oh, by the way, when I set mouse_mode to 4 and remove 'mouse_pos.x = mouse_cursor.x', 'mouse_pos.y = mouse_cursor.y', the mouse does not show in the game window.

Last edited by JGGamer; 01/27/10 19:01.

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