Files
itgmania212121/stepmania/src/InputMapper.h
T

80 lines
2.4 KiB
C++
Raw Normal View History

#ifndef INPUTMAPPER_H
#define INPUTMAPPER_H
2002-04-16 17:31:00 +00:00
/*
-----------------------------------------------------------------------------
Class: InputMapper
Desc: Holds user-chosen preferences and saves it between sessions. This class
also has temporary holders for information that passed between windows - e.g.
2002-06-14 22:25:22 +00:00
GameplayStatistics.
2002-04-16 17:31:00 +00:00
2002-05-19 01:59:48 +00:00
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
2002-04-16 17:31:00 +00:00
Chris Danford
-----------------------------------------------------------------------------
*/
#include "RageInputDevice.h"
2002-04-16 17:31:00 +00:00
#include "GameInput.h"
#include "MenuInput.h"
#include "StyleInput.h"
2002-05-01 19:14:55 +00:00
#include "GameConstantsAndTypes.h"
2002-04-16 17:31:00 +00:00
const int NUM_GAME_TO_DEVICE_SLOTS = 3; // three device inputs may map to one game input
class InputMapper
{
public:
InputMapper();
~InputMapper();
void ReadMappingsFromDisk();
void SaveMappingsToDisk();
void ClearAllMappings();
2002-04-16 17:31:00 +00:00
void SetInputMap( DeviceInput DeviceI, GameInput GameI, int iSlotIndex );
2002-04-16 17:31:00 +00:00
void ClearFromInputMap( DeviceInput DeviceI );
void ClearFromInputMap( GameInput GameI, int iSlotIndex );
void AddDefaultMappingsForCurrentGameIfUnmapped();
2003-05-28 02:35:05 +00:00
void AutoMapJoysticksForCurrentGame();
bool IsMapped( DeviceInput DeviceI );
bool IsMapped( GameInput GameI );
2002-04-16 17:31:00 +00:00
bool DeviceToGame( DeviceInput DeviceI, GameInput& GameI ); // return true if there is a mapping from device to pad
bool GameToDevice( GameInput GameI, int iSoltNum, DeviceInput& DeviceI ); // return true if there is a mapping from pad to device
void GameToStyle( GameInput GameI, StyleInput &StyleI );
void StyleToGame( StyleInput StyleI, GameInput &GameI );
void GameToMenu( GameInput GameI, MenuInput &MenuI );
void MenuToGame( MenuInput MenuI, GameInput GameIout[4] );
2002-04-16 17:31:00 +00:00
2002-10-18 19:01:32 +00:00
float GetSecsHeld( GameInput GameI );
float GetSecsHeld( MenuInput MenuI );
float GetSecsHeld( StyleInput StyleI );
2002-04-16 17:31:00 +00:00
bool IsButtonDown( GameInput GameI );
bool IsButtonDown( MenuInput MenuI );
bool IsButtonDown( StyleInput StyleI );
protected:
// all the DeviceInputs that map to a GameInput
2002-07-27 19:29:51 +00:00
DeviceInput m_GItoDI[MAX_GAME_CONTROLLERS][MAX_GAME_BUTTONS][NUM_GAME_TO_DEVICE_SLOTS];
2002-04-16 17:31:00 +00:00
// lookup for efficiency from a DeviceInput to a GameInput
// This is repopulated every time m_PItoDI changes by calling UpdateTempDItoPI().
GameInput m_tempDItoGI[NUM_INPUT_DEVICES][NUM_DEVICE_BUTTONS];
void UpdateTempDItoGI();
};
2002-05-19 01:59:48 +00:00
extern InputMapper* INPUTMAPPER; // global and accessable from anywhere in our program
#endif