Magic_Game/Easy2D/Win/winbase.h

41 lines
785 B
C++

#pragma once
#include "..\emacros.h"
#include <chrono>
using namespace std::chrono;
#ifndef HINST_THISCOMPONENT
EXTERN_C IMAGE_DOS_HEADER __ImageBase;
#define HINST_THISCOMPONENT ((HINSTANCE)&__ImageBase)
#endif
HWND &GetHWnd();
ID2D1Factory * &GetFactory();
ID2D1HwndRenderTarget * &GetRenderTarget();
ID2D1SolidColorBrush * &GetSolidColorBrush();
IWICImagingFactory * &GetImagingFactory();
IDWriteFactory * &GetDirectWriteFactory();
std::chrono::steady_clock::time_point &GetNow();
long long GetInterval(std::chrono::steady_clock::time_point tLast);
template<class Interface>
inline void SafeReleaseInterface(
Interface **ppInterfaceToRelease
)
{
if (*ppInterfaceToRelease != nullptr)
{
(*ppInterfaceToRelease)->Release();
(*ppInterfaceToRelease) = nullptr;
}
}