27 lines
		
	
	
		
			444 B
		
	
	
	
		
			C++
		
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			444 B
		
	
	
	
		
			C++
		
	
	
	
| #pragma once
 | |
| #include <d2d1.h>
 | |
| #include <d2d1helper.h>
 | |
| #include <dwrite.h>
 | |
| #include <wincodec.h>
 | |
| 
 | |
| HWND &GetHWnd();
 | |
| 
 | |
| ID2D1Factory * &GetFactory();
 | |
| 
 | |
| ID2D1HwndRenderTarget * &GetRenderTarget();
 | |
| 
 | |
| void WindowCenter(HWND hWnd);
 | |
| 
 | |
| 
 | |
| template<class Interface>
 | |
| inline void SafeReleaseInterface(
 | |
| 	Interface **ppInterfaceToRelease
 | |
| )
 | |
| {
 | |
| 	if (*ppInterfaceToRelease != nullptr)
 | |
| 	{
 | |
| 		(*ppInterfaceToRelease)->Release();
 | |
| 
 | |
| 		(*ppInterfaceToRelease) = nullptr;
 | |
| 	}
 | |
| } |