/*---------------------------------------------------------------------------* Project: NintendoWare File: framework.h Copyright (C)2009-2010 Nintendo Co., Ltd./HAL Laboratory, Inc. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. $Revision: 1 $ *---------------------------------------------------------------------------*/ #ifndef FRAMEWORK_H__ #define FRAMEWORK_H__ #include "../include/SmMessage.h" //------------------------------------------------------------------------------ //! デモのフレームワークステータスを管理します。 class FrameWorkStatus { public: //! コンストラクタ FrameWorkStatus() { m_IsCommandDouble = true; m_IsLayoutVisible = true; m_IsCpuMeterVisible = true; m_IsPalying = true; m_IsFirstLoop = true; m_IsAddFrame = false; m_Frame = 0.f; } // コマンドバッファモード切替 void SwapCommandBufferMode() { if ( m_IsCommandDouble ) { m_IsCommandDouble = false; NW_DEV_LOG( "[DEMO] Command Buffer Single\n\n" ); } else { m_IsCommandDouble = true; NW_DEV_LOG( "[DEMO] Command Buffer Double\n\n" ); } } // レイアウト描画オンオフ切替 void SwapLayoutVisible() { if ( m_IsLayoutVisible ) { m_IsLayoutVisible = false; NW_DEV_LOG( "[DEMO] Layout Draw Off\n\n" ); } else { m_IsLayoutVisible = true; NW_DEV_LOG( "[DEMO] Layout Draw On\n\n" ); } } // OpenGL描画オンオフ切替 void SwapCpuMeterVisible() { if ( m_IsCpuMeterVisible ) { m_IsCpuMeterVisible = false; NW_DEV_LOG( "[DEMO] Cpu Meter Draw Off\n\n" ); } else { m_IsCpuMeterVisible = true; NW_DEV_LOG( "[DEMO] Cpu Meter Draw On\n\n" ); } } // 再生/停止切り替え void SwapPlay() { if ( m_IsPalying ) { m_IsPalying = false; NW_DEV_LOG( "[DEMO] Demo Stop\n\n" ); } else { m_IsPalying = true; NW_DEV_LOG( "[DEMO] Demo Play\n\n" ); } } // フレームを進める void AddFrame( f32 addFrame ) { m_Frame += addFrame; } // フレームを取得する f32 GetFrame() { return m_Frame; } // フレームを設定する void SetFrame( f32 frane ) { m_Frame = frane; } // コマ送りフラグを設定する void SetAddFrame() { m_IsAddFrame = true; NW_DEV_LOG( "[DEMO] Demo Add Frame\n\n" ); } // コマ送りフラグを取得する bool GetAddFrame() { bool temp = m_IsAddFrame; m_IsAddFrame = false; return temp; } bool IsCommandBufferDouble() { return m_IsCommandDouble; } bool IsLayoutVisible() { return m_IsLayoutVisible; } bool IsCpuMeterVisible() { return m_IsCpuMeterVisible; } bool IsPlaying() { return m_IsPalying; } void SetTimerStart() { m_StartTime = nn::os::Tick::GetSystemCurrent().ToTimeSpan().GetMicroSeconds(); } void SetTimerEnd() { m_EndTime = nn::os::Tick::GetSystemCurrent().ToTimeSpan().GetMicroSeconds(); m_AllTime = m_EndTime - m_StartTime; } f32 GetAllTime() { return m_AllTime/1000.f; } void SetGpuWaitStart() { m_GpuWaitStartTime = nn::os::Tick::GetSystemCurrent().ToTimeSpan().GetMicroSeconds(); } void SetGpuWaitEnd() { m_GpuWaitEndTime = nn::os::Tick::GetSystemCurrent().ToTimeSpan().GetMicroSeconds(); m_GpuWaitTime = m_GpuWaitEndTime - m_GpuWaitStartTime; } f32 GetGpuWaitTime() { return m_GpuWaitTime/1000.f; } // コマンドバッファに積まれているリクエスト数を取得します。 void UpdateUsedReqCount() { nngxGetCmdlistParameteri(NN_GX_CMDLIST_USED_REQCOUNT, &m_UsedReqCount); } GLint GetUsedReqCount() { return m_UsedReqCount; } private: bool m_IsCommandDouble; // コマンドバッファ ダブル/シングル bool m_IsLayoutVisible; // Layout 描画する/描画しない bool m_IsCpuMeterVisible; // OpenGL 描画する/描画しない bool m_IsPalying; // 再生中か停止中か bool m_IsAddFrame; // コマ送り bool m_IsFirstLoop; f32 m_Frame; u64 m_StartTime; u64 m_EndTime; u64 m_AllTime; u64 m_GpuWaitStartTime; u64 m_GpuWaitEndTime; u64 m_GpuWaitTime; GLint m_UsedReqCount; }; #endif // FRAMEWORK_H__