code: added base
parent
aff02ea737
commit
a177e4c208
|
@ -0,0 +1,22 @@
|
|||
# EditorConfig is awesome: http://EditorConfig.org
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# Unix-style newlines with a newline ending every file
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
|
||||
# Set default charset
|
||||
charset = utf-8
|
||||
|
||||
# 4 space indentation
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[Makefile]
|
||||
indent_style = tab
|
||||
|
||||
[CMakeLists.txt]
|
||||
indent_size = 2
|
|
@ -1 +1,2 @@
|
|||
build
|
||||
.vscode
|
||||
|
|
|
@ -1,33 +1,11 @@
|
|||
cmake_minimum_required(VERSION 3.15)
|
||||
project(eco2d)
|
||||
|
||||
find_package(raylib 3.5 QUIET)
|
||||
|
||||
if (NOT raylib_FOUND)
|
||||
include(FetchContent)
|
||||
|
||||
FetchContent_Declare(
|
||||
raylib
|
||||
URL https://github.com/raysan5/raylib/archive/master.tar.gz
|
||||
)
|
||||
|
||||
FetchContent_GetProperties(raylib)
|
||||
if (NOT raylib_POPULATED)
|
||||
set(FETCHCONTENT_QUIET NO)
|
||||
FetchContent_Populate(raylib)
|
||||
|
||||
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
||||
|
||||
# build raylib
|
||||
add_subdirectory(${raylib_SOURCE_DIR} ${raylib_BINARY_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
|
||||
add_executable(eco2d code/apps/client/main.c)
|
||||
include_directories(eco2d-client code/vendors)
|
||||
include_directories(eco2d-server code/vendors)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/)
|
||||
|
||||
include_directories(eco2d code/vendors)
|
||||
|
||||
target_link_libraries(eco2d raylib)
|
||||
add_subdirectory(code/apps/client)
|
||||
add_subdirectory(code/apps/server)
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
find_package(raylib 3.5 QUIET)
|
||||
|
||||
if (NOT raylib_FOUND)
|
||||
include(FetchContent)
|
||||
|
||||
FetchContent_Declare(
|
||||
raylib
|
||||
URL https://github.com/raysan5/raylib/archive/master.tar.gz
|
||||
)
|
||||
|
||||
FetchContent_GetProperties(raylib)
|
||||
if (NOT raylib_POPULATED)
|
||||
set(FETCHCONTENT_QUIET NO)
|
||||
FetchContent_Populate(raylib)
|
||||
|
||||
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
||||
|
||||
add_subdirectory(${raylib_SOURCE_DIR} ${raylib_BINARY_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_executable(eco2d-client
|
||||
source/main.c
|
||||
source/network.c
|
||||
source/renderer.c
|
||||
source/game.c
|
||||
|
||||
header/renderer.h
|
||||
header/network.h
|
||||
header/game.h
|
||||
)
|
||||
|
||||
include_directories(header/)
|
||||
target_link_libraries(eco2d-client raylib)
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
|
||||
void game_init();
|
||||
void game_shutdown();
|
||||
|
||||
void game_input();
|
||||
void game_update();
|
||||
void game_render();
|
|
@ -0,0 +1,2 @@
|
|||
#include "librg.h"
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
|
||||
void gfx_init();
|
||||
void gfx_shutdown();
|
||||
|
||||
void gfx_render();
|
|
@ -1,44 +0,0 @@
|
|||
#include "raylib.h"
|
||||
|
||||
// #define LIBRG_IMPL
|
||||
#include "librg.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
// TODO: Update your variables here
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
#include "game.h"
|
||||
#include "renderer.h"
|
||||
|
||||
void game_init() {
|
||||
gfx_init();
|
||||
}
|
||||
|
||||
void game_shutdown() {
|
||||
gfx_shutdown();
|
||||
}
|
||||
|
||||
|
||||
void game_input() {
|
||||
|
||||
}
|
||||
|
||||
void game_update() {
|
||||
|
||||
}
|
||||
|
||||
void game_render() {
|
||||
gfx_render();
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
#include "raylib.h"
|
||||
#include "game.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
game_init();
|
||||
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
game_input();
|
||||
game_update();
|
||||
game_render();
|
||||
}
|
||||
|
||||
game_shutdown();
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
#define ZPL_IMPL
|
||||
#include "zpl.h"
|
||||
|
||||
#define LIBRG_IMPL
|
||||
#define LIBRG_CUSTOM_ZPL
|
||||
#include "librg.h"
|
|
@ -0,0 +1,23 @@
|
|||
#include "renderer.h"
|
||||
#include "raylib.h"
|
||||
#include "zpl.h"
|
||||
|
||||
const zpl_u32 screenWidth = 800;
|
||||
const zpl_u32 screenHeight = 450;
|
||||
|
||||
void gfx_init() {
|
||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
|
||||
SetTargetFPS(60);
|
||||
}
|
||||
|
||||
void gfx_shutdown() {
|
||||
CloseWindow();
|
||||
}
|
||||
|
||||
|
||||
void gfx_render() {
|
||||
BeginDrawing();
|
||||
ClearBackground(RAYWHITE);
|
||||
DrawText("NOBODY EXPECTS SPANISH INQUISITION!", 190, 200, 20, RED);
|
||||
EndDrawing();
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
add_executable(eco2d-server
|
||||
source/main.c
|
||||
source/network.c
|
||||
|
||||
header/network.h
|
||||
)
|
||||
|
||||
include_directories(header/)
|
||||
target_link_libraries(eco2d-server raylib)
|
|
@ -0,0 +1,7 @@
|
|||
#define LIBRG_IMPL
|
||||
#include "librg.h"
|
||||
|
||||
int main(void) {
|
||||
printf("hello world\n");
|
||||
return 0;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue