ref: 63e75089d6e61504ee9ad56200dde1eb937b1cd4
parent: 584ea57c5d0b661d0b07fb9c3b254381a5408009
author: Clownacy <[email protected]>
date: Tue Mar 31 12:32:50 EDT 2020
Split SDL2 code from Game.cpp
--- a/src/Backends/Platform.h
+++ b/src/Backends/Platform.h
@@ -11,3 +11,5 @@
BOOL PlatformBackend_SystemTask(void);
void PlatformBackend_ShowMessageBox(const char *title, const char *message);
+
+unsigned long PlatformBackend_GetTicks(void);
--- a/src/Backends/Platform/SDL2.cpp
+++ b/src/Backends/Platform/SDL2.cpp
@@ -257,3 +257,8 @@
{
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, title, message, NULL);
}
+
+unsigned long PlatformBackend_GetTicks(void)
+{
+ return SDL_GetTicks();
+}
--- a/src/Game.cpp
+++ b/src/Game.cpp
@@ -4,10 +4,9 @@
#include <stdio.h>
#include <stdlib.h>
-#include "SDL.h"
-
#include "WindowsWrapper.h"
+#include "Backends/Platform.h"
#include "ArmsItem.h"
#include "Back.h"
#include "Boss.h"
@@ -215,8 +214,8 @@
++gCounter;
}
- wait = SDL_GetTicks();
- while (SDL_GetTicks() < wait + 500)
+ wait = PlatformBackend_GetTicks();
+ while (PlatformBackend_GetTicks() < wait + 500)
{
CortBox(&grcGame, 0x000000);
PutFramePerSecound();
@@ -461,8 +460,8 @@
ChangeMusic(MUS_SILENCE);
// Black screen when option is selected
- wait = SDL_GetTicks();
- while (SDL_GetTicks() < wait + 1000)
+ wait = PlatformBackend_GetTicks();
+ while (PlatformBackend_GetTicks() < wait + 1000)
{
CortBox(&grcGame, 0);
PutFramePerSecound();
@@ -692,9 +691,9 @@
if (!LoadGenericData())
{
#ifdef JAPANESE
- SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "エラー", "汎用ファイルが読めない", NULL);
+ PlatformBackend_ShowMessageBox("エラー", "汎用ファイルが読めない");
#else
- SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", "Couldn't read general purpose files", NULL);
+ PlatformBackend_ShowMessageBox("Error", "Couldn't read general purpose files");
#endif
return FALSE;
@@ -708,9 +707,9 @@
if (!LoadNpcTable(path))
{
#ifdef JAPANESE
- SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "エラー", "NPCテーブルが読めない", NULL);
+ PlatformBackend_ShowMessageBox("エラー", "NPCテーブルが読めない");
#else
- SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", "Couldn't read the NPC table", NULL);
+ PlatformBackend_ShowMessageBox("Error", "Couldn't read the NPC table");
#endif
return FALSE;