Magic_Game/Easy2D/Win/winbase.h

40 lines
756 B
C
Raw Normal View History

2017-10-10 01:14:03 +08:00
#pragma once
2017-10-13 11:42:36 +08:00
#include "..\emacros.h"
2017-10-17 21:22:25 +08:00
#include <chrono>
#ifndef HINST_THISCOMPONENT
EXTERN_C IMAGE_DOS_HEADER __ImageBase;
#define HINST_THISCOMPONENT ((HINSTANCE)&__ImageBase)
#endif
2017-10-10 01:14:03 +08:00
2017-10-12 02:44:44 +08:00
HWND &GetHWnd();
2017-10-10 01:14:03 +08:00
2017-10-12 02:44:44 +08:00
ID2D1Factory * &GetFactory();
ID2D1HwndRenderTarget * &GetRenderTarget();
2017-10-15 02:46:24 +08:00
ID2D1SolidColorBrush * &GetSolidColorBrush();
2017-10-14 18:43:32 +08:00
IWICImagingFactory * &GetImagingFactory();
2017-10-12 02:44:44 +08:00
IDWriteFactory * &GetDirectWriteFactory();
2017-10-17 21:22:25 +08:00
std::chrono::steady_clock::time_point &GetNow();
long long GetInterval(std::chrono::steady_clock::time_point tLast);
2017-10-12 02:44:44 +08:00
template<class Interface>
inline void SafeReleaseInterface(
Interface **ppInterfaceToRelease
)
{
if (*ppInterfaceToRelease != nullptr)
{
(*ppInterfaceToRelease)->Release();
(*ppInterfaceToRelease) = nullptr;
}
}