1 /*---------------------------------------------------------------------------* 2 Project: NintendoWare 3 File: framework.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 FRAMEWORK_H__ 16 #define FRAMEWORK_H__ 17 18 #include "../include/SmMessage.h" 19 20 //------------------------------------------------------------------------------ 21 //! �f���̃t���[�����[�N�X�e�[�^�X���Ǘ����܂��B 22 class FrameWorkStatus 23 { 24 public: 25 //! �R���X�g���N�^ FrameWorkStatus()26 FrameWorkStatus() 27 { 28 m_IsCommandDouble = true; 29 m_IsLayoutVisible = true; 30 m_IsCpuMeterVisible = true; 31 m_IsPalying = true; 32 m_IsFirstLoop = true; 33 m_IsAddFrame = false; 34 35 m_Frame = 0.f; 36 } 37 38 // �R�}���h�o�b�t�@���[�h�ؑ� SwapCommandBufferMode()39 void SwapCommandBufferMode() 40 { 41 if ( m_IsCommandDouble ) 42 { 43 m_IsCommandDouble = false; 44 NW_DEV_LOG( "[DEMO] Command Buffer Single\n\n" ); 45 } 46 else 47 { 48 m_IsCommandDouble = true; 49 NW_DEV_LOG( "[DEMO] Command Buffer Double\n\n" ); 50 } 51 } 52 53 // ���C�A�E�g�`��I���I�t�ؑ� SwapLayoutVisible()54 void SwapLayoutVisible() 55 { 56 if ( m_IsLayoutVisible ) 57 { 58 m_IsLayoutVisible = false; 59 NW_DEV_LOG( "[DEMO] Layout Draw Off\n\n" ); 60 } 61 else 62 { 63 m_IsLayoutVisible = true; 64 NW_DEV_LOG( "[DEMO] Layout Draw On\n\n" ); 65 } 66 } 67 68 // OpenGL�`��I���I�t�ؑ� SwapCpuMeterVisible()69 void SwapCpuMeterVisible() 70 { 71 if ( m_IsCpuMeterVisible ) 72 { 73 m_IsCpuMeterVisible = false; 74 NW_DEV_LOG( "[DEMO] Cpu Meter Draw Off\n\n" ); 75 } 76 else 77 { 78 m_IsCpuMeterVisible = true; 79 NW_DEV_LOG( "[DEMO] Cpu Meter Draw On\n\n" ); 80 } 81 } 82 83 // �Đ�/��~��ւ� SwapPlay()84 void SwapPlay() 85 { 86 if ( m_IsPalying ) 87 { 88 m_IsPalying = false; 89 NW_DEV_LOG( "[DEMO] Demo Stop\n\n" ); 90 } 91 else 92 { 93 m_IsPalying = true; 94 NW_DEV_LOG( "[DEMO] Demo Play\n\n" ); 95 } 96 } 97 98 // �t���[����i�߂� AddFrame(f32 addFrame)99 void AddFrame( f32 addFrame ) 100 { 101 m_Frame += addFrame; 102 } 103 104 // �t���[�����擾���� GetFrame()105 f32 GetFrame() 106 { 107 return m_Frame; 108 } 109 110 // �t���[����ݒ肷�� SetFrame(f32 frane)111 void SetFrame( f32 frane ) 112 { 113 m_Frame = frane; 114 } 115 116 // �R�}����t���O��ݒ肷�� SetAddFrame()117 void SetAddFrame() 118 { 119 m_IsAddFrame = true; 120 NW_DEV_LOG( "[DEMO] Demo Add Frame\n\n" ); 121 } 122 123 // �R�}����t���O���擾���� GetAddFrame()124 bool GetAddFrame() 125 { 126 bool temp = m_IsAddFrame; 127 m_IsAddFrame = false; 128 return temp; 129 } 130 IsCommandBufferDouble()131 bool IsCommandBufferDouble() { return m_IsCommandDouble; } IsLayoutVisible()132 bool IsLayoutVisible() { return m_IsLayoutVisible; } IsCpuMeterVisible()133 bool IsCpuMeterVisible() { return m_IsCpuMeterVisible; } IsPlaying()134 bool IsPlaying() { return m_IsPalying; } 135 SetTimerStart()136 void SetTimerStart() 137 { 138 m_StartTime = nn::os::Tick::GetSystemCurrent().ToTimeSpan().GetMicroSeconds(); 139 } 140 SetTimerEnd()141 void SetTimerEnd() 142 { 143 m_EndTime = nn::os::Tick::GetSystemCurrent().ToTimeSpan().GetMicroSeconds(); 144 m_AllTime = m_EndTime - m_StartTime; 145 } 146 GetAllTime()147 f32 GetAllTime() 148 { 149 return m_AllTime/1000.f; 150 } 151 SetGpuWaitStart()152 void SetGpuWaitStart() 153 { 154 m_GpuWaitStartTime = nn::os::Tick::GetSystemCurrent().ToTimeSpan().GetMicroSeconds(); 155 } 156 SetGpuWaitEnd()157 void SetGpuWaitEnd() 158 { 159 m_GpuWaitEndTime = nn::os::Tick::GetSystemCurrent().ToTimeSpan().GetMicroSeconds(); 160 m_GpuWaitTime = m_GpuWaitEndTime - m_GpuWaitStartTime; 161 } 162 GetGpuWaitTime()163 f32 GetGpuWaitTime() 164 { 165 return m_GpuWaitTime/1000.f; 166 } 167 168 // �R�}���h�o�b�t�@�ɐς܂�Ă��郊�N�G�X�g�����擾���܂��B UpdateUsedReqCount()169 void UpdateUsedReqCount() 170 { 171 nngxGetCmdlistParameteri(NN_GX_CMDLIST_USED_REQCOUNT, &m_UsedReqCount); 172 } 173 GetUsedReqCount()174 GLint GetUsedReqCount() 175 { 176 return m_UsedReqCount; 177 } 178 179 private: 180 bool m_IsCommandDouble; // �R�}���h�o�b�t�@ �_�u��/�V���O�� 181 bool m_IsLayoutVisible; // Layout �`�悷��/�`�悵�Ȃ� 182 bool m_IsCpuMeterVisible; // OpenGL �`�悷��/�`�悵�Ȃ� 183 bool m_IsPalying; // �Đ�������~���� 184 bool m_IsAddFrame; // �R�}���� 185 bool m_IsFirstLoop; 186 f32 m_Frame; 187 188 u64 m_StartTime; 189 u64 m_EndTime; 190 u64 m_AllTime; 191 192 u64 m_GpuWaitStartTime; 193 u64 m_GpuWaitEndTime; 194 u64 m_GpuWaitTime; 195 196 GLint m_UsedReqCount; 197 }; 198 199 200 #endif // FRAMEWORK_H__ 201