From 135035bb1a11fed0d36d94dfd7baf0e0541e76e0 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Sat, 4 Apr 2020 20:31:27 +0100 Subject: [PATCH] Change 'PlatformBackend' namespace to 'Backend' --- CMakeLists.txt | 10 +++---- src/Backends/GLFW3/{Platform.cpp => Misc.cpp} | 26 ++++++++--------- src/Backends/GLFW3/{Platform.h => Misc.h} | 0 src/Backends/GLFW3/Window-OpenGL3.cpp | 12 ++++---- src/Backends/{Platform.h => Misc.h} | 22 +++++++-------- src/Backends/Rendering/OpenGL3.cpp | 8 +++--- src/Backends/Rendering/SDLSurface.cpp | 6 ++-- src/Backends/Rendering/SDLTexture.cpp | 6 ++-- src/Backends/Rendering/Software.cpp | 10 +++---- src/Backends/SDL2/{Platform.cpp => Misc.cpp} | 26 ++++++++--------- src/Backends/SDL2/{Platform.h => Misc.h} | 0 src/Backends/SDL2/Window-OpenGL3.cpp | 16 +++++------ src/Draw.cpp | 6 ++-- src/Game.cpp | 18 ++++++------ src/Main.cpp | 28 +++++++++---------- src/Profile.cpp | 6 ++-- src/TextScr.cpp | 10 +++---- 17 files changed, 105 insertions(+), 105 deletions(-) rename src/Backends/GLFW3/{Platform.cpp => Misc.cpp} (91%) rename src/Backends/GLFW3/{Platform.h => Misc.h} (100%) rename src/Backends/{Platform.h => Misc.h} (76%) rename src/Backends/SDL2/{Platform.cpp => Misc.cpp} (90%) rename src/Backends/SDL2/{Platform.h => Misc.h} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index db84b4ab..fbe3d069 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -168,7 +168,7 @@ add_executable(CSE2 WIN32 "src/WindowsWrapper.h" "src/Backends/Audio.h" "src/Backends/Controller.h" - "src/Backends/Platform.h" + "src/Backends/Misc.h" "src/Backends/Rendering.h" ) @@ -337,14 +337,14 @@ if(BACKEND_PLATFORM MATCHES "SDL2") target_sources(CSE2 PRIVATE "src/Backends/SDL2/Controller.cpp" "src/Backends/SDL2/Controller.h" - "src/Backends/SDL2/Platform.cpp" - "src/Backends/SDL2/Platform.h" + "src/Backends/SDL2/Misc.cpp" + "src/Backends/SDL2/Misc.h" ) elseif(BACKEND_PLATFORM MATCHES "GLFW3") target_sources(CSE2 PRIVATE "src/Backends/GLFW3/Controller.cpp" - "src/Backends/GLFW3/Platform.cpp" - "src/Backends/GLFW3/Platform.h" + "src/Backends/GLFW3/Misc.cpp" + "src/Backends/GLFW3/Misc.h" ) endif() diff --git a/src/Backends/GLFW3/Platform.cpp b/src/Backends/GLFW3/Misc.cpp similarity index 91% rename from src/Backends/GLFW3/Platform.cpp rename to src/Backends/GLFW3/Misc.cpp index a43a5376..f881ae07 100644 --- a/src/Backends/GLFW3/Platform.cpp +++ b/src/Backends/GLFW3/Misc.cpp @@ -1,5 +1,5 @@ -#include "../Platform.h" -#include "Platform.h" +#include "../Misc.h" +#include "Misc.h" #include #include @@ -152,12 +152,12 @@ static void DragAndDropCallback(GLFWwindow *window, int count, const char **path LoadProfile(paths[0]); } -void PlatformBackend_Init(void) +void Backend_Init(void) { glfwInit(); } -void PlatformBackend_Deinit(void) +void Backend_Deinit(void) { if (cursor != NULL) glfwDestroyCursor(cursor); @@ -165,7 +165,7 @@ void PlatformBackend_Deinit(void) glfwTerminate(); } -void PlatformBackend_PostWindowCreation(void) +void Backend_PostWindowCreation(void) { // Hook callbacks glfwSetKeyCallback(window, KeyCallback); @@ -173,7 +173,7 @@ void PlatformBackend_PostWindowCreation(void) glfwSetWindowSizeCallback(window, WindowSizeCallback); } -BOOL PlatformBackend_GetBasePath(char *string_buffer) +BOOL Backend_GetBasePath(char *string_buffer) { (void)string_buffer; @@ -181,12 +181,12 @@ BOOL PlatformBackend_GetBasePath(char *string_buffer) return FALSE; } -void PlatformBackend_HideMouse(void) +void Backend_HideMouse(void) { glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_HIDDEN); } -void PlatformBackend_SetWindowIcon(const unsigned char *rgb_pixels, unsigned int width, unsigned int height) +void Backend_SetWindowIcon(const unsigned char *rgb_pixels, unsigned int width, unsigned int height) { // Convert to RGBA, since that's the only think GLFW3 accepts unsigned char *rgba_pixels = (unsigned char*)malloc(width * height * 4); @@ -214,7 +214,7 @@ void PlatformBackend_SetWindowIcon(const unsigned char *rgb_pixels, unsigned int } } -void PlatformBackend_SetCursor(const unsigned char *rgb_pixels, unsigned int width, unsigned int height) +void Backend_SetCursor(const unsigned char *rgb_pixels, unsigned int width, unsigned int height) { // Convert to RGBA, since that's the only think GLFW3 accepts unsigned char *rgba_pixels = (unsigned char*)malloc(width * height * 4); @@ -258,7 +258,7 @@ void PlaybackBackend_EnableDragAndDrop(void) glfwSetDropCallback(window, DragAndDropCallback); } -BOOL PlatformBackend_SystemTask(void) +BOOL Backend_SystemTask(void) { if (glfwWindowShouldClose(window)) { @@ -276,18 +276,18 @@ BOOL PlatformBackend_SystemTask(void) return TRUE; } -void PlatformBackend_ShowMessageBox(const char *title, const char *message) +void Backend_ShowMessageBox(const char *title, const char *message) { // GLFW3 doesn't have a message box printf("ShowMessageBox - '%s' - '%s'\n", title, message); } -unsigned long PlatformBackend_GetTicks(void) +unsigned long Backend_GetTicks(void) { return (unsigned long)(glfwGetTime() * 1000.0); } -void PlatformBackend_Delay(unsigned int ticks) +void Backend_Delay(unsigned int ticks) { // GLFW3 doesn't have a delay function, so here's some butt-ugly C++11 std::this_thread::sleep_for(std::chrono::milliseconds(ticks)); diff --git a/src/Backends/GLFW3/Platform.h b/src/Backends/GLFW3/Misc.h similarity index 100% rename from src/Backends/GLFW3/Platform.h rename to src/Backends/GLFW3/Misc.h diff --git a/src/Backends/GLFW3/Window-OpenGL3.cpp b/src/Backends/GLFW3/Window-OpenGL3.cpp index 0903c869..a8ce93ed 100644 --- a/src/Backends/GLFW3/Window-OpenGL3.cpp +++ b/src/Backends/GLFW3/Window-OpenGL3.cpp @@ -12,8 +12,8 @@ #include "../../WindowsWrapper.h" -#include "../Platform.h" -#include "Platform.h" +#include "../Misc.h" +#include "Misc.h" BOOL WindowBackend_OpenGL_CreateWindow(const char *window_title, int *screen_width, int *screen_height, BOOL fullscreen) { @@ -57,19 +57,19 @@ BOOL WindowBackend_OpenGL_CreateWindow(const char *window_title, int *screen_wid if (GLAD_GL_VERSION_3_2) { #endif - PlatformBackend_PostWindowCreation(); + Backend_PostWindowCreation(); return TRUE; #ifndef USE_OPENGLES2 } else { - PlatformBackend_ShowMessageBox("Fatal error (OpenGL rendering backend)", "Your system does not support OpenGL 3.2"); + Backend_ShowMessageBox("Fatal error (OpenGL rendering backend)", "Your system does not support OpenGL 3.2"); } } else { - PlatformBackend_ShowMessageBox("Fatal error (OpenGL rendering backend)", "Could not load OpenGL functions"); + Backend_ShowMessageBox("Fatal error (OpenGL rendering backend)", "Could not load OpenGL functions"); } #endif @@ -77,7 +77,7 @@ BOOL WindowBackend_OpenGL_CreateWindow(const char *window_title, int *screen_wid } else { - PlatformBackend_ShowMessageBox("Fatal error (OpenGL rendering backend)", "Could not create window"); + Backend_ShowMessageBox("Fatal error (OpenGL rendering backend)", "Could not create window"); } return FALSE; diff --git a/src/Backends/Platform.h b/src/Backends/Misc.h similarity index 76% rename from src/Backends/Platform.h rename to src/Backends/Misc.h index 52c246f2..e6d11124 100644 --- a/src/Backends/Platform.h +++ b/src/Backends/Misc.h @@ -87,15 +87,15 @@ extern BOOL bActive; extern BOOL backend_keyboard_state[BACKEND_KEYBOARD_TOTAL]; extern BOOL backend_previous_keyboard_state[BACKEND_KEYBOARD_TOTAL]; -void PlatformBackend_Init(void); -void PlatformBackend_Deinit(void); -void PlatformBackend_PostWindowCreation(void); -BOOL PlatformBackend_GetBasePath(char *string_buffer); -void PlatformBackend_HideMouse(void); -void PlatformBackend_SetWindowIcon(const unsigned char *rgb_pixels, unsigned int width, unsigned int height); -void PlatformBackend_SetCursor(const unsigned char *rgb_pixels, unsigned int width, unsigned int height); +void Backend_Init(void); +void Backend_Deinit(void); +void Backend_PostWindowCreation(void); +BOOL Backend_GetBasePath(char *string_buffer); +void Backend_HideMouse(void); +void Backend_SetWindowIcon(const unsigned char *rgb_pixels, unsigned int width, unsigned int height); +void Backend_SetCursor(const unsigned char *rgb_pixels, unsigned int width, unsigned int height); void PlaybackBackend_EnableDragAndDrop(void); -BOOL PlatformBackend_SystemTask(void); -void PlatformBackend_ShowMessageBox(const char *title, const char *message); -unsigned long PlatformBackend_GetTicks(void); -void PlatformBackend_Delay(unsigned int ticks); +BOOL Backend_SystemTask(void); +void Backend_ShowMessageBox(const char *title, const char *message); +unsigned long Backend_GetTicks(void); +void Backend_Delay(unsigned int ticks); diff --git a/src/Backends/Rendering/OpenGL3.cpp b/src/Backends/Rendering/OpenGL3.cpp index 8d0e9c42..fa6d8eab 100644 --- a/src/Backends/Rendering/OpenGL3.cpp +++ b/src/Backends/Rendering/OpenGL3.cpp @@ -18,7 +18,7 @@ #include "../../WindowsWrapper.h" -#include "../Platform.h" +#include "../Misc.h" #include "../Window-OpenGL.h" #include "../../Resource.h" @@ -275,7 +275,7 @@ static GLuint CompileShader(const char *vertex_shader_source, const char *fragme { char buffer[0x200]; glGetShaderInfoLog(vertex_shader, sizeof(buffer), NULL, buffer); - PlatformBackend_ShowMessageBox("Vertex shader error", buffer); + Backend_ShowMessageBox("Vertex shader error", buffer); return 0; } @@ -291,7 +291,7 @@ static GLuint CompileShader(const char *vertex_shader_source, const char *fragme { char buffer[0x200]; glGetShaderInfoLog(fragment_shader, sizeof(buffer), NULL, buffer); - PlatformBackend_ShowMessageBox("Fragment shader error", buffer); + Backend_ShowMessageBox("Fragment shader error", buffer); return 0; } @@ -308,7 +308,7 @@ static GLuint CompileShader(const char *vertex_shader_source, const char *fragme { char buffer[0x200]; glGetProgramInfoLog(program_id, sizeof(buffer), NULL, buffer); - PlatformBackend_ShowMessageBox("Shader linker error", buffer); + Backend_ShowMessageBox("Shader linker error", buffer); return 0; } diff --git a/src/Backends/Rendering/SDLSurface.cpp b/src/Backends/Rendering/SDLSurface.cpp index 6feb9f89..db217baa 100644 --- a/src/Backends/Rendering/SDLSurface.cpp +++ b/src/Backends/Rendering/SDLSurface.cpp @@ -8,8 +8,8 @@ #include "../../WindowsWrapper.h" -#include "../Platform.h" -#include "../SDL2/Platform.h" +#include "../Misc.h" +#include "../SDL2/Misc.h" typedef struct RenderBackend_Surface { @@ -57,7 +57,7 @@ Backend_Surface* RenderBackend_Init(const char *window_title, int screen_width, if (framebuffer.sdlsurface != NULL) { - PlatformBackend_PostWindowCreation(); + Backend_PostWindowCreation(); return &framebuffer; } diff --git a/src/Backends/Rendering/SDLTexture.cpp b/src/Backends/Rendering/SDLTexture.cpp index a3f9225a..963b8bf5 100644 --- a/src/Backends/Rendering/SDLTexture.cpp +++ b/src/Backends/Rendering/SDLTexture.cpp @@ -12,8 +12,8 @@ #include "../../WindowsWrapper.h" -#include "../Platform.h" -#include "../SDL2/Platform.h" +#include "../Misc.h" +#include "../SDL2/Misc.h" #include "../../Draw.h" #include "../../Ending.h" #include "../../MapName.h" @@ -165,7 +165,7 @@ Backend_Surface* RenderBackend_Init(const char *window_title, int screen_width, config.delete_texture_callback = GlyphBatch_DestroyTexture; spritebatch_init(&glyph_batcher, &config, NULL); - PlatformBackend_PostWindowCreation(); + Backend_PostWindowCreation(); return &framebuffer; } diff --git a/src/Backends/Rendering/Software.cpp b/src/Backends/Rendering/Software.cpp index 1bd2878f..db02d5f1 100644 --- a/src/Backends/Rendering/Software.cpp +++ b/src/Backends/Rendering/Software.cpp @@ -8,8 +8,8 @@ #include "../../WindowsWrapper.h" -#include "../Platform.h" -#include "../SDL2/Platform.h" +#include "../Misc.h" +#include "../SDL2/Misc.h" #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define MAX(a, b) ((a) > (b) ? (a) : (b)) @@ -56,20 +56,20 @@ Backend_Surface* RenderBackend_Init(const char *window_title, int screen_width, framebuffer.height = framebuffer_sdlsurface->h; framebuffer.pitch = framebuffer_sdlsurface->pitch; - PlatformBackend_PostWindowCreation(); + Backend_PostWindowCreation(); return &framebuffer; } else { - PlatformBackend_ShowMessageBox("Fatal error (software rendering backend)", "Could not create framebuffer surface"); + Backend_ShowMessageBox("Fatal error (software rendering backend)", "Could not create framebuffer surface"); } SDL_DestroyWindow(window); } else { - PlatformBackend_ShowMessageBox("Fatal error (software rendering backend)", "Could not create window"); + Backend_ShowMessageBox("Fatal error (software rendering backend)", "Could not create window"); } return NULL; diff --git a/src/Backends/SDL2/Platform.cpp b/src/Backends/SDL2/Misc.cpp similarity index 90% rename from src/Backends/SDL2/Platform.cpp rename to src/Backends/SDL2/Misc.cpp index 44256411..773e523e 100644 --- a/src/Backends/SDL2/Platform.cpp +++ b/src/Backends/SDL2/Misc.cpp @@ -1,5 +1,5 @@ -#include "../Platform.h" -#include "Platform.h" +#include "../Misc.h" +#include "Misc.h" #include #include @@ -30,7 +30,7 @@ BOOL backend_previous_keyboard_state[BACKEND_KEYBOARD_TOTAL]; static SDL_Surface *cursor_surface; static SDL_Cursor *cursor; -void PlatformBackend_Init(void) +void Backend_Init(void) { SDL_Init(SDL_INIT_EVENTS); @@ -44,7 +44,7 @@ void PlatformBackend_Init(void) printf("Selected SDL2 video driver: %s\n", SDL_GetCurrentVideoDriver()); } -void PlatformBackend_Deinit(void) +void Backend_Deinit(void) { if (cursor != NULL) SDL_FreeCursor(cursor); @@ -55,12 +55,12 @@ void PlatformBackend_Deinit(void) SDL_Quit(); } -void PlatformBackend_PostWindowCreation(void) +void Backend_PostWindowCreation(void) { } -BOOL PlatformBackend_GetBasePath(char *string_buffer) +BOOL Backend_GetBasePath(char *string_buffer) { char *base_path = SDL_GetBasePath(); // Trim the trailing '/' @@ -72,19 +72,19 @@ BOOL PlatformBackend_GetBasePath(char *string_buffer) return TRUE; } -void PlatformBackend_HideMouse(void) +void Backend_HideMouse(void) { SDL_ShowCursor(SDL_DISABLE); } -void PlatformBackend_SetWindowIcon(const unsigned char *rgb_pixels, unsigned int width, unsigned int height) +void Backend_SetWindowIcon(const unsigned char *rgb_pixels, unsigned int width, unsigned int height) { SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom((void*)rgb_pixels, width, height, 0, width * 3, SDL_PIXELFORMAT_RGB24); SDL_SetWindowIcon(window, surface); SDL_FreeSurface(surface); } -void PlatformBackend_SetCursor(const unsigned char *rgb_pixels, unsigned int width, unsigned int height) +void Backend_SetCursor(const unsigned char *rgb_pixels, unsigned int width, unsigned int height) { cursor_surface = SDL_CreateRGBSurfaceWithFormatFrom((void*)rgb_pixels, width, height, 0, width * 3, SDL_PIXELFORMAT_RGB24); SDL_SetColorKey(cursor_surface, SDL_TRUE, SDL_MapRGB(cursor_surface->format, 0xFF, 0, 0xFF)); @@ -97,7 +97,7 @@ void PlaybackBackend_EnableDragAndDrop(void) SDL_EventState(SDL_DROPFILE, SDL_ENABLE); } -BOOL PlatformBackend_SystemTask(void) +BOOL Backend_SystemTask(void) { memcpy(backend_previous_keyboard_state, backend_keyboard_state, sizeof(backend_keyboard_state)); @@ -242,17 +242,17 @@ BOOL PlatformBackend_SystemTask(void) return TRUE; } -void PlatformBackend_ShowMessageBox(const char *title, const char *message) +void Backend_ShowMessageBox(const char *title, const char *message) { SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, title, message, window); } -unsigned long PlatformBackend_GetTicks(void) +unsigned long Backend_GetTicks(void) { return SDL_GetTicks(); } -void PlatformBackend_Delay(unsigned int ticks) +void Backend_Delay(unsigned int ticks) { SDL_Delay(ticks); } diff --git a/src/Backends/SDL2/Platform.h b/src/Backends/SDL2/Misc.h similarity index 100% rename from src/Backends/SDL2/Platform.h rename to src/Backends/SDL2/Misc.h diff --git a/src/Backends/SDL2/Window-OpenGL3.cpp b/src/Backends/SDL2/Window-OpenGL3.cpp index e33474af..f0679dbe 100644 --- a/src/Backends/SDL2/Window-OpenGL3.cpp +++ b/src/Backends/SDL2/Window-OpenGL3.cpp @@ -11,8 +11,8 @@ #include "../../WindowsWrapper.h" -#include "../Platform.h" -#include "Platform.h" +#include "../Misc.h" +#include "Misc.h" #include "../../Resource.h" static SDL_GLContext context; @@ -48,39 +48,39 @@ BOOL WindowBackend_OpenGL_CreateWindow(const char *window_title, int *screen_wid if (GLAD_GL_VERSION_3_2) { #endif - PlatformBackend_PostWindowCreation(); + Backend_PostWindowCreation(); return TRUE; #ifndef USE_OPENGLES2 } else { - PlatformBackend_ShowMessageBox("Fatal error (OpenGL rendering backend)", "Your system does not support OpenGL 3.2"); + Backend_ShowMessageBox("Fatal error (OpenGL rendering backend)", "Your system does not support OpenGL 3.2"); } } else { - PlatformBackend_ShowMessageBox("Fatal error (OpenGL rendering backend)", "Could not load OpenGL functions"); + Backend_ShowMessageBox("Fatal error (OpenGL rendering backend)", "Could not load OpenGL functions"); } #endif } else { - PlatformBackend_ShowMessageBox("Fatal error (OpenGL rendering backend)", "SDL_GL_MakeCurrent failed"); + Backend_ShowMessageBox("Fatal error (OpenGL rendering backend)", "SDL_GL_MakeCurrent failed"); } SDL_GL_DeleteContext(context); } else { - PlatformBackend_ShowMessageBox("Fatal error (OpenGL rendering backend)", "Could not create OpenGL context"); + Backend_ShowMessageBox("Fatal error (OpenGL rendering backend)", "Could not create OpenGL context"); } SDL_DestroyWindow(window); } else { - PlatformBackend_ShowMessageBox("Fatal error (OpenGL rendering backend)", "Could not create window"); + Backend_ShowMessageBox("Fatal error (OpenGL rendering backend)", "Could not create window"); } return FALSE; diff --git a/src/Draw.cpp b/src/Draw.cpp index e3db6d76..a03f8487 100644 --- a/src/Draw.cpp +++ b/src/Draw.cpp @@ -7,7 +7,7 @@ #include "WindowsWrapper.h" -#include "Backends/Platform.h" +#include "Backends/Misc.h" #include "Backends/Rendering.h" #include "Bitmap.h" #include "CommonDefines.h" @@ -59,12 +59,12 @@ BOOL Flip_SystemTask(void) return FALSE; // Framerate limiter - timeNow = PlatformBackend_GetTicks(); + timeNow = Backend_GetTicks(); if (timeNow >= timePrev + 20) break; - PlatformBackend_Delay(1); + Backend_Delay(1); } if (timeNow >= timePrev + 100) diff --git a/src/Game.cpp b/src/Game.cpp index 8ef8b97a..e2c9c6a1 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -6,7 +6,7 @@ #include "WindowsWrapper.h" -#include "Backends/Platform.h" +#include "Backends/Misc.h" #include "ArmsItem.h" #include "Back.h" #include "Boss.h" @@ -214,8 +214,8 @@ int ModeOpening(void) ++gCounter; } - wait = PlatformBackend_GetTicks(); - while (PlatformBackend_GetTicks() < wait + 500) + wait = Backend_GetTicks(); + while (Backend_GetTicks() < wait + 500) { CortBox(&grcGame, 0x000000); PutFramePerSecound(); @@ -460,8 +460,8 @@ int ModeTitle(void) ChangeMusic(MUS_SILENCE); // Black screen when option is selected - wait = PlatformBackend_GetTicks(); - while (PlatformBackend_GetTicks() < wait + 1000) + wait = Backend_GetTicks(); + while (Backend_GetTicks() < wait + 1000) { CortBox(&grcGame, 0); PutFramePerSecound(); @@ -691,9 +691,9 @@ BOOL Game(void) if (!LoadGenericData()) { #ifdef JAPANESE - PlatformBackend_ShowMessageBox("エラー", "汎用ファイルが読めない"); + Backend_ShowMessageBox("エラー", "汎用ファイルが読めない"); #else - PlatformBackend_ShowMessageBox("Error", "Couldn't read general purpose files"); + Backend_ShowMessageBox("Error", "Couldn't read general purpose files"); #endif return FALSE; @@ -707,9 +707,9 @@ BOOL Game(void) if (!LoadNpcTable(path)) { #ifdef JAPANESE - PlatformBackend_ShowMessageBox("エラー", "NPCテーブルが読めない"); + Backend_ShowMessageBox("エラー", "NPCテーブルが読めない"); #else - PlatformBackend_ShowMessageBox("Error", "Couldn't read the NPC table"); + Backend_ShowMessageBox("Error", "Couldn't read the NPC table"); #endif return FALSE; diff --git a/src/Main.cpp b/src/Main.cpp index a8faaf7a..0980528f 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -7,7 +7,7 @@ #include "WindowsWrapper.h" -#include "Backends/Platform.h" +#include "Backends/Misc.h" #include "Backends/Rendering.h" #include "Bitmap.h" #include "CommonDefines.h" @@ -64,11 +64,11 @@ unsigned long GetFramePerSecound(void) if (need_new_base_tick) { - base_tick = PlatformBackend_GetTicks(); + base_tick = Backend_GetTicks(); need_new_base_tick = FALSE; } - current_tick = PlatformBackend_GetTicks(); + current_tick = Backend_GetTicks(); ++current_frame; if (base_tick + 1000 <= current_tick) @@ -88,10 +88,10 @@ int main(int argc, char *argv[]) int i; - PlatformBackend_Init(); + Backend_Init(); // Get executable's path - if (!PlatformBackend_GetBasePath(gModulePath)) + if (!Backend_GetBasePath(gModulePath)) { // Fall back on argv[0] if the backend cannot provide a path strcpy(gModulePath, argv[0]); @@ -222,7 +222,7 @@ int main(int argc, char *argv[]) { if (!StartDirectDraw(lpWindowName, windowWidth, windowHeight, 0)) { - PlatformBackend_Deinit(); + Backend_Deinit(); return EXIT_FAILURE; } } @@ -230,7 +230,7 @@ int main(int argc, char *argv[]) { if (!StartDirectDraw(lpWindowName, windowWidth, windowHeight, 1)) { - PlatformBackend_Deinit(); + Backend_Deinit(); return EXIT_FAILURE; } } @@ -254,7 +254,7 @@ int main(int argc, char *argv[]) #ifdef FIX_BUGS if (!StartDirectDraw(lpWindowName, windowWidth, windowHeight, 2)) { - PlatformBackend_Deinit(); + Backend_Deinit(); return EXIT_FAILURE; } #else @@ -264,7 +264,7 @@ int main(int argc, char *argv[]) bFullscreen = TRUE; - PlatformBackend_HideMouse(); + Backend_HideMouse(); break; } @@ -282,7 +282,7 @@ int main(int argc, char *argv[]) if (window_icon_rgb_pixels != NULL) { - PlatformBackend_SetWindowIcon(window_icon_rgb_pixels, window_icon_width, window_icon_height); + Backend_SetWindowIcon(window_icon_rgb_pixels, window_icon_width, window_icon_height); FreeBitmap(window_icon_rgb_pixels); } #endif @@ -296,7 +296,7 @@ int main(int argc, char *argv[]) if (cursor_rgb_pixels != NULL) { - PlatformBackend_SetCursor(cursor_rgb_pixels, cursor_width, cursor_height); + Backend_SetCursor(cursor_rgb_pixels, cursor_width, cursor_height); FreeBitmap(cursor_rgb_pixels); } @@ -319,7 +319,7 @@ int main(int argc, char *argv[]) // Draw to screen if (!Flip_SystemTask()) { - PlatformBackend_Deinit(); + Backend_Deinit(); return EXIT_SUCCESS; } @@ -345,7 +345,7 @@ int main(int argc, char *argv[]) EndDirectSound(); EndDirectDraw(); - PlatformBackend_Deinit(); + Backend_Deinit(); return EXIT_SUCCESS; } @@ -379,7 +379,7 @@ void JoystickProc(void); BOOL SystemTask(void) { - if (!PlatformBackend_SystemTask()) + if (!Backend_SystemTask()) return FALSE; for (unsigned int i = 0; i < BACKEND_KEYBOARD_TOTAL; ++i) diff --git a/src/Profile.cpp b/src/Profile.cpp index 988b1b65..b9048bee 100644 --- a/src/Profile.cpp +++ b/src/Profile.cpp @@ -6,7 +6,7 @@ #include "WindowsWrapper.h" -#include "Backends/Platform.h" +#include "Backends/Misc.h" #include "ArmsItem.h" #include "BossLife.h" #include "Fade.h" @@ -247,9 +247,9 @@ BOOL InitializeGame(void) if (!TransferStage(13, 200, 10, 8)) { #ifdef JAPANESE - PlatformBackend_ShowMessageBox("エラー", "ステージの読み込みに失敗"); + Backend_ShowMessageBox("エラー", "ステージの読み込みに失敗"); #else - PlatformBackend_ShowMessageBox("Error", "Failed to load stage"); + Backend_ShowMessageBox("Error", "Failed to load stage"); #endif return FALSE; diff --git a/src/TextScr.cpp b/src/TextScr.cpp index ee4c8582..240c8269 100644 --- a/src/TextScr.cpp +++ b/src/TextScr.cpp @@ -6,7 +6,7 @@ #include "WindowsWrapper.h" -#include "Backends/Platform.h" +#include "Backends/Misc.h" #include "ArmsItem.h" #include "Boss.h" #include "BossLife.h" @@ -726,9 +726,9 @@ int TextScriptProc(void) if (!TransferStage(z, w, x, y)) { #ifdef JAPANESE - PlatformBackend_ShowMessageBox("エラー", "ステージの読み込みに失敗"); + Backend_ShowMessageBox("エラー", "ステージの読み込みに失敗"); #else - PlatformBackend_ShowMessageBox("Error", "Failed to load stage"); + Backend_ShowMessageBox("Error", "Failed to load stage"); #endif return enum_ESCRETURN_exit; @@ -1283,10 +1283,10 @@ int TextScriptProc(void) char str_0[0x40]; #ifdef JAPANESE sprintf(str_0, "不明のコード:<%c%c%c", gTS.data[gTS.p_read + 1], gTS.data[gTS.p_read + 2], gTS.data[gTS.p_read + 3]); - PlatformBackend_ShowMessageBox("エラー", str_0); + Backend_ShowMessageBox("エラー", str_0); #else sprintf(str_0, "Unknown code:<%c%c%c", gTS.data[gTS.p_read + 1], gTS.data[gTS.p_read + 2], gTS.data[gTS.p_read + 3]); - PlatformBackend_ShowMessageBox("Error", str_0); + Backend_ShowMessageBox("Error", str_0); #endif return enum_ESCRETURN_exit;