Results 1 to 3 of 3

Thread: Get the type of input

  1. #1

    Default Get the type of input

    Hi there,

    I've got something like this:
    Code:
    void MainMenu::onProcessMessage(CL_GUIMessage &msg)
    {
      if (msg.is_type(CL_GUIMessage_Input::get_type_name()))
      {
    	CL_GUIMessage_Input input = msg;
    	CL_InputEvent input_event = input.get_event();
    
      }
    }
    Now, I want to test, if the input comes from keyboard or mouse.
    How I have to realize that?

    Greez

  2. #2

    Default

    input_event.device.get_type() (? I haven't tested this)

  3. #3
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    Yes, rebecca is correct.

    See ClanLib/Sources/GUI/Components/Lineedit.cpp for an example.

    Code:
    		CL_GUIMessage_Input input_msg = msg;
    		CL_InputEvent e = input_msg.get_event();
    
    		if (e.device.get_type() == CL_InputDevice::keyboard)
    		{
    			....
    		}
    		else if (e.device.get_type() == CL_InputDevice::pointer)
    		{
    			....
    		}

Similar Threads

  1. What I would need to do to implement a new entity type or something?
    By speeder in forum Novashell Game Creation System
    Replies: 1
    Last Post: 08-18-2010, 05:10 AM
  2. CL_ProviderFactory: Unknown image provider type png
    By The User in forum Official ClanLib SDK Forums
    Replies: 9
    Last Post: 02-05-2010, 01:33 PM
  3. A Castlevania/Metroid type game
    By illspirit in forum Novashell Game Creation System
    Replies: 20
    Last Post: 01-27-2009, 11:14 AM
  4. Sound Input
    By shade37337 in forum Official ClanLib SDK Forums
    Replies: 3
    Last Post: 09-22-2007, 01:01 AM
  5. Input Buffers
    By gmatt in forum Official ClanLib SDK Forums
    Replies: 7
    Last Post: 07-14-2007, 08:18 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
  •