Introduce eco2d-cli

isolation_bkp/dynres
Dominik Madarász 2021-01-11 21:08:16 +01:00
parent b3bff8c7fd
commit 43bd646071
9 changed files with 59 additions and 7 deletions

View File

@ -3,7 +3,11 @@ project(eco2d)
set(CMAKE_C_STANDARD 11) set(CMAKE_C_STANDARD 11)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR})
include_directories(eco2d-cli code/vendors code/common)
include_directories(eco2d-client code/vendors code/common) include_directories(eco2d-client code/vendors code/common)
include_directories(eco2d-server code/vendors code/common) include_directories(eco2d-server code/vendors code/common)

View File

@ -19,16 +19,33 @@ if (NOT raylib_FOUND)
endif() endif()
endif() endif()
add_executable(eco2d-client add_library(client-common STATIC
source/main.c
source/network.c source/network.c
source/renderer.c
source/game.c source/game.c
header/renderer.h
header/network.h header/network.h
header/renderer.h
header/game.h header/game.h
) )
add_executable(eco2d-client
source/main.c
source/renderer_raylib.c
)
add_executable(eco2d-cli
source/main.c
source/renderer_text.c
)
include_directories(header/) include_directories(header/)
target_link_libraries(eco2d-client raylib) target_link_libraries(eco2d-client raylib client-common)
target_link_libraries(eco2d-cli client-common)
if (WIN32)
target_link_libraries(eco2d-cli winmm)
target_link_libraries(eco2d-client winmm)
elseif (UNIX)
target_link_libraries(eco2d-cli pthread m dl)
target_link_libraries(eco2d-client pthread m dl)
endif()

View File

@ -1,7 +1,9 @@
#pragma once #pragma once
#include "system.h"
void game_init(); void game_init();
void game_shutdown(); void game_shutdown();
uint8_t game_is_running();
void game_input(); void game_input();
void game_update(); void game_update();

View File

@ -1 +1,2 @@
#pragma once #pragma once
#include "system.h"

View File

@ -1,6 +1,8 @@
#pragma once #pragma once
#include "system.h"
void gfx_init(); void gfx_init();
void gfx_shutdown(); void gfx_shutdown();
uint8_t gfx_is_running();
void gfx_render(); void gfx_render();

View File

@ -9,6 +9,9 @@ void game_shutdown() {
gfx_shutdown(); gfx_shutdown();
} }
uint8_t game_is_running() {
return gfx_is_running();
}
void game_input() { void game_input() {

View File

@ -1,10 +1,12 @@
#define ZPL_IMPL
#include "zpl.h"
#include "game.h" #include "game.h"
int main(void) int main(void)
{ {
game_init(); game_init();
while (!WindowShouldClose()) while (game_is_running())
{ {
game_input(); game_input();
game_update(); game_update();

View File

@ -1,4 +1,3 @@
#include "system.h"
#include "renderer.h" #include "renderer.h"
#include "raylib.h" #include "raylib.h"
@ -14,6 +13,10 @@ void gfx_shutdown() {
CloseWindow(); CloseWindow();
} }
uint8_t gfx_is_running() {
return !WindowShouldClose();
}
void gfx_render() { void gfx_render() {
BeginDrawing(); BeginDrawing();
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);

View File

@ -0,0 +1,18 @@
#include "renderer.h"
#include <stdio.h>
void gfx_init() {
printf("eco2d-cli\n");
}
void gfx_shutdown() {
printf("Bye!\n");
}
uint8_t gfx_is_running() {
}
void gfx_render() {
// TODO
}