SDXFrameWork  0.13
SDXFrameWork
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
Public Member Functions | Public Attributes | List of all members
SDX::Key Class Reference

各ボタンとキーを表すクラス. More...

#include <Key.h>

Public Member Functions

void Reset ()
 キーのリセット. More...
 
void Update (bool 押下フラグ)
 押下状態の更新. More...
 

Public Attributes

bool on = false
 押した瞬間
 
bool off = false
 離した瞬間
 
bool hold = false
 押されている
 
unsigned int holdCount = 0
 押されている時間
 

Detailed Description

各ボタンとキーを表すクラス.

//Copyright © 2014 SDXFramework
//[License]GNU Affero General Public License, version 3
//[Contact]http://sourceforge.jp/projects/dxframework/
//入力を取得する
bool SampleInput()
{
using namespace SDX;
System::Initialise("sample", 640, 480);
std::string message = "クリックするかZキーを押して";
while (System::Update())
{
if (Input::mouse.Left.on){ message = "クリックした"; }
if (Input::mouse.Left.off){ message = "離した"; }
if (Input::key[KeyCode::Z].hold){ message = "Zを押している"; }//列挙子でのキー指定も可能
if (Input::key.Z.holdCount > 60){ message = "Zを長押し"; }
//マウスの位置に文字を描画
if (Input::key.Return.on){ break;}//Enterで終了
}
return true;
}

Member Function Documentation

void SDX::Key::Reset ( )
inline

キーのリセット.

void SDX::Key::Update ( bool  押下フラグ)
inline

押下状態の更新.