diff --git a/JacksEscape.vcxproj b/JacksEscape.vcxproj index 1f6c2aa..7ca42be 100644 --- a/JacksEscape.vcxproj +++ b/JacksEscape.vcxproj @@ -104,6 +104,7 @@ true _DEBUG;_CONSOLE;%(PreprocessorDefinitions) true + stdcpp20 Console @@ -118,6 +119,7 @@ true NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true + stdcpp20 Console @@ -127,9 +129,17 @@ - - - + + + + + + + + + + + @@ -137,9 +147,21 @@ - - - + + + + + + + + + + + + + + + diff --git a/JacksEscape.vcxproj.filters b/JacksEscape.vcxproj.filters index 63b2f25..49e2e00 100644 --- a/JacksEscape.vcxproj.filters +++ b/JacksEscape.vcxproj.filters @@ -33,13 +33,37 @@ Util - + + Util + + 头文件 - + 头文件 - + + 头文件 + + + 头文件 + + + 头文件 + + + 头文件 + + + 头文件 + + + 头文件 + + + 头文件 + + 头文件 @@ -53,13 +77,49 @@ Util - + 源文件 - + 源文件 - + + 源文件 + + + 源文件 + + + 源文件 + + + 源文件 + + + 源文件 + + + 源文件 + + + 源文件 + + + 源文件 + + + 源文件 + + + 源文件 + + + 源文件 + + + 源文件 + + 源文件 diff --git a/main.cpp b/main.cpp index 7fb846e..6ba0367 100644 --- a/main.cpp +++ b/main.cpp @@ -15,11 +15,17 @@ int main() { lastFrame = lastUpdate = frameCounter = time_Now(); int frameCount = 0; +#ifdef __MINGW32__ SetProcessDPIAware(); +#endif HWND win = initgraph(SCREEN_WIDTH, SCREEN_HEIGHT); SetWindowTextA(win, "JacksEscape"); +#ifdef __MINGW32__ settextstyle(TEXTHEIGHT, 0, "Courier New"); +#else // MSVC + settextstyle(TEXTHEIGHT, 0, L"Courier New"); +#endif vector_Vector *debugText = vector_Create(1); App *app = app_NewApp(); diff --git a/render_pattern.h b/render_pattern.h index 956f2b8..73684d9 100644 --- a/render_pattern.h +++ b/render_pattern.h @@ -1,7 +1,7 @@ #pragma once // for BYTE -#include +#include #ifdef __cplusplus extern "C" { diff --git a/render_util.cpp b/render_util.cpp index 55c3bf0..89c575e 100644 --- a/render_util.cpp +++ b/render_util.cpp @@ -17,12 +17,18 @@ extern "C" { static vector_Vector *tbuf; +#ifdef __MINGW32__ +#define NCHAR char +#else +#define NCHAR wchar_t +#endif + void render_DrawText(int x, int y, const char *str) { if (!tbuf) - tbuf = vector_Create(1); + tbuf = vector_Create(sizeof(NCHAR)); - int cx = x, cy = y; - const char zero = 0; + int cx = x, cy = y; + const NCHAR zero = 0; vector_Clear(tbuf); int len = strlen(str); @@ -34,8 +40,10 @@ void render_DrawText(int x, int y, const char *str) { cy += TEXTHEIGHT; vector_Clear(tbuf); - } else - vector_Push(tbuf, &str[i]); + } else { + NCHAR wc = str[i]; + vector_Push(tbuf, &wc); + } i++; } @@ -77,7 +85,7 @@ void render_SetModes(FillMode mode, TimePoint since) { if (mode.rotate.microseconds != 0) { // Rotate mode - int steps = round(duration_Seconds(time_Since(since)) / duration_Seconds(mode.rotate)); + int steps = (int)round(duration_Seconds(time_Since(since)) / duration_Seconds(mode.rotate)); static const long hatches[] = {HS_HORIZONTAL, HS_FDIAGONAL, HS_VERTICAL, HS_BDIAGONAL}; setfillstyle(BS_HATCHED, hatches[steps % 4], NULL); diff --git a/types.c b/types.c index 085c0ef..52b49c6 100644 --- a/types.c +++ b/types.c @@ -115,8 +115,8 @@ static ZwSetTimerResolution_Type ZwSetTimerResolution; void duration_Sleep(const Duration t) { if (!NtDelayExecution) { - NtDelayExecution = (NtDelayExecution_Type)GetProcAddress(GetModuleHandle("ntdll.dll"), "NtDelayExecution"); - ZwSetTimerResolution = (ZwSetTimerResolution_Type)GetProcAddress(GetModuleHandle("ntdll.dll"), "ZwSetTimerResolution"); + NtDelayExecution = (NtDelayExecution_Type)GetProcAddress(GetModuleHandleA("ntdll.dll"), "NtDelayExecution"); + ZwSetTimerResolution = (ZwSetTimerResolution_Type)GetProcAddress(GetModuleHandleA("ntdll.dll"), "ZwSetTimerResolution"); // Only run this once ULONG actualResolution;