ButtonMash.cpp

#include “ButtonMash.h”
#include

ButtonMash::ButtonMash(XInputHandler *inputHandler, XInputFctnPtr buttonPtr)
{
m_xinptHandler = inputHandler;
ButtonFunctionPointer = buttonPtr;
currentValue = 0.0f;
btnDown = false;
}

bool ButtonMash::Update(float fDT)
{
currentValue -= 0.001f;
if (currentValue < 0.0f) currentValue = 0.0f; if ((m_xinptHandler->*ButtonFunctionPointer)())
{
if (!btnDown)
currentValue += 0.1f;
btnDown = true;
}
else btnDown = false;

if (currentValue >= 1.0f) return true;
return false;
}

ButtonMash::~ButtonMash()
{
m_xinptHandler = nullptr;
ButtonFunctionPointer = nullptr;
}