Split SDL2 code from Game.cpp

This commit is contained in:
Clownacy 2020-03-31 16:32:50 +01:00
parent 584ea57c5d
commit 63e75089d6
3 changed files with 16 additions and 10 deletions

View file

@ -11,3 +11,5 @@ void PlatformBackend_GetBasePath(char *string_buffer);
BOOL PlatformBackend_SystemTask(void);
void PlatformBackend_ShowMessageBox(const char *title, const char *message);
unsigned long PlatformBackend_GetTicks(void);

View file

@ -257,3 +257,8 @@ void PlatformBackend_ShowMessageBox(const char *title, const char *message)
{
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, title, message, NULL);
}
unsigned long PlatformBackend_GetTicks(void)
{
return SDL_GetTicks();
}

View file

@ -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 @@ int ModeOpening(void)
++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 @@ int ModeTitle(void)
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 @@ BOOL Game(void)
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 @@ BOOL Game(void)
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;