Gamestudio Links
Zorro Links
Newest Posts
Deformers struct in MDL7 abspeichern.
by tagimbul
Today at 02:06
Votes for future features
by Hredot
Today at 01:48
What happens with particles, Memory wise?
by jumpman
Today at 00:41
Plotting on hour time scale
by Hredot
Yesterday at 17:42
Fetter ACSII Parser
by MasterQ32
Yesterday at 14:31
AUM Magazine
Latest Screens
RPG PARTY
Triton Wing now available on Steam
AckCon'17: Lotter vs The World
Triton Wing
ZeaL
Who's Online
8 registered (Dalla, AndrewAMD, firecrest, jyd, tagimbul, johnnyp, jrath, Hredot), 441 Guests and 4 Spiders online.
Key: Admin, Global Mod, Mod
Newest Members
CaptainPablo, blAx, BBX, jcadihere, Peeyotch
17759 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: 309
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: 1019
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: 309
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: 1080
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 | resources | magazine | manual | support faq | bugs | beta features

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) 3dgamestudio.net