2.50 checkin
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
#pragma once
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
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.
|
||||
ScoreSummary.
|
||||
|
||||
Copyright (c) 2001-2002 by the persons listed below. All rights reserved.
|
||||
Chris Danford
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "RageInput.h"
|
||||
#include "GameInput.h"
|
||||
#include "MenuInput.h"
|
||||
#include "StyleInput.h"
|
||||
#include "GameTypes.h"
|
||||
|
||||
|
||||
|
||||
const int NUM_GAME_TO_DEVICE_SLOTS = 3; // three device inputs may map to one game input
|
||||
|
||||
|
||||
class InputMapper
|
||||
{
|
||||
public:
|
||||
InputMapper();
|
||||
~InputMapper();
|
||||
|
||||
void SwitchGame( CString sNewGame )
|
||||
{
|
||||
SaveMappingsToDisk();
|
||||
m_sCurrentGame = sNewGame;
|
||||
ReadMappingsFromDisk();
|
||||
};
|
||||
|
||||
void ReadMappingsFromDisk();
|
||||
void SaveMappingsToDisk();
|
||||
|
||||
|
||||
// input mapping stuff
|
||||
void SetInputMap( DeviceInput DeviceI, GameInput GameI, int iSlotIndex, bool bOverrideHardCoded = false );
|
||||
void ClearFromInputMap( DeviceInput DeviceI );
|
||||
void ClearFromInputMap( GameInput GameI, int iSlotIndex );
|
||||
|
||||
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
|
||||
|
||||
MenuInput DeviceToMenu( DeviceInput DeviceI );
|
||||
DeviceInput MenuToDevice( MenuInput MenuI );
|
||||
|
||||
void GameToStyle( GameInput GameI, StyleInput &StyleI );
|
||||
void StyleToGame( StyleInput StyleI, GameInput &GameI );
|
||||
|
||||
void GameToMenu( GameInput GameI, MenuInput &MenuI );
|
||||
void MenuToGame( MenuInput MenuI, GameInput &GameI );
|
||||
|
||||
bool IsButtonDown( GameInput GameI );
|
||||
bool IsButtonDown( MenuInput MenuI );
|
||||
bool IsButtonDown( StyleInput StyleI );
|
||||
|
||||
|
||||
protected:
|
||||
CString m_sCurrentGame;
|
||||
|
||||
// all the DeviceInputs that map to a GameInput
|
||||
DeviceInput m_GItoDI[NUM_INSTRUMENTS][NUM_INSTRUMENT_BUTTONS][NUM_GAME_TO_DEVICE_SLOTS];
|
||||
|
||||
// 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();
|
||||
};
|
||||
|
||||
|
||||
extern InputMapper* MAPPER; // global and accessable from anywhere in our program
|
||||
Reference in New Issue
Block a user