/** SGX

The   sss    gggg x   x   
     s      g      x x    Engine
      sss   g  gg   x
         s  g   g  x x          Copyright 1995-2008.
     ssss    gggg x   x         Steven Goodwin. All Rights Reserved.
    
This version has been released under the GNU Public License v2.0.

Please see the license files for details.

File: src/sgx/input/controlbutton.cpp

*/

#include "sgx/core/core.hpp"
#include "sgx/input/input.hpp"

CSGXInputManager::CControlButton::CControlButton()
{
	reset();
}

void 
CSGXInputManager::CControlButton::reset()
{
	m_bPressed = FALSE;
	m_bReleased = FALSE;
	m_bIsUp = FALSE;
	m_bIsDown = FALSE;
}

void 
CSGXInputManager::CControlButton::update(const tREAL32 telaps)
{
SGX_UNUSED(telaps);
	m_bPressed = FALSE;
	m_bReleased = FALSE;
}


// NOTE: Implied data throughout
void 
CSGXInputManager::CControlButton::applyButtonDown()
{
	// Infer: Key is now down, but was up.
	m_bPressed = m_bIsUp;
	m_bReleased = FALSE;

	m_bIsUp = FALSE;
	m_bIsDown = TRUE;
}

void 
CSGXInputManager::CControlButton::applyButtonUp()
{
	// Infer: Key is now up, but was down.
	m_bReleased = m_bIsDown;
	m_bPressed = FALSE;

	m_bIsUp = TRUE;
	m_bIsDown = FALSE;
}

void 
CSGXInputManager::CControlButton::applyButtonPressed()
{
	m_bPressed = TRUE;
	m_bReleased = FALSE;

	m_bIsUp = FALSE;
	m_bIsDown = TRUE;
}

void 
CSGXInputManager::CControlButton::applyButtonReleased()
{
	m_bPressed = FALSE;
	m_bReleased = TRUE;

	m_bIsUp = TRUE;
	m_bIsDown = FALSE;
}
