Example #1
0
void StateHowtoplay::buttonDown(Gosu::Button btn)
{
    if (btn.id() == Gosu::kbEscape || btn.id() == Gosu::msLeft)
    {
        mGame -> changeState("stateMainMenu");
    }
}
Example #2
0
File: Input.cpp Project: 456z/gosu
bool Gosu::Input::down(Gosu::Button btn) const
{
    if (btn == noButton || btn.id() >= numButtons)
        return false;
    
    return pimpl->buttonStates[btn.id()];
}
Example #3
0
bool Gosu::Input::down(Gosu::Button btn) const
{
    if (btn == noButton)
        return false;

    // Will default to false for unknown indices (good).
    return pimpl->keyMap[btn.id()];
}
Example #4
0
wchar_t Gosu::Input::idToChar(Gosu::Button btn)
{
	// Only translate keyboard ids.
    if (btn.id() > 255)
        return 0;

    // Special case...?
    if (btn.id() == kbSpace)
        return L' ';

    // Try to get the key name.
    // (Three elements so too-long names will make GKNT return 3 and we'll know.)
    wchar_t buf[3];
    if (::GetKeyNameText(btn.id() << 16, buf, 3) == 1)
		return /*std::*/towlower(buf[0]);

    return 0;
}