Feature request, input keys other than arrows - Printable Version +- Tilengine - The 2D retro graphics engine forum (http://tilengine.org/forum) +-- Forum: English forums (http://tilengine.org/forum/forumdisplay.php?fid=3) +--- Forum: Support (http://tilengine.org/forum/forumdisplay.php?fid=7) +--- Thread: Feature request, input keys other than arrows (/showthread.php?tid=109) |
Feature request, input keys other than arrows - JaumeAlcazo - 06-04-2018 Hello, the TLN_Input enum doesn't allow us to use keys other than arrows for player movement enum TLN_Input { INPUT_NONE, INPUT_UP,INPUT_DOWN, INPUT_LEFT, INPUT_RIGHT,INPUT_BUTTON1,INPUT_BUTTON2,INPUT_BUTTON3, INPUT_BUTTON4,INPUT_BUTTON5,INPUT_BUTTON6,INPUT_START, INPUT_P1 = (PLAYER1 << 4),INPUT_P2 = (PLAYER2 << 4),INPUT_P3 = (PLAYER3 << 4),INPUT_P4 = (PLAYER4 << 4) } I would like to use WASD in addition to arrows, so I request INPUT_W, INPUT_A, INPUT_S and INPUT_D ooooh boy, OOOk, now I see this: TLNAPI void TLN_DefineInputKey (TLN_Playerplayer, TLN_Input input, uint32_t keycode) Ok, I'll check this. RE: Feature request, input keys other than arrows - megamarc - 06-05-2018 TLN_DefineInputKey() is the way to assign the predefined functions to the keys you want RE: Feature request, input keys other than arrows - JaumeAlcazo - 06-09-2018 Thanks Marc. I tried to override the default behaviour of esc key. By default it closes the program but I want it to close my current screen (map) so I've done: TLN_DefineInputKey(PLAYER1,INPUT_BUTTON5,SDLK_ESCAPE); and then check for input on BUTTON5 in the main loop. But it doesn't work. I see the default behavior for esc key. RE: Feature request, input keys other than arrows - megamarc - 06-22-2018 Some keys such as Escape an Backspace are predefined. The windowing subsystem was implemented to provide a simple environment for testing because Tilengine is just a rendering library. If you need more inputs, custom filtering, function bindings, overlaying external pictures... have you considered discarding the built-in windowing and providing your own framework? It shouldn't be difficult, the Window.c source file that implements the window system is open source, you can use it as a working example. |