Fix compiling on MSVC again
This commit is contained in:
parent
b2978f4989
commit
60887e54df
@ -132,6 +132,7 @@
|
|||||||
<ClInclude Include="app.h" />
|
<ClInclude Include="app.h" />
|
||||||
<ClInclude Include="camera.h" />
|
<ClInclude Include="camera.h" />
|
||||||
<ClInclude Include="entity.h" />
|
<ClInclude Include="entity.h" />
|
||||||
|
<ClInclude Include="gametime.h" />
|
||||||
<ClInclude Include="input.h" />
|
<ClInclude Include="input.h" />
|
||||||
<ClInclude Include="mapper_misc.h" />
|
<ClInclude Include="mapper_misc.h" />
|
||||||
<ClInclude Include="particle.h" />
|
<ClInclude Include="particle.h" />
|
||||||
@ -153,9 +154,11 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="app.c" />
|
<ClCompile Include="app.c" />
|
||||||
<ClCompile Include="app_debug.c" />
|
<ClCompile Include="app_debug.c" />
|
||||||
|
<ClCompile Include="app_file.c" />
|
||||||
<ClCompile Include="app_render.cpp" />
|
<ClCompile Include="app_render.cpp" />
|
||||||
<ClCompile Include="camera.c" />
|
<ClCompile Include="camera.c" />
|
||||||
<ClCompile Include="entity.c" />
|
<ClCompile Include="entity.c" />
|
||||||
|
<ClCompile Include="gametime.c" />
|
||||||
<ClCompile Include="input.c" />
|
<ClCompile Include="input.c" />
|
||||||
<ClCompile Include="main.cpp" />
|
<ClCompile Include="main.cpp" />
|
||||||
<ClCompile Include="mapper_misc.c" />
|
<ClCompile Include="mapper_misc.c" />
|
||||||
|
@ -78,6 +78,9 @@
|
|||||||
<ClInclude Include="render_component.h">
|
<ClInclude Include="render_component.h">
|
||||||
<Filter>头文件</Filter>
|
<Filter>头文件</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="gametime.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="util\queue.c">
|
<ClCompile Include="util\queue.c">
|
||||||
@ -155,5 +158,11 @@
|
|||||||
<ClCompile Include="render_component.c">
|
<ClCompile Include="render_component.c">
|
||||||
<Filter>源文件</Filter>
|
<Filter>源文件</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="gametime.c">
|
||||||
|
<Filter>源文件</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="app_file.c">
|
||||||
|
<Filter>源文件</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@ -175,15 +175,12 @@ void app_Render(App *app) {
|
|||||||
settextcolor(RGB(255, 255, 255));
|
settextcolor(RGB(255, 255, 255));
|
||||||
|
|
||||||
// If paused, display a text
|
// If paused, display a text
|
||||||
if (app->paused) {
|
if (app->paused)
|
||||||
RECT rect = {.left = SCREEN_WIDTH / 2 - 10, .top = 100, .right = SCREEN_WIDTH / 2 + 10, .bottom = 200};
|
render_DrawTextEx("Game Paused", box2(SCREEN_WIDTH / 2 - 10, 100, 20, 100), DT_CENTER | DT_NOCLIP);
|
||||||
drawtext("Game Paused", &rect, DT_CENTER | DT_NOCLIP);
|
if (1.0 - app->timescale > EPS) {
|
||||||
}
|
|
||||||
if (abs(app->timescale - 1.0) > EPS) {
|
|
||||||
RECT rect = {.left = SCREEN_WIDTH / 2 - 10, .top = 50, .right = SCREEN_WIDTH / 2 + 10, .bottom = 150};
|
|
||||||
char buf[128];
|
char buf[128];
|
||||||
snprintf(buf, sizeof(buf), "*** TIMESCALE %.2lf ***", app->timescale);
|
snprintf(buf, sizeof(buf), "*** TIMESCALE %.2lf ***", app->timescale);
|
||||||
drawtext(buf, &rect, DT_CENTER | DT_NOCLIP);
|
render_DrawTextEx(buf, box2(SCREEN_WIDTH / 2 - 10, 50, 20, 100), DT_CENTER | DT_NOCLIP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,29 @@ void render_DrawText(int x, int y, const char *str) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void render_DrawTextEx(const char *str, Box2 rect, unsigned int flags) {
|
||||||
|
if (!tbuf)
|
||||||
|
tbuf = vector_Create(sizeof(NCHAR));
|
||||||
|
|
||||||
|
const NCHAR zero = 0;
|
||||||
|
vector_Clear(tbuf);
|
||||||
|
int len = strlen(str);
|
||||||
|
for (int i = 0; i < len; i++) {
|
||||||
|
NCHAR c = (NCHAR)str[i];
|
||||||
|
vector_Push(tbuf, &c);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vector_Size(tbuf) > 0) {
|
||||||
|
vector_Push(tbuf, &zero);
|
||||||
|
RECT r;
|
||||||
|
r.left = (int)round(rect.lefttop.x);
|
||||||
|
r.top = (int)round(rect.lefttop.y);
|
||||||
|
r.right = (int)round(rect.lefttop.x + rect.size.x);
|
||||||
|
r.bottom = (int)round(rect.lefttop.y + rect.size.y);
|
||||||
|
drawtext((LPCTSTR)vector_Data(tbuf), &r, flags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const FillMode render_ModeDefault = {
|
const FillMode render_ModeDefault = {
|
||||||
.rop2 = R2_COPYPEN,
|
.rop2 = R2_COPYPEN,
|
||||||
|
@ -17,6 +17,9 @@ extern "C" {
|
|||||||
// for newlines.
|
// for newlines.
|
||||||
void render_DrawText(int x, int y, const char *str);
|
void render_DrawText(int x, int y, const char *str);
|
||||||
|
|
||||||
|
// A warpper around drawtext().
|
||||||
|
void render_DrawTextEx(const char *str, Box2 rect, unsigned int flags);
|
||||||
|
|
||||||
|
|
||||||
// Fill modes.
|
// Fill modes.
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user