Gamestudio Links
Zorro Links
Newest Posts
What are you working on?
by Emre
Today at 01:03
New Zorro version 1.83
by claudio
Yesterday at 17:22
Ahead bias when retrain
by jcl
Yesterday at 12:27
Huge array for Deep Learning
by jcl
Yesterday at 12:06
[LBGUI] Memory not released!
by EVO
05/23/18 22:39
http_post undeclared identifier
by Superku
05/23/18 22:10
Pan/Tilt in relation to entity?
by Superku
05/23/18 20:59
AUM Magazine
Latest Screens
Lake scene
Forgotten Tales - Demo version
RPG PARTY
Triton Wing now available on Steam
Who's Online
8 registered (Slin, Quad, Superku, AndrewAMD, 3run, jyd, 2 invisible), 460 Guests and 3 Spiders online.
Key: Admin, Global Mod, Mod
Newest Members
Rayharry, AgentShark, rpauletto, tuuPaul, LaserJock2000
17960 Registered Users
Topic Options
Rate This Topic
#466524 - 06/19/17 15:36 [paid] Programmer wanted // different keyboard layouts
preacherX Offline
Senior Member

Registered: 09/09/05
Posts: 341
Loc: Germany
In my game the players have to use their keyboards but not only normal letters but also these special characters: " {} [] () , ; . - +

Now I need a function which can detect if theses keys are pressed. At the moment I'm using if(key_8 ==1 && (key_shiftr==1||key_shiftl==1)) for detecting if the ( is pressed. But this works only for german keyboard layouts, in other parts of the world ( is not on key 8.

Now I'm looking for a function which can detect these keys no matter which layout is used.

I found something at Microsoft which could be useful:

https://msdn.microsoft.com/en-us/library/system.windows.input.key(v=vs.110).aspx

But I don't know how to use it in lite-c...

Top
#466527 - 06/19/17 16:25 Re: [paid] Programmer wanted // different keyboard layouts [Re: preacherX]
txesmi Offline
Serious User

Registered: 06/13/07
Posts: 1120
Loc: Hiporope and its pain
Hi,
the return of 'inchar' might help.

Top
#466528 - 06/19/17 17:22 Re: [paid] Programmer wanted // different keyboard layouts [Re: txesmi]
preacherX Offline
Senior Member

Registered: 09/09/05
Posts: 341
Loc: Germany
WOW, I'm working so many years now with GameStudio and learn still new things! Thank you very much!!!


Edited by preacherX (06/19/17 17:22)

Top
#466530 - 06/19/17 18:13 Re: [paid] Programmer wanted // different keyboard layouts [Re: preacherX]
Ch40zzC0d3r Offline
Serious User

Registered: 10/10/11
Posts: 1082
Loc: Germany
Code:
#include <acknex.h>
#include <windows.h>

LRESULT CALLBACK origWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK hkWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	if(message == WM_CHAR)
	{
		printf("Keypress: %c", wParam);	
	}
	
	return origWndProc(hwnd, message, wParam, lParam);
}

void main()
{
	origWndProc = on_message;
	on_message = hkWndProc;
}



Works fine too have fun with it

Top


Moderator:  adoado, checkbutton, Perro 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de