Gamestudio Links
Zorro Links
Newest Posts
What are you working on?
by rayp. 10/15/25 20:44
Help!
by VoroneTZ. 10/14/25 05:04
Zorro 2.70
by jcl. 10/13/25 09:01
ZorroGPT
by TipmyPip. 10/12/25 13:58
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 10/11/25 18:45
Reality Check results on my strategy
by dBc. 10/11/25 06:15
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (TipmyPip, AndrewAMD), 7,000 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
joenxxx, Jota, krishna, DrissB, James168
19170 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: 28,028
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,028
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 | 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