From 57445c9930d6bf8f534d3fb6d9571dab5cfa1fcc Mon Sep 17 00:00:00 2001 From: "chirs241097@gmail.com" Date: Thu, 20 Mar 2014 00:13:06 +0000 Subject: Sync hgewin code with the unix version. --- hgewin/graphics.cpp | 13 +++++++------ hgewin/system.cpp | 26 +++++++++++++++----------- 2 files changed, 22 insertions(+), 17 deletions(-) (limited to 'hgewin') diff --git a/hgewin/graphics.cpp b/hgewin/graphics.cpp index c7dc369..43a5cc1 100755 --- a/hgewin/graphics.cpp +++ b/hgewin/graphics.cpp @@ -10,8 +10,8 @@ #include "hge_impl.h" #include -#include - +#include +static const char* GRAPHICS_SRC_FN="hge/graphics.cpp"; void CALL HGE_Impl::Gfx_Clear(DWORD color) { @@ -628,9 +628,10 @@ bool HGE_Impl::_GfxInit() // Get adapter info pD3D->GetAdapterIdentifier(D3DADAPTER_DEFAULT, 0, &AdID); - System_Log("D3D Driver: %s",AdID.Driver); - System_Log("Description: %s",AdID.Description); - System_Log("Version: %d.%d.%d.%d", + System_Log("%s: D3D Driver: %s",GRAPHICS_SRC_FN,AdID.Driver); + System_Log("%s: Description: %s",GRAPHICS_SRC_FN,AdID.Description); + System_Log("%s: Version: %d.%d.%d.%d", + GRAPHICS_SRC_FN, HIWORD(AdID.DriverVersion.HighPart), LOWORD(AdID.DriverVersion.HighPart), HIWORD(AdID.DriverVersion.LowPart), @@ -720,7 +721,7 @@ bool HGE_Impl::_GfxInit() _AdjustWindow(); - System_Log("Mode: %d x %d x %s\n",nScreenWidth,nScreenHeight,szFormats[_format_id(Format)]); + System_Log("%s: Mode: %d x %d x %s\n",GRAPHICS_SRC_FN,nScreenWidth,nScreenHeight,szFormats[_format_id(Format)]); // Create vertex batch buffer diff --git a/hgewin/system.cpp b/hgewin/system.cpp index e0e0627..1e49d65 100755 --- a/hgewin/system.cpp +++ b/hgewin/system.cpp @@ -12,7 +12,8 @@ #define LOWORDINT(n) ((int)((signed short)(LOWORD(n)))) -#define HIWORDINT(n) ((int)((signed short)(HIWORD(n)))) +#define HIWORDINT(n) ((int)((signed short)(HIWORD(n)))) +static const char* SYSTEM_SRC_FN="hge/system.cpp"; const char *WINDOW_CLASS_NAME = "HGE__WNDCLASS"; @@ -74,19 +75,19 @@ bool CALL HGE_Impl::System_Initiate() // Log system info - System_Log("Initalizing HGE...\n"); + System_Log("%s: HGE Started...",SYSTEM_SRC_FN); - System_Log("DirectX API Package version: HGE %X.%X for DirectX9", HGE_VERSION>>8, HGE_VERSION & 0xFF); + System_Log("%s: hge-unix version: %X.%X", SYSTEM_SRC_FN, HGE_VERSION>>8, HGE_VERSION & 0xFF); GetLocalTime(&tm); - System_Log("Date: %02d.%02d.%d, %02d:%02d:%02d\n", tm.wDay, tm.wMonth, tm.wYear, tm.wHour, tm.wMinute, tm.wSecond); + System_Log("%s: Date: %02d.%02d.%d, %02d:%02d:%02d\n", SYSTEM_SRC_FN, tm.wDay, tm.wMonth, tm.wYear, tm.wHour, tm.wMinute, tm.wSecond); - System_Log("Application: %s",szWinTitle); + System_Log("%s: Application: %s", SYSTEM_SRC_FN, szWinTitle); os_ver.dwOSVersionInfoSize=sizeof(os_ver); GetVersionEx(&os_ver); - System_Log("OS: Windows %ld.%ld.%ld",os_ver.dwMajorVersion,os_ver.dwMinorVersion,os_ver.dwBuildNumber); + System_Log("%s: OS: Windows %ld.%ld.%ld", SYSTEM_SRC_FN, os_ver.dwMajorVersion,os_ver.dwMinorVersion,os_ver.dwBuildNumber); GlobalMemoryStatus(&mem_st); - System_Log("Memory: %ldK total, %ldK free\n",mem_st.dwTotalPhys/1024L,mem_st.dwAvailPhys/1024L); + System_Log("%s: Memory: %ldK total, %ldK free\n", SYSTEM_SRC_FN, mem_st.dwTotalPhys/1024L,mem_st.dwAvailPhys/1024L); // Register window class @@ -160,7 +161,7 @@ bool CALL HGE_Impl::System_Initiate() if(!_GfxInit()) { System_Shutdown(); return false; } if(!_SoundInit()) { System_Shutdown(); return false; } - System_Log("Initialization done.\n"); + System_Log("%s: Init done.\n",SYSTEM_SRC_FN); fTime=0.0f; t0=t0fps=timeGetTime(); @@ -200,7 +201,7 @@ bool CALL HGE_Impl::System_Initiate() void CALL HGE_Impl::System_Shutdown() { - System_Log("\nClosing session..."); + System_Log("\n%s: Closing session..",SYSTEM_SRC_FN); timeEndPeriod(1); if(hSearch) { FindClose(hSearch); hSearch=0; } @@ -220,7 +221,7 @@ void CALL HGE_Impl::System_Shutdown() if(hInstance) UnregisterClass(WINDOW_CLASS_NAME, hInstance); - System_Log("Session ended."); + System_Log("%s: Session ended.",SYSTEM_SRC_FN); } @@ -605,8 +606,11 @@ void CALL HGE_Impl::System_Log(const char *szFormat, ...) va_start(ap, szFormat); vfprintf(hf, szFormat, ap); va_end(ap); - + va_start(ap, szFormat); + vfprintf(stderr, szFormat, ap); + va_end(ap); fprintf(hf, "\n"); + fprintf(stderr, "\n"); fclose(hf); } -- cgit v1.2.3