Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Feature request, input keys other than arrows
#1
Hello, the TLN_Input enum doesn't allow us to use keys other than arrows for player movement

enum  TLN_Input { 
  INPUT_NONEINPUT_UP,INPUT_DOWNINPUT_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.
Reply
#2
TLN_DefineInputKey() is the way to assign the predefined functions to the keys you want
Reply
#3
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.
Reply
#4
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)