Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4386 in orxonox.OLD for orxonox/trunk


Ignore:
Timestamp:
May 29, 2005, 11:33:49 PM (20 years ago)
Author:
patrick
Message:

orxonox/trunk: key mapper implementation precess

Location:
orxonox/trunk/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/Makefile.am

    r4381 r4386  
    5959                 util/event/event_handler.cc \
    6060                 util/event/event_listener.cc \
     61                 util/event/key_mapper.cc \
    6162                 util/object_manager.cc \
    6263                 util/garbage_collector.cc \
     
    124125                 util/event/event_listener.h \
    125126                 util/event/event_handler.h \
     127                 util/event/key_mapper.h \
    126128                 util/object_manager.h \
    127129                 util/garbage_collector.h \
  • orxonox/trunk/src/Makefile.in

    r4381 r4386  
    5959        animation_player.$(OBJEXT) event.$(OBJEXT) \
    6060        event_handler.$(OBJEXT) event_listener.$(OBJEXT) \
    61         object_manager.$(OBJEXT) garbage_collector.$(OBJEXT) \
    62         list.$(OBJEXT) resource_manager.$(OBJEXT) factory.$(OBJEXT) \
     61        key_mapper.$(OBJEXT) object_manager.$(OBJEXT) \
     62        garbage_collector.$(OBJEXT) list.$(OBJEXT) \
     63        resource_manager.$(OBJEXT) factory.$(OBJEXT) \
    6364        load_param.$(OBJEXT) state.$(OBJEXT) story_entity.$(OBJEXT) \
    6465        campaign.$(OBJEXT) world.$(OBJEXT) world_entity.$(OBJEXT) \
     
    9899@AMDEP_TRUE@    ./$(DEPDIR)/graphics_engine.Po \
    99100@AMDEP_TRUE@    ./$(DEPDIR)/helper_parent.Po \
    100 @AMDEP_TRUE@    ./$(DEPDIR)/ini_parser.Po ./$(DEPDIR)/keynames.Po \
     101@AMDEP_TRUE@    ./$(DEPDIR)/ini_parser.Po \
     102@AMDEP_TRUE@    ./$(DEPDIR)/key_mapper.Po ./$(DEPDIR)/keynames.Po \
    101103@AMDEP_TRUE@    ./$(DEPDIR)/light.Po ./$(DEPDIR)/list.Po \
    102104@AMDEP_TRUE@    ./$(DEPDIR)/load_param.Po ./$(DEPDIR)/material.Po \
     
    272274                 util/event/event_handler.cc \
    273275                 util/event/event_listener.cc \
     276                 util/event/key_mapper.cc \
    274277                 util/object_manager.cc \
    275278                 util/garbage_collector.cc \
     
    337340                 util/event/event_listener.h \
    338341                 util/event/event_handler.h \
     342                 util/event/key_mapper.h \
    339343                 util/object_manager.h \
    340344                 util/garbage_collector.h \
     
    504508@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/helper_parent.Po@am__quote@
    505509@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ini_parser.Po@am__quote@
     510@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/key_mapper.Po@am__quote@
    506511@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keynames.Po@am__quote@
    507512@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/light.Po@am__quote@
     
    718723@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    719724@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o event_listener.obj `if test -f 'util/event/event_listener.cc'; then $(CYGPATH_W) 'util/event/event_listener.cc'; else $(CYGPATH_W) '$(srcdir)/util/event/event_listener.cc'; fi`
     725
     726key_mapper.o: util/event/key_mapper.cc
     727@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT key_mapper.o -MD -MP -MF "$(DEPDIR)/key_mapper.Tpo" -c -o key_mapper.o `test -f 'util/event/key_mapper.cc' || echo '$(srcdir)/'`util/event/key_mapper.cc; \
     728@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/key_mapper.Tpo" "$(DEPDIR)/key_mapper.Po"; else rm -f "$(DEPDIR)/key_mapper.Tpo"; exit 1; fi
     729@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='util/event/key_mapper.cc' object='key_mapper.o' libtool=no @AMDEPBACKSLASH@
     730@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/key_mapper.Po' tmpdepfile='$(DEPDIR)/key_mapper.TPo' @AMDEPBACKSLASH@
     731@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     732@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o key_mapper.o `test -f 'util/event/key_mapper.cc' || echo '$(srcdir)/'`util/event/key_mapper.cc
     733
     734key_mapper.obj: util/event/key_mapper.cc
     735@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT key_mapper.obj -MD -MP -MF "$(DEPDIR)/key_mapper.Tpo" -c -o key_mapper.obj `if test -f 'util/event/key_mapper.cc'; then $(CYGPATH_W) 'util/event/key_mapper.cc'; else $(CYGPATH_W) '$(srcdir)/util/event/key_mapper.cc'; fi`; \
     736@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/key_mapper.Tpo" "$(DEPDIR)/key_mapper.Po"; else rm -f "$(DEPDIR)/key_mapper.Tpo"; exit 1; fi
     737@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='util/event/key_mapper.cc' object='key_mapper.obj' libtool=no @AMDEPBACKSLASH@
     738@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/key_mapper.Po' tmpdepfile='$(DEPDIR)/key_mapper.TPo' @AMDEPBACKSLASH@
     739@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     740@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o key_mapper.obj `if test -f 'util/event/key_mapper.cc'; then $(CYGPATH_W) 'util/event/key_mapper.cc'; else $(CYGPATH_W) '$(srcdir)/util/event/key_mapper.cc'; fi`
    720741
    721742object_manager.o: util/object_manager.cc
  • orxonox/trunk/src/command_node.cc

    r4361 r4386  
    271271          cmd.bUp = true;
    272272          if( strlen (cmd.cmd) > 0) relay(&cmd);
    273           printf("mouse activity: %i \n", event.key.keysym.sym );
    274273          break;
    275274        case SDL_MOUSEBUTTONDOWN:
  • orxonox/trunk/src/util/event/event_handler.cc

    r4381 r4386  
    2222#include "event.h"
    2323
    24 #include "ini_parser.h"
    25 #include "keynames.h"
    2624#include "compiler.h"
    2725#include "debug.h"
  • orxonox/trunk/src/util/event/event_handler.h

    r4369 r4386  
    1616
    1717
    18 //! Key aliasing structure
    19 /**
    20    This structure contains the key aliasing information, e.g. the command strings that
    21    have been bound to the keys.
    22 */
    23 typedef struct
    24 {
    25   char keys[N_STD_KEYS][CMD_LENGHT];
    26   char buttons[N_BUTTONS][CMD_LENGHT];
    27 } KeyBindings;
     18
    2819
    2920
     
    5041 private:
    5142  static EventHandler* singletonRef;
    52   KeyBindings* keyAliases;
    5343  EventListener*** listeners;                         //!< a list of registered listeners
    5444  elState state;
  • orxonox/trunk/src/util/event/key_mapper.cc

    r4369 r4386  
    1616#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_EVENT
    1717
    18 #include "event.h"
     18#include "key_mapper.h"
     19
     20#include "ini_parser.h"
     21#include "keynames.h"
    1922
    2023using namespace std;
     24
     25
     26
     27int KeyMapper::PEV_UP = -1;
     28int KeyMapper::PEV_DOWN = -1;
     29int KeyMapper::PEV_LEFT = -1;
     30int KeyMapper::PEV_RIGHT = -1;
     31int KeyMapper::PEV_STRAFE_LEFT = -1;
     32int KeyMapper::PEV_STRAFE_RIGHT = -1;
     33
     34int KeyMapper::PEV_FIRE1 = -1;
     35int KeyMapper::PEV_FIRE2 = -1;
     36
     37int KeyMapper::PEV_VIEW1 = -1;
     38int KeyMapper::PEV_VIEW2 = -1;
     39int KeyMapper::PEV_VIEW3 = -1;
     40int KeyMapper::PEV_VIEW4 = -1;
     41
    2142
    2243
     
    2849{
    2950   this->setClassID(CL_KEY_MAPPER, "KeyMapper");
    30 
     51   this->keyAliases = NULL;
    3152}
    3253
     
    4162}
    4263
    43 
     64\
    4465/**
    4566   \brief loads new key bindings from a file
     
    115136  while( parser.nextVar (namebuf, valuebuf) != -1)
    116137    {
    117       //index = nameToIndex (valuebuf);     
    118       int c;
    119       if( (c = keynameToSDLK (valuebuf)) != -1)
    120         {
    121           index[1] = c; index[0] = 0;
    122         }
    123       if( (c = buttonnameToSDLB (valuebuf)) != -1)
    124         {
    125           index[1] = c; index[0] = 1;
    126         }
    127 
     138      index = nameToIndex (valuebuf);     
    128139
    129140      switch( index[0])
     
    144155    }
    145156}
     157
     158
     159
     160int* KeyMapper::nameToIndex (char* name)
     161{
     162  coord[0] = -1;
     163  coord[1] = -1;
     164  int c;
     165  if( (c = keynameToSDLK (name)) != -1)
     166    {
     167      coord[1] = c;
     168      coord[0] = 0;
     169    }
     170  if( (c = buttonnameToSDLB (name)) != -1)
     171    {
     172      coord[1] = c;
     173      coord[0] = 1;
     174    }
     175  return coord;
     176}
  • orxonox/trunk/src/util/event/key_mapper.h

    r4368 r4386  
    1111#include "base_object.h"
    1212#include "event_def.h"
     13
     14
     15//! Key aliasing structure
     16/**
     17   This structure contains the key aliasing information, e.g. the command strings that
     18   have been bound to the keys.
     19*/
     20typedef struct
     21{
     22  char keys[N_STD_KEYS][CMD_LENGHT];
     23  char buttons[N_BUTTONS][CMD_LENGHT];
     24} KeyBindings;
    1325
    1426
     
    4456 private:
    4557  KeyBindings* keyAliases;
     58  Sint32 coord[2];
    4659};
    4760
Note: See TracChangeset for help on using the changeset viewer.