mouse over button - What's Wrong

Posted By: JGGamer

mouse over button - What's Wrong - 01/26/10 18:12

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.
Posted By: hopfel

Re: mouse over button - What's Wrong - 01/26/10 18:32

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.
Posted By: JGGamer

Re: mouse over button - What's Wrong - 01/27/10 03:22

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?
Posted By: MikeS

Re: mouse over button - What's Wrong - 01/27/10 11:51

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
Posted By: DJBMASTER

Re: mouse over button - What's Wrong - 01/27/10 12:37

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'.
Posted By: Widi

Re: mouse over button - What's Wrong - 01/27/10 12:47

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.
Posted By: MikeS

Re: mouse over button - What's Wrong - 01/27/10 13:25

Ä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


Posted By: JGGamer

Re: mouse over button - What's Wrong - 01/27/10 18:57

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.
© 2024 lite-C Forums