From a9885f97631f165b366ad51d7f30aa0c2fcaf861 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Madar=C3=A1sz?= Date: Mon, 11 Jan 2021 21:11:03 +0100 Subject: [PATCH] Rename renderer to platform --- code/apps/client/CMakeLists.txt | 6 +++--- code/apps/client/header/platform.h | 8 ++++++++ code/apps/client/header/renderer.h | 8 -------- code/apps/client/source/game.c | 10 +++++----- .../{renderer_raylib.c => platform_raylib.c} | 10 +++++----- code/apps/client/source/platform_text.c | 18 ++++++++++++++++++ code/apps/client/source/renderer_text.c | 18 ------------------ 7 files changed, 39 insertions(+), 39 deletions(-) create mode 100644 code/apps/client/header/platform.h delete mode 100644 code/apps/client/header/renderer.h rename code/apps/client/source/{renderer_raylib.c => platform_raylib.c} (74%) create mode 100644 code/apps/client/source/platform_text.c delete mode 100644 code/apps/client/source/renderer_text.c diff --git a/code/apps/client/CMakeLists.txt b/code/apps/client/CMakeLists.txt index cdb3a75..83084f7 100644 --- a/code/apps/client/CMakeLists.txt +++ b/code/apps/client/CMakeLists.txt @@ -24,18 +24,18 @@ add_library(client-common STATIC source/game.c header/network.h - header/renderer.h + header/platform.h header/game.h ) add_executable(eco2d-client source/main.c - source/renderer_raylib.c + source/platform_raylib.c ) add_executable(eco2d-cli source/main.c - source/renderer_text.c + source/platform_text.c ) include_directories(header/) diff --git a/code/apps/client/header/platform.h b/code/apps/client/header/platform.h new file mode 100644 index 0000000..df9f523 --- /dev/null +++ b/code/apps/client/header/platform.h @@ -0,0 +1,8 @@ +#pragma once +#include "system.h" + +void platform_init(); +void platform_shutdown(); +uint8_t platform_is_running(); + +void platform_render(); diff --git a/code/apps/client/header/renderer.h b/code/apps/client/header/renderer.h deleted file mode 100644 index 42998c0..0000000 --- a/code/apps/client/header/renderer.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once -#include "system.h" - -void gfx_init(); -void gfx_shutdown(); -uint8_t gfx_is_running(); - -void gfx_render(); diff --git a/code/apps/client/source/game.c b/code/apps/client/source/game.c index bf4e0cb..a6af58a 100644 --- a/code/apps/client/source/game.c +++ b/code/apps/client/source/game.c @@ -1,16 +1,16 @@ #include "game.h" -#include "renderer.h" +#include "platform.h" void game_init() { - gfx_init(); + platform_init(); } void game_shutdown() { - gfx_shutdown(); + platform_shutdown(); } uint8_t game_is_running() { - return gfx_is_running(); + return platform_is_running(); } void game_input() { @@ -22,6 +22,6 @@ void game_update() { } void game_render() { - gfx_render(); + platform_render(); } diff --git a/code/apps/client/source/renderer_raylib.c b/code/apps/client/source/platform_raylib.c similarity index 74% rename from code/apps/client/source/renderer_raylib.c rename to code/apps/client/source/platform_raylib.c index 87325cf..1b0d4c7 100644 --- a/code/apps/client/source/renderer_raylib.c +++ b/code/apps/client/source/platform_raylib.c @@ -1,23 +1,23 @@ -#include "renderer.h" +#include "platform.h" #include "raylib.h" const uint16_t screenWidth = 800; const uint16_t screenHeight = 450; -void gfx_init() { +void platform_init() { InitWindow(screenWidth, screenHeight, "eco2d - client"); SetTargetFPS(60); } -void gfx_shutdown() { +void platform_shutdown() { CloseWindow(); } -uint8_t gfx_is_running() { +uint8_t platform_is_running() { return !WindowShouldClose(); } -void gfx_render() { +void platform_render() { BeginDrawing(); ClearBackground(RAYWHITE); DrawText("NOBODY EXPECTS SPANISH INQUISITION!", 190, 200, 20, RED); diff --git a/code/apps/client/source/platform_text.c b/code/apps/client/source/platform_text.c new file mode 100644 index 0000000..e11dfd4 --- /dev/null +++ b/code/apps/client/source/platform_text.c @@ -0,0 +1,18 @@ +#include "platform.h" +#include + +void platform_init() { + printf("eco2d-cli\n"); +} + +void platform_shutdown() { + printf("Bye!\n"); +} + +uint8_t platform_is_running() { + +} + +void platform_render() { + // TODO +} diff --git a/code/apps/client/source/renderer_text.c b/code/apps/client/source/renderer_text.c deleted file mode 100644 index a06aee1..0000000 --- a/code/apps/client/source/renderer_text.c +++ /dev/null @@ -1,18 +0,0 @@ -#include "renderer.h" -#include - -void gfx_init() { - printf("eco2d-cli\n"); -} - -void gfx_shutdown() { - printf("Bye!\n"); -} - -uint8_t gfx_is_running() { - -} - -void gfx_render() { - // TODO -}