| Revision | 3dbf5a3c272eeca60274b6d276a8a4ae2b2b8d2d (tree) |
|---|---|
| Time | 2012-11-18 23:47:15 |
| Author | shom5xg <shom@.(no...> |
| Commiter | shom5xg |
activate debug-dip
| @@ -4,9 +4,12 @@ | ||
| 4 | 4 | @author shom |
| 5 | 5 | ****************************************************************************/ |
| 6 | 6 | |
| 7 | +#pragma once | |
| 8 | + | |
| 7 | 9 | namespace app |
| 8 | 10 | { |
| 9 | 11 | enum{ g_kFps = 60 }; |
| 12 | + enum{ g_kSec = 1000 }; | |
| 10 | 13 | |
| 11 | 14 | typedef void (*fnGameInit)( HWND h_wnd, HINSTANCE h_inst ); |
| 12 | 15 | typedef void (*fnGameFin)(); |
| @@ -47,6 +47,10 @@ namespace | ||
| 47 | 47 | |
| 48 | 48 | void app::AppInit( HINSTANCE in_h_inst, fnGameInit in_fnGameInit, int nCmdShow ) |
| 49 | 49 | { |
| 50 | +#ifdef _DEBUG | |
| 51 | + debug_dip::InitDip(); | |
| 52 | +#endif | |
| 53 | + | |
| 50 | 54 | h_wnd = window::InitApp( in_h_inst, nCmdShow ); |
| 51 | 55 | h_inst = in_h_inst; |
| 52 | 56 |
| @@ -94,8 +98,16 @@ int app::AppFin( fnGameFin in_fnGameFin ) | ||
| 94 | 98 | ///-- |
| 95 | 99 | |
| 96 | 100 | ///-- |
| 97 | - return ( window::FinApp( h_wnd, h_inst ) ); | |
| 101 | + const b32 bRet ( window::FinApp( h_wnd, h_inst ) ); | |
| 102 | + ///-- | |
| 103 | + | |
| 104 | + ///-- | |
| 105 | +#ifdef _DEBUG | |
| 106 | + debug_dip::FinDip(); | |
| 107 | +#endif | |
| 98 | 108 | ///-- |
| 109 | + | |
| 110 | + return bRet; | |
| 99 | 111 | } |
| 100 | 112 | |
| 101 | 113 | void app::AppLoop( fnGameLoopExec in_fnExec, fnGameLoopDraw in_fnDraw ) |
| @@ -129,9 +141,9 @@ void app_private::game_loop_fin() | ||
| 129 | 141 | const u32 tm_exec_end = get_time(); |
| 130 | 142 | const u32 tm_exec_elapsed = tm_exec_end - tm_start; |
| 131 | 143 | |
| 132 | - if( 1000 / app::g_kFps > tm_exec_elapsed ) | |
| 144 | + if( app::g_kSec / app::g_kFps > tm_exec_elapsed ) | |
| 133 | 145 | { |
| 134 | - proc_msg_and_wait( 1000 / app::g_kFps - tm_exec_elapsed - 1/*小数点切り下げ還元*/ ); | |
| 146 | + proc_msg_and_wait( app::g_kSec / app::g_kFps - tm_exec_elapsed - 1/*小数点切り下げ還元*/ ); | |
| 135 | 147 | } |
| 136 | 148 | else |
| 137 | 149 | { |
| @@ -195,8 +207,11 @@ void app_private::proc_msg_and_wait( const u32 tm_wait ) | ||
| 195 | 207 | void app_private::game_loop_exec( app::fnGameLoopExec in_fnExec ) |
| 196 | 208 | { |
| 197 | 209 | using namespace window; |
| 210 | + using namespace debug_dip; | |
| 198 | 211 | |
| 199 | - if( IsWindowActive() && !IsMessageBoxAppearing() ) | |
| 212 | + if( ( IsDip( eDEBUG_DIP_PROC_ONLY_FOCUSING ) ? IsWindowActive() : TRUE ) && | |
| 213 | + !IsMessageBoxAppearing() | |
| 214 | + ) | |
| 200 | 215 | { |
| 201 | 216 | if( (in_fnExec)() ) |
| 202 | 217 | { |
| @@ -215,10 +230,6 @@ void app_private::game_loop_draw( app::fnGameLoopDraw in_fnDraw ) | ||
| 215 | 230 | { |
| 216 | 231 | (in_fnDraw)(); |
| 217 | 232 | |
| 218 | -#ifdef _DEBUG | |
| 219 | - fps_counter::fps_counter_draw(); | |
| 220 | -#endif | |
| 221 | - | |
| 222 | 233 | VERIFY( g_p_render->EndDraw() ); |
| 223 | 234 | } |
| 224 | 235 | else |
| @@ -72,7 +72,7 @@ void debug_dip::InitDip() | ||
| 72 | 72 | #define DEBUG_DIP_ITEM( _category, _name, _msg ) \ |
| 73 | 73 | \ |
| 74 | 74 | { \ |
| 75 | - const u32 ret = \ | |
| 75 | + cu32 ret = \ | |
| 76 | 76 | GetPrivateProfileInt( _T( #_category ), _T( #_name ), 0, sz_path ); \ |
| 77 | 77 | \ |
| 78 | 78 | SetDip( eDEBUG_DIP_##_name##, ( ret != 0 ) ); \ |
| @@ -95,10 +95,10 @@ void debug_dip::FinDip() | ||
| 95 | 95 | \ |
| 96 | 96 | { \ |
| 97 | 97 | TCHAR sz_unit[256] = {0}; \ |
| 98 | - const b32 b_on = IsDip( eDEBUG_DIP_##_name## ); \ | |
| 98 | + cb32 b_on ( IsDip( eDEBUG_DIP_##_name## ) ); \ | |
| 99 | 99 | wsprintf( \ |
| 100 | 100 | sz_unit, \ |
| 101 | - _T( "%s = %d\n" ), \ | |
| 101 | + _T( "%s=%d\r\n" ), \ | |
| 102 | 102 | _T( #_name ), \ |
| 103 | 103 | static_cast<UINT>( b_on ) \ |
| 104 | 104 | ); \ |
| @@ -114,11 +114,10 @@ void debug_dip::FinDip() | ||
| 114 | 114 | for( u32 i=0; i<eNOF_CATEGORY; ++i ) |
| 115 | 115 | { |
| 116 | 116 | TCHAR sz_temp[256] = {0}; |
| 117 | - _tcsncpy_s( sz_temp, str_text[i].c_str(), 255 ); | |
| 118 | - sz_temp[ _tcscnlen( sz_temp, 256 ) - 1 ] = '\0'; | |
| 119 | - //最後の改行文字を消しつつNULL文字を連続させる | |
| 117 | + wsprintf( sz_temp, _T( "%s\0\0" ), str_text[i].c_str() ); | |
| 118 | + sz_temp[ _tcscnlen( sz_temp, 256 ) - 1 ] = _T( '\0' ); | |
| 120 | 119 | |
| 121 | - const b32 ret = | |
| 120 | + cb32 ret = | |
| 122 | 121 | WritePrivateProfileSection( |
| 123 | 122 | g_szDebugDipCategoryTbl[i], |
| 124 | 123 | sz_temp, sz_path |
| @@ -15,8 +15,8 @@ DEBUG_DIP_ITEM( PLAYER, NO_DAMAGE, " | ||
| 15 | 15 | DEBUG_DIP_ITEM( PLAYER, NO_HIT, "攻撃を受けない" ) |
| 16 | 16 | |
| 17 | 17 | ///system |
| 18 | -DEBUG_DIP_ITEM( SYSTEM, DRAW_FPS, "FPS表示" ) | |
| 19 | -DEBUG_DIP_ITEM( SYSTEM, PROC_NOT_ONLY_FOCUSING, "フォーカスが外れても中断しない" ) | |
| 18 | +DEBUG_DIP_ITEM( SYSTEM, DRAW_FPS, "FPS表示" ) | |
| 19 | +DEBUG_DIP_ITEM( SYSTEM, PROC_ONLY_FOCUSING, "フォーカスが外れたら中断する" ) | |
| 20 | 20 | |
| 21 | 21 | ///graphic |
| 22 | 22 | DEBUG_DIP_ITEM( GRAPHIC, NOT_RENDER_MODEL, "キャラモデルを描画しない" ) |
| @@ -30,6 +30,9 @@ | ||
| 30 | 30 | #include "util/mm/mm.h" |
| 31 | 31 | #include "util/util.h" |
| 32 | 32 | |
| 33 | +#include "core/debug/debug_dip/debug_dip.h" | |
| 34 | +using namespace debug_dip; | |
| 35 | + | |
| 33 | 36 | ///-- "grobal var" |
| 34 | 37 | class crender; |
| 35 | 38 | extern crender *g_p_render; |