/*---------------------------------------------------------------------------* Project: NintendoWare File: SmPadStatus.h Copyright (C)2009-2011 Nintendo/HAL Laboratory, Inc. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo and/or its licensed developers and are protected by national and international copyright laws. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. The content herein is highly confidential and should be handled accordingly. $Revision: $ *---------------------------------------------------------------------------*/ #ifndef SM_PAD_STATUS_H_ #define SM_PAD_STATUS_H_ #include #include "../include/SmDef.h" //------------------------------------------------------------------------------ // パッドステータス class SmPadStatus { public: //! コンストラクタ SmPadStatus(){} //! パッドキー enum { SM_BUTTON_A = nn::hid::CTR::BUTTON_A, SM_BUTTON_B = nn::hid::CTR::BUTTON_B, SM_BUTTON_X = nn::hid::CTR::BUTTON_X, SM_BUTTON_Y = nn::hid::CTR::BUTTON_Y, SM_BUTTON_R = nn::hid::CTR::BUTTON_R, SM_BUTTON_L = nn::hid::CTR::BUTTON_L, SM_BUTTON_UP = nn::hid::CTR::BUTTON_UP, SM_BUTTON_DOWN = nn::hid::CTR::BUTTON_DOWN, SM_BUTTON_RIGHT = nn::hid::CTR::BUTTON_RIGHT, SM_BUTTON_LEFT = nn::hid::CTR::BUTTON_LEFT, SM_BUTTON_START = nn::hid::CTR::BUTTON_START }; typedef u32 SmPadBtn; //! トリガー検知します bool IsTrigger( SmPadBtn preeBtn ) { return ( padStatus.trigger & preeBtn ); } //! ホールドを検知します。 bool IsHold( SmPadBtn preeBtn ) { return ( padStatus.hold & preeBtn ); } // アナログスティックの値を取得する f32 GetStickX() { return padReader.NormalizeStick(padStatus.stick.x); } f32 GetStickY() { return padReader.NormalizeStick(padStatus.stick.y); } // hid のパッドステータスを取得する(更新用) nn::hid::CTR::PadStatus* GetHidPadStatus() { return &padStatus; } // hid のパッドリーダーを取得する(更新用) nn::hid::CTR::PadReader* GetHidPadReader() { return &padReader; } private: nn::hid::CTR::PadReader padReader; nn::hid::CTR::PadStatus padStatus; }; #endif // SM_PAD_STATUS_H_