2 registered members (Akow, tomaslolo),
1,536
guests, and 12
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
mouse over button - What's Wrong
#307033
01/26/10 18:12
01/26/10 18:12
|
Joined: Nov 2008
Posts: 109
JGGamer
OP
Member
|
OP
Member
Joined: Nov 2008
Posts: 109
|
Someone, please, I need help with this problem. I can't get it figured.
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
User
|
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: MikeS]
#307130
01/27/10 12:37
01/27/10 12:37
|
Joined: Nov 2007
Posts: 1,143 United Kingdom
DJBMASTER
Serious User
|
Serious User
Joined: Nov 2007
Posts: 1,143
United Kingdom
|
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
Serious User
|
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
Member
|
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. 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
JGGamer
OP
Member
|
OP
Member
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.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|