Files
itgmania212121/stepmania/src/InputFilter.h
T

60 lines
1.6 KiB
C++
Raw Normal View History

#ifndef INPUTFILTER_H
#define INPUTFILTER_H
2002-04-16 17:31:00 +00:00
/*
-----------------------------------------------------------------------------
Class: InputFilter
Desc: Checks RageInput and generates a list of InputEvents, which can
represent when a button is first pressed, when a button is released,
or when an repeating input fires.
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 "RageInput.h"
2002-09-10 06:27:57 +00:00
const float TIME_BEFORE_SLOW_REPEATS = 0.25f;
2002-07-27 19:29:51 +00:00
const float TIME_BEFORE_FAST_REPEATS = 1.5f;
2002-04-16 17:31:00 +00:00
2002-05-01 19:14:55 +00:00
//const float TIME_BETWEEN_SLOW_REPEATS = 0.25f;
const float TIME_BETWEEN_SLOW_REPEATS = 0.125f;
2002-04-16 17:31:00 +00:00
const float TIME_BETWEEN_FAST_REPEATS = 0.125f;
enum InputEventType { IET_FIRST_PRESS, IET_SLOW_REPEAT, IET_FAST_REPEAT, IET_RELEASE };
class InputEvent : public DeviceInput
{
public:
InputEvent() { type=IET_FIRST_PRESS; };
InputEvent( InputDevice d, int b, InputEventType t ) { device=d; button=b; type=t; };
InputEvent( DeviceInput di, InputEventType t ) { device=di.device; button=di.button; type=t; };
InputEventType type;
};
2003-01-03 05:56:28 +00:00
typedef vector<InputEvent> InputEventArray;
2002-04-16 17:31:00 +00:00
class InputFilter
{
public:
InputFilter();
2002-04-16 17:31:00 +00:00
bool BeingPressed( DeviceInput di, bool Prev = false);
bool WasBeingPressed( DeviceInput di );
bool IsBeingPressed( DeviceInput di );
2002-10-18 19:01:32 +00:00
float GetSecsHeld( DeviceInput di );
2002-04-16 17:31:00 +00:00
void GetInputEvents( InputEventArray &array, float fDeltaTime );
2002-10-18 19:01:32 +00:00
float m_fSecsHeld[NUM_INPUT_DEVICES][NUM_DEVICE_BUTTONS];
2002-04-16 17:31:00 +00:00
};
2002-05-19 01:59:48 +00:00
extern InputFilter* INPUTFILTER; // global and accessable from anywhere in our program
2002-04-16 17:31:00 +00:00
#endif