1 /*---------------------------------------------------------------------------*
2   Project:  NintendoWare
3   File:     SmTouchPanelCamera.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_TOUCHPANEL_CAMERA_H_
18 #define SM_TOUCHPANEL_CAMERA_H_
19 
20 #include <nw/os.h>
21 #include <nw/gfx.h>
22 #include "../include/SmMessage.h"
23 #include "../include/SmCamera.h"
24 #include "../include/SmButton.h"
25 #include "../include/SmRectCollision.h"
26 
27 //------------------------------------------------------------------------------
28 // �^�b�`�p�l���J�����N���X
29 class SmTouchPanelCamera : public SmMessage
30 {
31     enum
32     {
33         SM_TOUCH_PANEL_CAMERA_SLIDER = 0
34     };
35 
36 public:
37     // �R���X�g���N�^
38     SmTouchPanelCamera( SmCamera* smcamera );
39 
40     // �f�X�g���N�^
~SmTouchPanelCamera()41     ~SmTouchPanelCamera(){}
42 
43     // ���b�Z�[�W��M
44     virtual bool ReceveMessage( SmMessageType type, void* object, uint targetId );
45 
46     // �`��
47     virtual void Render();
48 
49     // �L��/����
SetEnable(bool enable)50     virtual void SetEnable( bool enable )
51     {
52         SmMessage::SetEnable( enable );
53 
54         // m_Camera �̏�Ԃ������p��
55          if ( GetEnable() )
56         {
57             // �J�������_
58             m_SmCamera->GetPosition( &m_CameraPos );
59 
60             // �J���������_
61             m_SmCamera->GetTarget( &m_CameraTarget );
62 
63             // �J��������
64             m_CameraToward.x = m_CameraTarget.x - m_CameraPos.x;
65             m_CameraToward.y = m_CameraTarget.y - m_CameraPos.y;
66             m_CameraToward.z = m_CameraTarget.z - m_CameraPos.z;
67             m_CameraToward.Normalize();
68 
69             // ���E��U��l��������
70             m_DegX = m_DegY = 0.f;
71         }
72     }
73 
74 private:
75     void calcCamera();
76     void updateCamera();
77 
78 private:
79     SmCamera*           m_SmCamera;
80 
81     nw::math::VEC3      m_CameraPos;
82     nw::math::VEC3      m_CameraTarget;
83     nw::math::VEC3      m_CameraToward; // ����
84 
85     SmRectCollision     m_Collision;
86 
87     bool                m_IsGrab;
88 
89     s32                 m_TouchPanelPosLastX;
90     s32                 m_TouchPanelPosLastY;
91     s32                 m_TouchPanelPosX;
92     s32                 m_TouchPanelPosY;
93     f32                 m_DegX;
94     f32                 m_DegY;
95 };
96 
97 
98 #endif  // SM_TOUCHPANEL_CAMERA_H_
99