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