| 
									
										
										
										
											2017-10-12 02:44:44 +08:00
										 |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-23 00:05:57 +08:00
										 |  |  | #ifndef WINVER
 | 
					
						
							|  |  |  | #define WINVER 0x0700       // Allow use of features specific to Windows 7 or later
 | 
					
						
							| 
									
										
										
										
											2017-10-13 11:42:36 +08:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-23 00:05:57 +08:00
										 |  |  | #ifndef _WIN32_WINNT
 | 
					
						
							|  |  |  | #define _WIN32_WINNT 0x0700 // Allow use of features specific to Windows 7 or later
 | 
					
						
							| 
									
										
										
										
											2017-10-13 11:42:36 +08:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-19 12:48:58 +08:00
										 |  |  | #ifndef NTDDI_VERSION
 | 
					
						
							|  |  |  | #define NTDDI_VERSION NTDDI_WIN7
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-13 11:42:36 +08:00
										 |  |  | #ifndef UNICODE
 | 
					
						
							|  |  |  | #define UNICODE
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-23 00:05:57 +08:00
										 |  |  | // Exclude rarely-used items from Windows headers
 | 
					
						
							| 
									
										
										
										
											2017-10-19 12:48:58 +08:00
										 |  |  | #ifndef WIN32_LEAN_AND_MEAN
 | 
					
						
							| 
									
										
										
										
											2017-10-13 11:42:36 +08:00
										 |  |  | #define WIN32_LEAN_AND_MEAN
 | 
					
						
							| 
									
										
										
										
											2017-10-19 12:48:58 +08:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2017-10-13 11:42:36 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-30 16:45:38 +08:00
										 |  |  | #ifndef DIRECTINPUT_VERSION
 | 
					
						
							|  |  |  | #define DIRECTINPUT_VERSION 0x0800
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-01 23:08:11 +08:00
										 |  |  | #define INITGUID
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-23 00:05:57 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | #if _MSC_VER > 1700
 | 
					
						
							|  |  |  | #define HIGHER_THAN_VS2012 1
 | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | #define HIGHER_THAN_VS2012 0
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #if _MSC_VER > 1600
 | 
					
						
							|  |  |  | #define HIGHER_THAN_VS2010 1
 | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | #define HIGHER_THAN_VS2010 0
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-02 10:06:29 +08:00
										 |  |  | // Windows Header Files
 | 
					
						
							| 
									
										
										
										
											2017-10-13 11:42:36 +08:00
										 |  |  | #include <windows.h>
 | 
					
						
							| 
									
										
										
										
											2018-02-01 22:07:44 +08:00
										 |  |  | #include <wincodec.h>
 | 
					
						
							|  |  |  | #include <mmsystem.h>
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  | #include <d2d1.h>
 | 
					
						
							|  |  |  | #include <dwrite.h>
 | 
					
						
							| 
									
										
										
										
											2018-01-30 16:45:38 +08:00
										 |  |  | #include <dinput.h>
 | 
					
						
							| 
									
										
										
										
											2018-02-01 22:07:44 +08:00
										 |  |  | #include <d2d1helper.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-02 10:06:29 +08:00
										 |  |  | // C RunTime Header Files
 | 
					
						
							|  |  |  | #include <stdio.h>
 | 
					
						
							|  |  |  | #include <wchar.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // Import Libraries
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  | #pragma comment(lib, "d2d1.lib")
 | 
					
						
							|  |  |  | #pragma comment(lib, "dwrite.lib")
 | 
					
						
							|  |  |  | #pragma comment(lib, "windowscodecs.lib")
 | 
					
						
							| 
									
										
										
										
											2018-02-01 22:07:44 +08:00
										 |  |  | #pragma comment(lib, "winmm.lib")
 | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-23 00:05:57 +08:00
										 |  |  | #if HIGHER_THAN_VS2010
 | 
					
						
							| 
									
										
										
										
											2018-04-01 23:08:11 +08:00
										 |  |  | #include <xaudio2.h>
 | 
					
						
							|  |  |  | #pragma comment(lib, "xaudio2.lib")
 | 
					
						
							| 
									
										
										
										
											2018-04-23 17:59:46 +08:00
										 |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2018-04-23 00:05:57 +08:00
										 |  |  | #define MUSIC_CLASS_NAME L"Easy2DMusicCallbackWnd"
 | 
					
						
							| 
									
										
										
										
											2018-04-01 23:08:11 +08:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-13 11:42:36 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-30 16:45:38 +08:00
										 |  |  | #ifndef HINST_THISCOMPONENT
 | 
					
						
							|  |  |  | EXTERN_C IMAGE_DOS_HEADER __ImageBase; | 
					
						
							|  |  |  | #define HINST_THISCOMPONENT ((HINSTANCE)&__ImageBase)
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-02 10:06:29 +08:00
										 |  |  | #ifndef ASSERT
 | 
					
						
							| 
									
										
										
										
											2017-10-12 02:44:44 +08:00
										 |  |  | #if defined( DEBUG ) || defined( _DEBUG )
 | 
					
						
							| 
									
										
										
										
											2018-02-02 10:06:29 +08:00
										 |  |  | 	#define ASSERT(expression, message, ...) do {if (!(expression)) { fwprintf(stderr, L"Assert: " _CRT_WIDE(#message) L"\n", __VA_ARGS__); abort(); }} while(0)
 | 
					
						
							| 
									
										
										
										
											2017-10-12 02:44:44 +08:00
										 |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2018-02-02 10:06:29 +08:00
										 |  |  | 	#define ASSERT(expression, message, ...) ((void)0)
 | 
					
						
							| 
									
										
										
										
											2018-04-23 00:05:57 +08:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2017-10-12 02:44:44 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  | #ifndef WARN_IF
 | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  | #if defined( DEBUG ) || defined( _DEBUG )
 | 
					
						
							| 
									
										
										
										
											2018-02-02 10:06:29 +08:00
										 |  |  | 	#define WARN_IF(expression, message, ...) do {if (expression) { fwprintf(stderr, L"Warning: " _CRT_WIDE(#message) L"\n", __VA_ARGS__); }} while(0)
 | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2018-02-02 10:06:29 +08:00
										 |  |  | 	#define WARN_IF(expression, message, ...) ((void)0)
 | 
					
						
							| 
									
										
										
										
											2018-04-23 00:05:57 +08:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2018-04-01 13:16:07 +08:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-01 23:08:11 +08:00
										 |  |  | #if HIGHER_THAN_VS2010
 | 
					
						
							|  |  |  | #define FOR_LOOP(i, container) for (auto i : (container))
 | 
					
						
							| 
									
										
										
										
											2018-04-01 13:16:07 +08:00
										 |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2018-04-01 23:08:11 +08:00
										 |  |  | #define FOR_LOOP(i, container)  auto i = (container.begin() == container.end()) ? NULL : (*(container.begin())); \
 | 
					
						
							|  |  |  | 	for (auto __iter__=(container.begin()); (__iter__ != (container.end())) && (i = (*__iter__)); __iter__++) | 
					
						
							| 
									
										
										
										
											2018-01-30 16:45:38 +08:00
										 |  |  | #endif
 |