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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, Akow, degenerate_762), 1,430 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
A button case #259164
04/04/09 13:54
04/04/09 13:54
Joined: Nov 2008
Posts: 50
S
Secret_V Offline OP
Junior Member
Secret_V  Offline OP
Junior Member
S

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:
Code:
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:
Code:
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? frown

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 Offline
Expert
Espér  Offline
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
hmm.. why not changing mouse_pos??

Code:
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.

Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: A button case [Re: Espér] #259171
04/04/09 14:37
04/04/09 14:37
Joined: Nov 2008
Posts: 50
S
Secret_V Offline OP
Junior Member
Secret_V  Offline OP
Junior Member
S

Joined: Nov 2008
Posts: 50
That's also a possibility, but it doesn't solve my problem. wink

It's the proc_kill((void*) continu_over); that's not working, cause the beep() DOES work. wink

Last edited by Secret_V; 04/04/09 14:39.
Re: A button case [Re: Secret_V] #259194
04/04/09 18:04
04/04/09 18:04
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline
Expert
Espér  Offline
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
yes ^^
becasue the button is not pressed..

The button only reacts on mouse clicks. So, the function ( where your key is called ) is only active, when a mouse click hits the button ^^


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: A button case [Re: Espér] #259198
04/04/09 18:31
04/04/09 18:31
Joined: Nov 2008
Posts: 50
S
Secret_V Offline OP
Junior Member
Secret_V  Offline OP
Junior Member
S

Joined: Nov 2008
Posts: 50
I disagree with you there. The button reacts to the mouse cursor. Continu() runs when I click the button with the mouse, continu_over() runs when I go over it with the mouse cursor, which works fine, and continu_leave runs when the mouse cursor leaves the button, which also works, as it plays the beep() sound. Thing is, proc_kill((void*) continu_over); does NOT terminate continu_over, as it should.

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 Offline
Expert
EvilSOB  Offline
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
Code:
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: EvilSOB] #259212
04/04/09 20:06
04/04/09 20:06
Joined: Nov 2008
Posts: 50
S
Secret_V Offline OP
Junior Member
Secret_V  Offline OP
Junior Member
S

Joined: Nov 2008
Posts: 50
I tried it, but not a single continu_over is being killed by proc_kill. But I have just bumped into another problem, continu_leave only runs when I leave the button on the upper or left side, not when I leave it on the down of right side.

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 Offline
Expert
EvilSOB  Offline
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
Re: A button case [Re: EvilSOB] #259227
04/04/09 21:02
04/04/09 21:02
Joined: Nov 2008
Posts: 50
S
Secret_V Offline OP
Junior Member
Secret_V  Offline OP
Junior Member
S

Joined: Nov 2008
Posts: 50
There is no transparent border and there is no other button. The panel consists solely of this button, so the mouse leaves the panel at the same time as it leaves the button, because the panel is as big as the button.

But something strange is happening here... When I leave the button down or right with my mouse... it DOES trigger continu_leave().

Re: A button case [Re: Secret_V] #259404
04/05/09 23:25
04/05/09 23:25
Joined: Apr 2006
Posts: 737
Ottawa, Canada
O
Ottawa Offline
User
Ottawa  Offline
User
O

Joined: Apr 2006
Posts: 737
Ottawa, Canada
Hi!

Is having or not having a layer in the panel important?

Ottawa smile

Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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