Gamestudio Links
Zorro Links
Newest Posts
New FXCM FIX Plugin
by flink. 06/04/24 07:30
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
2 registered members (AndrewAMD, ozgur), 1,526 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Make key_pressed independant of inchar #409403
10/16/12 16:10
10/16/12 16:10
Joined: Sep 2007
Posts: 101
Luxembourg
K
krial057 Offline OP
Member
krial057  Offline OP
Member
K

Joined: Sep 2007
Posts: 101
Luxembourg
Hi,
Would it be possible to make key_pressed independant to inchar? At the moment, when inchar is active, key_pressed just gets triggered when a is pressed down and while it is pressed down every some milliseconds(always when a new char is added to inchar...) Here is an example to clearify:
Code:
#include <acknex.h>
STRING* lastkey = "";
void getLastKey()
{
	while(1)
	{
		inchar(lastkey);
		wait(1);
	}
}

function main()
{
	level_load(NULL);
	//getLastKey();
	while(1)
	{
		if(key_pressed(key_for_str("a")))
			draw_text("a is pressed", 10, 10, COLOR_RED);
		wait(1);
	}
}



Uncomment getLastKey to see the difference. Or is there a workaround or an alternative to inchar or key_pressed?

Re: Make key_pressed independant of inchar [Re: krial057] #409748
10/22/12 06:42
10/22/12 06:42
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
inchar uses the Windows API, which in turn uses key repeat functions. That's why Gamestudio key events must not be used during inchar or inkey.


Moderated by  old_bill, Tobias 

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