#ifndef INCLUDE_PAGE_Common_H #define INCLUDE_PAGE_Common_H //==================================================================================================== //FileName: Common.h //Created by: Alan Cheung //Project: P.A.G.E. //Description: Header file for commonly used includes, constants, macros, etc....... //==================================================================================================== //==================================================================================================== // Defines //==================================================================================================== #define DIRECTINPUT_VERSION 0x0800 #define WIN32_LEAN_AND_MEAN //==================================================================================================== // Includes //==================================================================================================== //Standard Headers #include #include #include #include //STL Headers #include #include #include #include #include #include "GameObject.h" #include "Core/Application.h" #include "Graphics/DirectXGraphics.h" #include "Core/Log.h" #include "Core/Resource.h" #include "Core/NoCopyAssign.h" #include "Core/Timer.h" //==================================================================================================== // Typedefs //==================================================================================================== typedef unsigned char u8; typedef unsigned short u16; typedef unsigned int u32; typedef signed char s8; typedef short s16; typedef int s32; //==================================================================================================== // Namespaces //==================================================================================================== namespace PAGE { static const int kMaxStringSize = 256; //==================================================================================================== // Macros //==================================================================================================== //Tools->options->Debugging->symbols: //https://msdl.microsoft.com/download/symbols #define ASSERT(exp, msg)\ {\ if(!(exp))\ {\ std::string errorMessage("<>: ");\ errorMessage += (#msg);\ errorMessage += "\n";\ OutputDebugStringA(errorMessage.c_str());\ DebugBreak();\ }\ }\ #define KEYDOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? true:false) #define KEYUP(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? false:true) //==================================================================================================== // Inline Functions //==================================================================================================== template inline void SafeDelete (T*& ptr) { if(NULL != ptr) { delete ptr; ptr = NULL; } } //---------------------------------------------------------------------------------------------------- template inline void SafeDeleteArray (T*& ptr) { if(NULL != ptr) { delete[] ptr; ptr = NULL; } } //---------------------------------------------------------------------------------------------------- template inline void SafeRelease (T*& ptr) { if(NULL != ptr) { ptr->Release(); ptr = NULL; } } } //namespace PAGE #endif //#ifndef INCLUDE_PAGE_Common_H