Gamestudio Links
Zorro Links
Newest Posts
Support and Resistance Zones/Cluster
by sdh309795gaas
Today at 05:22
Zig Zag function
by sdh309795gaas
Today at 04:12
What are you working on?
by Reconnoiter
Yesterday at 23:05
Square Root Rule & Additional Investment
by MatPed
Yesterday at 13:49
Optimal parameters for a basket of assets
by brax
Yesterday at 12:25
AUM Magazine
Latest Screens
Triton Wing
ZeaL
Computer Repair Simulator
Collider (working title)
Space Rider
Who's Online
9 registered (Dico, Dalla, sdh309795gaas, jyd, ddrrbb, Superku, Nanitek, jrath, 1 invisible), 417 Guests and 5 Spiders online.
Key: Admin, Global Mod, Mod
Newest Members
Marce, pascalx, SpaceNL, onlinejack, johnnyp
17716 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: 304
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
User

Registered: 06/13/07
Posts: 994
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: 304
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: 1076
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