1 /*---------------------------------------------------------------------------* 2 Project: NintendoWare 3 File: SmTouchPanelCamera.h 4 5 Copyright (C)2009-2010 Nintendo Co., Ltd./HAL Laboratory, Inc. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Revision: 1 $ 14 *---------------------------------------------------------------------------*/ 15 #ifndef SM_TOUCHPANEL_CAMERA_H_ 16 #define SM_TOUCHPANEL_CAMERA_H_ 17 18 #include <nw/os.h> 19 #include <nw/gfx.h> 20 #include "../include/SmMessage.h" 21 #include "../include/SmCamera.h" 22 #include "../include/SmButton.h" 23 #include "../include/SmRectCollision.h" 24 25 //------------------------------------------------------------------------------ 26 // �^�b�`�p�l���J�����N���X 27 class SmTouchPanelCamera : public SmMessage 28 { 29 enum 30 { 31 SM_TOUCH_PANEL_CAMERA_SLIDER = 0 32 }; 33 34 public: 35 // �R���X�g���N�^ 36 SmTouchPanelCamera( SmCamera* smcamera ); 37 38 // �f�X�g���N�^ ~SmTouchPanelCamera()39 ~SmTouchPanelCamera(){} 40 41 // ���b�Z�[�W��M 42 virtual bool ReceveMessage( SmMessageType type, void* object, uint targetId ); 43 44 // �`�� 45 virtual void Render(); 46 47 // �L��/���� SetEnable(bool enable)48 virtual void SetEnable( bool enable ) 49 { 50 SmMessage::SetEnable( enable ); 51 52 // m_Camera �̏�Ԃ������p�� 53 if ( GetEnable() ) 54 { 55 // �J�������_ 56 m_SmCamera->GetPosition( &m_CameraPos ); 57 58 // �J���������_ 59 m_SmCamera->GetTarget( &m_CameraTarget ); 60 61 // �J�������� 62 m_CameraToward.x = m_CameraTarget.x - m_CameraPos.x; 63 m_CameraToward.y = m_CameraTarget.y - m_CameraPos.y; 64 m_CameraToward.z = m_CameraTarget.z - m_CameraPos.z; 65 m_CameraToward.Normalize(); 66 67 // ���E��U��l�������� 68 m_DegX = m_DegY = 0.f; 69 } 70 } 71 72 private: 73 void calcCamera(); 74 void updateCamera(); 75 76 private: 77 SmCamera* m_SmCamera; 78 79 nw::math::VEC3 m_CameraPos; 80 nw::math::VEC3 m_CameraTarget; 81 nw::math::VEC3 m_CameraToward; // ���� 82 83 SmRectCollision m_Collision; 84 85 bool m_IsGrab; 86 87 s32 m_TouchPanelPosLastX; 88 s32 m_TouchPanelPosLastY; 89 s32 m_TouchPanelPosX; 90 s32 m_TouchPanelPosY; 91 f32 m_DegX; 92 f32 m_DegY; 93 }; 94 95 96 #endif // SM_TOUCHPANEL_CAMERA_H_ 97