Gamestudio Links
Zorro Links
Newest Posts
Access string content through another string
by ChrstphFr
47 minutes 19 seconds ago
How to return a vector from a function
by jumpman
Today at 01:24
Vector Displacement, realtime Blendshapes
by jumpman
Yesterday at 23:46
Code Repository
by OptimusPrime
Yesterday at 13:25
Votes for future features
by OptimusPrime
Yesterday at 07:18
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14
08/13/18 22:44
Getting Maximum and Minimun Values from Array
by Tavasy
08/13/18 20:38
AUM Magazine
Latest Screens
AckCon'18 - Lotter vs the World 2 - Preview Release
Evonet Beta v1.0 : Online Project Development Template
Lake scene
Forgotten Tales - Demo version
Who's Online
11 registered (Ulenspegel, jyd, ChrstphFr, OptimusPrime, HamSelv, jumpman, AndrewAMD, wdlmaster, 3 invisible), 489 Guests and 7 Spiders online.
Key: Admin, Global Mod, Mod
Newest Members
toto, FloMi, behr065, OptimusPrime, bailemad
18026 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 Online
Serious User

Registered: 06/13/07
Posts: 1159
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