Results 1 to 3 of 3

Thread: Slots and Keyboard

  1. #1

    Default Slots and Keyboard

    I am trying to get a handle on Signals and slots but am having some trouble. I am using ClanLib 0.8.0. I can easily associate a Timer Signal with a class function but the Keyboard signals are complaining or cause a segmentation fault. All the examples I have been able to find are for 0.6.x and don't seem to work in 0.8.0

    All I really need to do is bind the sig_key_down with a class function but what I would really like to be able to do is bind a specific key to a function.

    Here are a few things I have tried

    CL_SlotContainer myslots;
    myslots.connect(CL_Keyboard::sig_key_down(),this,& ClanSimpleApp::GridOnOff);
    (Compiles but gives Segmentation Fault)

    and

    CL_Slot keypress = CL_Keyboard::sig_key_down().connect(this,
    &ClanSimpleApp::GridOnOff);
    (Compiles but gives Segmentation Fault)



    void ClanSimpleApp::GridOnOff(const CL_InputEvent &i)
    {
    //Code Here
    }

  2. #2
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Bergen, Norway
    Posts
    588

    Default

    Does input work in the AdventureScene example? It uses signals to hook up to keyboards. You can also check out BlendFunctions or Input examples.

  3. #3

    Default Thanks

    Just goes to show you that the last place you look is right under your nose. I have searched the web up and down and those examples helped me fix 90% of my problems. The problem was not the way I was using the slots but the way I was calling the Display functions, the keyboard signals just made the problem show up.

    Thanks for the help

Similar Threads

  1. keyboard controlls??
    By Gexy in forum Funeral Quest
    Replies: 3
    Last Post: 01-31-2006, 05:36 PM
  2. picking up items using keyboard
    By rpgnut in forum Dink Smallwood HD
    Replies: 3
    Last Post: 01-31-2005, 04:16 PM

Bookmarks

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
  •