Back to index

supertuxkart  0.5+dfsg1
Public Member Functions | Private Types | Private Member Functions | Private Attributes
ActionMap Class Reference

This thing is named after what is put in as values. More...

#include <actionmap.hpp>

Collaboration diagram for ActionMap:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void clear ()
void putEntry (Input, GameAction)
GameAction getEntry (Input)
GameAction getEntry (InputType, int, int, int)

Private Types

typedef std::pair< int, int > Key

Private Member Functions

Key key (Input)
Key key (InputType, int, int, int)

Private Attributes

std::map< Key, GameActioninputMap

Detailed Description

This thing is named after what is put in as values.

Definition at line 29 of file actionmap.hpp.


Member Typedef Documentation

typedef std::pair<int, int> ActionMap::Key [private]

Definition at line 31 of file actionmap.hpp.


Member Function Documentation

void ActionMap::clear ( )

Definition at line 46 of file actionmap.cpp.

{
    inputMap.clear();
}

Definition at line 34 of file actionmap.cpp.

{
       return inputMap[key(input)];
}

Here is the caller graph for this function:

GameAction ActionMap::getEntry ( InputType  type,
int  id0,
int  id1,
int  id2 
)

Definition at line 40 of file actionmap.cpp.

{
       return inputMap[key(type, id0, id1, id2)];
}
ActionMap::Key ActionMap::key ( Input  input) [inline, private]

Definition at line 52 of file actionmap.cpp.

{
       return key(input.type, input.id0, input.id1, input.id2);
}
ActionMap::Key ActionMap::key ( InputType  it,
int  id0,
int  id1,
int  id2 
) [private]

Definition at line 58 of file actionmap.cpp.

{
    /*
     * A short reminder on the bit distribution and their usage:
     * it gets 8 bits (InputType)
     * id1 gets 16 bits (button, hat or axis number)
     * id2 gets 8 bits (direction bit)
     * id0 gets 32 bits (That is because id0 can be the keyboard key ids and
     * those are unicode and unicode 4.0 is 32 bit)
     *
     * Assumption: int is (at least) 32 bit
     */
    return Key(it << 24 | id1 << 8 | id2, id0);
}
void ActionMap::putEntry ( Input  input,
GameAction  ga 
)

Definition at line 28 of file actionmap.cpp.

{
       inputMap[key(input)] = ga;
}

Here is the caller graph for this function:


Member Data Documentation

std::map<Key, GameAction> ActionMap::inputMap [private]

Definition at line 46 of file actionmap.hpp.


The documentation for this class was generated from the following files: