|
A button case
#259164
04/04/09 13:54
04/04/09 13:54
|
Joined: Nov 2008
Posts: 50
Secret_V
OP
Junior Member
|
OP
Junior Member
Joined: Nov 2008
Posts: 50
|
Hi, I'm trying to make my game playable with with a joystick, so I want to be able to press buttons with it. I am already able to press the buttons, but not everything works yet. The mouse can is moved over the screen using joy_force and I can click on it with joy_1. The button:
PANEL* continue_pan =
{
pos_x = 30;
pos_y = 10;
button(0, 0, continue_bmp, continue_bmp, continue_bmp, continu, continu_leave, continu_over);
} The functions:
function continu()
{
while(key_any) wait(1);
bSuccess = game_load("my_save", 1);
wait(-1);
}
function continu_over()
{
while(!joy_1) wait(1);
if(joy_1)
{
while(key_any) wait(1);
bSuccess = game_load("my_save", 1);
wait(-1);
}
}
function continu_leave()
{
beep();
proc_kill((void*) continu_over);
} continu() is used for clicking on it with the mouse, continu_over() is used for the joystick, so when the mouse moves over it, it waits for joy_1 to be pressed. But I don't want it to wait for joy_1 after the mouse leaves the button, so I use continu_leave(), but that one doesn't work. It beeps, but it doesn't end continu_over(), which I want it to do. Anyone?
Last edited by Secret_V; 04/04/09 13:55.
|
|
|
Re: A button case
[Re: Secret_V]
#259170
04/04/09 14:33
04/04/09 14:33
|
Joined: Mar 2008
Posts: 2,247 Baden Württemberg, Germany
Espér
Expert
|
Expert
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
|
hmm.. why not changing mouse_pos??
function cursor()
{
while(1)
{
mouse_pos.x = var_pos_x;
mouse_pos.y = var_pos_y;
[...]
then just change the variables via joy_force.... i think that makes you able to use the simple button command of a panel, because you use the mouse cursor instead of a position-asking
Last edited by Espér; 04/04/09 14:34.
|
|
|
Re: A button case
[Re: Secret_V]
#259202
04/04/09 19:12
04/04/09 19:12
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Im not sure but I think it may be due to the buttons event-priority. Try this
function continu_leave()
{
beep();
wait(1);
proc_kill((void*)continu_over);
} Otherwise check proc_status(continu_over) after the proc_kill to see if all continu_over's were killed or not. It may be have been successfully kill'ed but is being re-triggered for some reason.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: A button case
[Re: Secret_V]
#259217
04/04/09 20:16
04/04/09 20:16
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Hmmm, is there a transparent border on the down or right side the mouse may still be over? Maybe the mouse is hitting another button before it hits unpopulated panel space. Maybe the mouse is leaving the panel before/same-time it has left the button.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
|