Gamestudio Links
Zorro Links
Newest Posts
[MED] Import from FBX (2010) missing!!!
by rayp. 11/03/26 14:33
What are you working on?
by rayp. 11/02/26 13:57
No connection to MT4
by JeyKey II. 10/29/26 09:34
Zorro plugin for Hyperliquid.xyz
by opm. 10/28/26 13:50
Icon "OP"
by JeyKey II. 10/27/26 07:03
ZorroGPT
by TipmyPip. 10/26/26 08:09
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
1 registered members (AndrewAMD), 7,058 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
MaliceTheMaker, Haitao_Ren, JimSimons, julienp, julienper
19248 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,145
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

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