Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2733 in orxonox.OLD for orxonox/trunk


Ignore:
Timestamp:
Nov 5, 2004, 1:09:13 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk/gui: added keystrokes, and for testing added them to button Player

Location:
orxonox/trunk/gui
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/gui/orxonox_gui.cc

    r2623 r2733  
    188188
    189189/**
     190   \brief Connect a signal with additionally passing a whole external Object
     191*/
     192void Widget::connectSignal (char* event, void* extObj, gint (*signal)(GtkWidget*, GdkEventKey*, void *))
     193{
     194  g_signal_connect (G_OBJECT (this->widget), event, G_CALLBACK (signal), extObj);
     195}
     196
     197/**
    190198   \brief Moves through all the Widgets downwards from this and executes the function on them.
    191199   \param function must be of type void and takes a Widget* as an Input.
  • orxonox/trunk/gui/orxonox_gui.h

    r2635 r2733  
    5555  void connectSignal (char* event, gint (*signal)(GtkWidget*, Widget *));
    5656  void connectSignal (char* event, void* extObj, gint (*signal)(GtkWidget*, GdkEvent*, void *));
     57  void connectSignal (char* event, void* extObj, gint (*signal)(GtkWidget*, GdkEventKey*, void *));
    5758  void show ();
    5859  void hide ();
  • orxonox/trunk/gui/orxonox_gui_keys.cc

    r2625 r2733  
    3939 
    4040  keysBox->fill(player1->getOpenButton());
     41  player1->getOpenButton()->connectSignal("key_press_event", this, key_cb);
    4142
    4243  keysFrame->fill (keysBox);
     
    6970{
    7071  cout << "setting up Key: "<< key <<endl;
     72
    7173}
    7274
     
    7678}
    7779
     80
     81
     82gint key_cb(GtkWidget* w, GdkEventKey* event, void* widget)
     83{
     84  switch(event->keyval) {
     85
     86  case GDK_Up:
     87    printf("Up arrow key!\n");
     88    break;
     89  case GDK_Down:
     90    printf("Down arrow key!\n");
     91    break;
     92  case GDK_Right:
     93    printf("Right arrow key!\n");
     94    break;
     95  case GDK_Left:
     96    printf("Left arrow key!\n");
     97    break;
     98
     99  case GDK_space:
     100    printf("Space Pressed.\n");
     101    break;
     102
     103  case 65293:
     104    printf("Enter Pressed\n");
     105    break;
     106
     107    // Special Keys //
     108  case GDK_Shift_L:
     109    printf("Left Shift!\n");
     110    break;
     111  case GDK_Shift_R:
     112    printf("Right Shift!\n");
     113    break;
     114  case GDK_Control_L:
     115    printf("Left Control!\n");
     116    break;
     117  case GDK_Control_R:
     118    printf("Right Control!\n");
     119    break;
     120  case GDK_Alt_L:
     121    printf("Left Alt!\n");
     122    break;
     123  case GDK_Alt_R:
     124    printf("Rigth Alt!\n");
     125    break;
     126    // FXX KEYS //
     127  case GDK_F1:
     128    printf("F1!\n");
     129    break;
     130  case GDK_F2:
     131    printf("F2!\n");
     132    break;
     133  case GDK_F3:
     134    printf("F3!\n");
     135    break;
     136  case GDK_F4:
     137    printf("F4!\n");
     138    break;
     139  case GDK_F5:
     140    printf("F5!\n");
     141    break;
     142  case GDK_F6:
     143    printf("F6!\n");
     144    break;
     145  case GDK_F7:
     146    printf("F7!\n");
     147    break;
     148  case GDK_F8:
     149    printf("F8!\n");
     150    break;
     151  case GDK_F9:
     152    printf("F9\n");
     153    break;
     154  case GDK_F10:
     155    printf("F10!\n");
     156    break;
     157  case GDK_F11:
     158    printf("F11!\n");
     159    break;
     160  case GDK_F12:
     161    printf("F12!\n");
     162    break;
     163
     164
     165  default:
     166    printf ("other key %c \n", event->keyval,event->keyval);
     167    break;
     168  }
     169}
  • orxonox/trunk/gui/orxonox_gui_keys.h

    r2625 r2733  
    88
    99#include "orxonox_gui.h"
     10#include <gdk/gdkkeysyms.h>
    1011
    1112/**
     
    5152
    5253
    53    
     54gint key_cb(GtkWidget* w, GdkEventKey* event, gpointer data);
    5455
    5556#endif /* _ORXONOX_GUI_KEYS_H */
Note: See TracChangeset for help on using the changeset viewer.