Results 1 to 4 of 4

Thread: Use SDL to add keypress to keyboard buffer?

  1. #1

    Use SDL to add keypress to keyboard buffer?

    Hi all,
    I know I can get keyboard input using SDL, and even move the mouse using WarpMouse()...but is there a way of taking an SDL key symbol and simulating this key being pressed on the keyboard progmatically just like it was pressed by the user?

    I would like to only use SDL to do this, or at least some cross-platform way...

    I am wanting to make a virtual keyboard for the GP2X by clicking on virtual keys which add keys to the keyboard buffer. This could be handy for some programs.

    cheers,
    Paul.

  2. #2

    Use SDL to add keypress to keyboard buffer?

    Use an array.

    Have a routine which captures SDL input codes and stores them in an array. Use this array as the core of your input system. Then when you want to programatically set keys... set the elements of the array. This system also gets around SDL's inabililty to handle key repeats

  3. #3

    Use SDL to add keypress to keyboard buffer?

    Quote Originally Posted by jasonf
    Use an array.

    Have a routine which captures SDL input codes and stores them in an array. Use this array as the core of your input system. Then when you want to programatically set keys... set the elements of the array. This system also gets around SDL's inabililty to handle key repeats
    Sorry, but I don't think I was clear enough in my post
    I want to send keypresses from my program into other running applications just like I had pressed the key(s) on the keyboard, but hopefully using SDL or another cross-platform way that is available on Windows and Linux and GP2X Linux-ARM (ultimately)...

    Something similar to the keybd_event() method in Win32.
    cheers,
    Paul.

  4. #4

    Use SDL to add keypress to keyboard buffer?

    Create SDL_KeyboardEvent and use SDL_PushEvent function to add it to the events queue.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •