Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, juanex, Grant), 1,018 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 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,935
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,935
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