1 /*---------------------------------------------------------------------------*
2   Project:  NintendoWare
3   File:     SmPadStatus.h
4 
5   Copyright (C)2009-2011 Nintendo/HAL Laboratory, Inc.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain proprietary
8   information of Nintendo and/or its licensed developers and are protected by
9   national and international copyright laws. They may not be disclosed to third
10   parties or copied or duplicated in any form, in whole or in part, without the
11   prior written consent of Nintendo.
12 
13   The content herein is highly confidential and should be handled accordingly.
14 
15   $Revision: $
16  *---------------------------------------------------------------------------*/
17 #ifndef SM_PAD_STATUS_H_
18 #define SM_PAD_STATUS_H_
19 
20 #include <nn/hid/CTR/hid_TouchPanelReader.h>
21 #include "../include/SmDef.h"
22 
23 
24 //------------------------------------------------------------------------------
25 // �p�b�h�X�e�[�^�X
26 class SmPadStatus
27 {
28 public:
29     //! �R���X�g���N�^
SmPadStatus()30     SmPadStatus(){}
31 
32     //! �p�b�h�L�[
33     enum
34     {
35         SM_BUTTON_A         = nn::hid::CTR::BUTTON_A,
36         SM_BUTTON_B         = nn::hid::CTR::BUTTON_B,
37         SM_BUTTON_X         = nn::hid::CTR::BUTTON_X,
38         SM_BUTTON_Y         = nn::hid::CTR::BUTTON_Y,
39         SM_BUTTON_R         = nn::hid::CTR::BUTTON_R,
40         SM_BUTTON_L         = nn::hid::CTR::BUTTON_L,
41         SM_BUTTON_UP        = nn::hid::CTR::BUTTON_UP,
42         SM_BUTTON_DOWN      = nn::hid::CTR::BUTTON_DOWN,
43         SM_BUTTON_RIGHT     = nn::hid::CTR::BUTTON_RIGHT,
44         SM_BUTTON_LEFT      = nn::hid::CTR::BUTTON_LEFT,
45         SM_BUTTON_START     = nn::hid::CTR::BUTTON_START
46     };
47     typedef u32 SmPadBtn;
48 
49     //! �g���K�[���m���܂�
IsTrigger(SmPadBtn preeBtn)50     bool IsTrigger( SmPadBtn preeBtn )
51     {
52         return ( padStatus.trigger & preeBtn );
53     }
54 
55     //! �z�[���h�����m���܂��B
IsHold(SmPadBtn preeBtn)56     bool IsHold( SmPadBtn preeBtn )
57     {
58         return ( padStatus.hold & preeBtn );
59     }
60 
61     // �A�i���O�X�e�B�b�N�̒l���擾����
GetStickX()62     f32 GetStickX()
63     {
64         return padReader.NormalizeStick(padStatus.stick.x);
65     }
66 
GetStickY()67     f32 GetStickY()
68     {
69         return padReader.NormalizeStick(padStatus.stick.y);
70     }
71 
72     // hid �̃p�b�h�X�e�[�^�X���擾����(�X�V�p)
GetHidPadStatus()73     nn::hid::CTR::PadStatus* GetHidPadStatus()
74     {
75         return &padStatus;
76     }
77     // hid �̃p�b�h���[�_�[���擾����(�X�V�p)
GetHidPadReader()78     nn::hid::CTR::PadReader* GetHidPadReader()
79     {
80         return &padReader;
81     }
82 
83 
84 private:
85     nn::hid::CTR::PadReader padReader;
86     nn::hid::CTR::PadStatus padStatus;
87 };
88 
89 #endif  // SM_PAD_STATUS_H_
90