From 85d0bad3500484a6b0b29f9c37defccbbf877012 Mon Sep 17 00:00:00 2001 From: herbglitch Date: Fri, 12 Jan 2024 19:48:06 -0700 Subject: [PATCH 1/2] huge redesign --- CMakeLists.txt | 130 ++++++++++++++++++---------------------- include/arc/std/errno.h | 10 +--- src/engine/engine.c | 5 ++ src/std/io.c | 2 +- 4 files changed, 66 insertions(+), 81 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c9b71b..cc61735 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.25) set(ARCHEUS_STD_VERSION 0.0.0) project(archeus_std LANGUAGES C VERSION ${ARCHEUS_STD_VERSION} DESCRIPTION "libarcheus_std standard archeus c library") @@ -9,52 +9,32 @@ function(print var) message("${var} = ${${var}}") endfunction() -option(ARCHEUS_STD_DEBUG "Build in debug mode" ON) +#TODO: Might want to remove this +if(NOT CMAKE_BUILD_TYPE) + message("[Archeus C STD] Build Type not set, defaulting to Debug") + set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Default to Debug" FORCE) +endif() + +# ~ OPTIONS ~ # option(ARCHEUS_STD_DEFAULT_CONFIG "Build with default config keys" ON) -option(ARCHEUS_STD_SDL "Build with SDL" OFF) -option(ARCHEUS_STD_GLFW "Build with GLFW window" OFF) -option(ARCHEUS_STD_GLEW "Build with GLEW" OFF) -option(ARCHEUS_STD_OPENGL "Build with OpenGL" OFF) +set(ARCHEUS_STD_WINDOW_BACKEND "NONE" CACHE STRING "Window Backend to build with") +set_property(CACHE ARCHEUS_STD_WINDOW_BACKEND PROPERTY STRINGS NONE SDL2 GLFW) + +set(ARCHEUS_STD_INPUT_BACKEND "NONE" CACHE STRING "Input Backend to build with, most likely should match Window API") +set_property(CACHE ARCHEUS_STD_INPUT_BACKEND PROPERTY STRINGS NONE SDL2 GLFW) + +set(ARCHEUS_STD_GRAPHICS_BACKEND "NONE" CACHE STRING "Graphics Backend to build with") +set_property(CACHE ARCHEUS_STD_GRAPHICS_BACKEND PROPERTY STRINGS NONE SDL2 OPENGL) + +# ~ INIT VARIABLES ~ # set(ARCHEUS_STD_FLAGS "") +set(ARCHEUS_STD_LIBRARIES "") -if(ARCHEUS_STD_DEBUG) - string(APPEND ARCHEUS_STD_FLAGS "-Wall -Werror -g -ggdb -DARC_DEBUG ") -endif() - -if(ARCHEUS_STD_DEFAULT_CONFIG) - string(APPEND ARCHEUS_STD_FLAGS "-DARC_DEFAULT_CONFIG ") -endif() - -if(ARCHEUS_STD_SDL) - if(NOT PNG AND WIN32 AND NOT MSVC) - set(PNG_LIBRARY "C:/Program Files(x86)/libpng") - set(PNG_PNG_INCLUDE_DIR "C:/Program Files(x86)/libpng/include") - endif() - - find_package(SDL2 REQUIRED) - find_package(SDL2_image REQUIRED) - find_package(SDL2_ttf REQUIRED) - - string(APPEND ARCHEUS_STD_FLAGS "-DARC_SDL ") -endif() - -if(ARCHEUS_STD_GLFW) - string(APPEND ARCHEUS_STD_FLAGS "-DARC_GLFW ") -endif() - -if(ARCHEUS_STD_GLEW) - string(APPEND ARCHEUS_STD_FLAGS "-DARC_GLEW ") -endif() - -if(ARCHEUS_STD_OPENGL) - string(APPEND ARCHEUS_STD_FLAGS "-DARC_OPENGL") -endif() - -set(CMAKE_C_FLAGS ${ARCHEUS_STD_FLAGS}) - +# ~ ARCHEUS_SOURCES ~ # set(ARCHEUS_STD_SOURCES src/std/config.c + src/std/errno.c src/std/handler.c src/std/hashtable.c src/std/io.c @@ -74,21 +54,37 @@ set(ARCHEUS_STD_SOURCES src/engine/state.c ) -set(ARCHEUS_STD_SDL_SOURCES - src/input/sdl/keyboard.c - src/input/sdl/mouse.c +if(CMAKE_BUILD_TYPE STREQUAL "Debug") + string(APPEND ARCHEUS_STD_FLAGS "-Wall -Werror -g -ggdb -DARC_DEBUG ") +endif() - src/graphics/sdl/circle.c - src/graphics/sdl/config.c - src/graphics/sdl/line.c - src/graphics/sdl/obround.c - src/graphics/sdl/rectangle.c - src/graphics/sdl/renderer.c - src/graphics/sdl/sprite.c - src/graphics/sdl/spritesheet.c - src/graphics/sdl/text.c - src/graphics/sdl/window.c -) +# TODO: replace this with a better system +if(ARCHEUS_STD_DEFAULT_CONFIG) + string(APPEND ARCHEUS_STD_FLAGS "-DARC_DEFAULT_CONFIG ") +endif() + +# ~ NONE ~ # +include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/archeus_none.cmake) +none_check_and_init_needed(ARCHEUS_STD_FLAGS ARCHEUS_STD_SOURCES ${ARCHEUS_STD_WINDOW_BACKEND} ${ARCHEUS_STD_INPUT_BACKEND} ${ARCHEUS_STD_GRAPHICS_BACKEND}) + +# ~ SDL2 ~ # +include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/archeus_sdl2.cmake) +sdl2_check_and_init_needed(ARCHEUS_STD_FLAGS ARCHEUS_STD_SOURCES ${ARCHEUS_STD_WINDOW_BACKEND} ${ARCHEUS_STD_INPUT_BACKEND} ${ARCHEUS_STD_GRAPHICS_BACKEND}) + +# ~ OPENGL ~ # +if(ARCHEUS_STD_GRAPHICS_BACKEND STREQUAL OPENGL) + string(APPEND ARCHEUS_STD_FLAGS "-DARC_OPENGL ") +endif() + +if(ARCHEUS_STD_GLFW) + string(APPEND ARCHEUS_STD_FLAGS "-DARC_GLFW ") +endif() + +if(ARCHEUS_STD_GLEW) + string(APPEND ARCHEUS_STD_FLAGS "-DARC_GLEW ") +endif() + +set(CMAKE_C_FLAGS ${ARCHEUS_STD_FLAGS}) set(ARCHEUS_STD_OPENGL_SOURCES src/graphics/opengl/config.c @@ -105,10 +101,6 @@ set(ARCHEUS_STD_GLFW_SOURCES src/input/glfw/mouse.c ) -if(ARCHEUS_STD_SDL) - list(APPEND ARCHEUS_STD_SOURCES ${ARCHEUS_STD_SDL_SOURCES}) -endif() - if(ARCHEUS_STD_OPENGL) list(APPEND ARCHEUS_STD_SOURCES ${ARCHEUS_STD_OPENGL_SOURCES}) endif() @@ -123,21 +115,13 @@ else() add_library(archeus_std SHARED ${ARCHEUS_STD_SOURCES}) endif() -if(ARCHEUS_STD_SDL) - target_include_directories(archeus_std - PUBLIC $ - PRIVATE ${SDL2_INCLUDE_DIRS} - PRIVATE ${SDL2IMAGE_INCLUDE_DIRS} - ) +target_include_directories(archeus_std + PUBLIC $ +) - target_link_libraries(archeus_std PUBLIC ${SDL2_LIBRARIES} SDL2_image::SDL2_image SDL2_ttf::SDL2_ttf) -endif() - -if(ARCHEUS_STD_OPENGL) - target_include_directories(archeus_std PRIVATE - PUBLIC $ - ) -endif() +target_link_libraries(archeus_std + PUBLIC m +) install(TARGETS archeus_std EXPORT archeus_std_Exports LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/include/arc/std/errno.h b/include/arc/std/errno.h index 47bbf0c..8949b29 100644 --- a/include/arc/std/errno.h +++ b/include/arc/std/errno.h @@ -10,16 +10,12 @@ #define ARC_ERRNO_OVERFLOW -0x05 #define ARC_ERRNO_INIT -0x06 -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-variable" -static int32_t arc_errno = 0; -#pragma GCC diagnostic pop - - #ifdef __cplusplus extern "C" { #endif +extern int32_t arc_errno; + #ifdef __cplusplus } #endif @@ -27,7 +23,7 @@ extern "C" { #ifdef ARC_DEBUG # include # define ARC_DEBUG_LOG(ERR, STR, ...) printf("[ERROR %d] " STR "\n", ERR, __VA_ARGS__) -# define ARC_DEBUG_ERR(STR) printf("[ERROR %d]" STR "\n", arc_errno) +# define ARC_DEBUG_ERR(STR) printf("[ERROR %d] " STR "\n", arc_errno) #else # define ARC_DEBUG_LOG(ERR, STR, ...) # define ARC_DEBUG_ERR(STR) diff --git a/src/engine/engine.c b/src/engine/engine.c index 3b0fa67..2452ce8 100644 --- a/src/engine/engine.c +++ b/src/engine/engine.c @@ -9,6 +9,11 @@ #include "arc/std/handler.h" //NOTE: some of this file is temporary, mostly to get smthn running so I can test out different ideas +#include "arc/graphics/none/window.h" +#include "arc/graphics/none/renderer.h" +#include "arc/input/none/mouse.h" +#include "arc/input/none/keyboard.h" + #ifdef ARC_SDL #include "arc/graphics/sdl/window.h" #include "arc/graphics/sdl/renderer.h" diff --git a/src/std/io.c b/src/std/io.c index 011655a..6d219a2 100644 --- a/src/std/io.c +++ b/src/std/io.c @@ -8,8 +8,8 @@ void ARC_IO_FileToStr(ARC_String *path, ARC_String **data){ FILE *file = fopen(path->data, "rb"); if(!file){ - return; arc_errno = ARC_ERRNO_NULL; + return; } fseek(file, 0L, SEEK_END); From c614c679a9cea873a6fb841e9e7b0145b0060975 Mon Sep 17 00:00:00 2001 From: herbglitch Date: Fri, 12 Jan 2024 19:48:17 -0700 Subject: [PATCH 2/2] huge core redesign --- cmake/archeus_none.cmake | 41 ++++++++++++++++ cmake/archeus_opengl.cmake | 0 cmake/archeus_sdl2.cmake | 64 +++++++++++++++++++++++++ include/arc/graphics/none/renderer.h | 14 ++++++ include/arc/graphics/none/sprite.h | 12 +++++ include/arc/graphics/none/spritesheet.h | 12 +++++ include/arc/graphics/none/text.h | 12 +++++ include/arc/graphics/none/window.h | 14 ++++++ include/arc/input/none/keyboard.h | 14 ++++++ include/arc/input/none/mouse.h | 14 ++++++ src/graphics/none/circle.c | 10 ++++ src/graphics/none/config.c | 10 ++++ src/graphics/none/line.c | 10 ++++ src/graphics/none/obround.c | 14 ++++++ src/graphics/none/rectangle.c | 22 +++++++++ src/graphics/none/renderer.c | 22 +++++++++ src/graphics/none/sprite.c | 48 +++++++++++++++++++ src/graphics/none/spritesheet.c | 21 ++++++++ src/graphics/none/text.c | 26 ++++++++++ src/graphics/none/window.c | 14 ++++++ src/input/none/keyboard.c | 23 +++++++++ src/input/none/mouse.c | 37 ++++++++++++++ src/std/errno.c | 3 ++ 23 files changed, 457 insertions(+) create mode 100644 cmake/archeus_none.cmake create mode 100644 cmake/archeus_opengl.cmake create mode 100644 cmake/archeus_sdl2.cmake create mode 100644 include/arc/graphics/none/renderer.h create mode 100644 include/arc/graphics/none/sprite.h create mode 100644 include/arc/graphics/none/spritesheet.h create mode 100644 include/arc/graphics/none/text.h create mode 100644 include/arc/graphics/none/window.h create mode 100644 include/arc/input/none/keyboard.h create mode 100644 include/arc/input/none/mouse.h create mode 100644 src/graphics/none/circle.c create mode 100644 src/graphics/none/config.c create mode 100644 src/graphics/none/line.c create mode 100644 src/graphics/none/obround.c create mode 100644 src/graphics/none/rectangle.c create mode 100644 src/graphics/none/renderer.c create mode 100644 src/graphics/none/sprite.c create mode 100644 src/graphics/none/spritesheet.c create mode 100644 src/graphics/none/text.c create mode 100644 src/graphics/none/window.c create mode 100644 src/input/none/keyboard.c create mode 100644 src/input/none/mouse.c create mode 100644 src/std/errno.c diff --git a/cmake/archeus_none.cmake b/cmake/archeus_none.cmake new file mode 100644 index 0000000..a651a73 --- /dev/null +++ b/cmake/archeus_none.cmake @@ -0,0 +1,41 @@ +set(ARCHEUS_STD_NONE_WINDOW_SOURCES +) + +set(ARCHEUS_STD_NONE_INPUT_SOURCES + src/input/none/keyboard.c + src/input/none/mouse.c +) + +set(ARCHEUS_STD_NONE_GRAPHICS_SOURCES + src/graphics/none/circle.c + src/graphics/none/config.c + src/graphics/none/line.c + src/graphics/none/obround.c + src/graphics/none/rectangle.c + src/graphics/none/renderer.c + src/graphics/none/sprite.c + src/graphics/none/spritesheet.c + src/graphics/none/text.c + src/graphics/none/window.c +) + +function(none_check_and_init_needed _ARCHEUS_STD_FLAGS _ARCHEUS_STD_SOURCES ARCHEUS_STD_WINDOW_BACKEND ARCHEUS_STD_INPUT_BACKEND ARCHEUS_STD_GRAPHICS_BACKEND) + #add matching files for the selected backends + if(${ARCHEUS_STD_WINDOW_BACKEND} STREQUAL "NONE") + string(APPEND ${_ARCHEUS_STD_FLAGS} "-DARC_NONE_WINDOW ") + list(APPEND ${_ARCHEUS_STD_SOURCES} ${ARCHEUS_STD_NONE_WINDOW_SOURCES}) + endif() + + if(${ARCHEUS_STD_INPUT_BACKEND} STREQUAL "NONE") + string(APPEND ${_ARCHEUS_STD_FLAGS} "-DARC_NONE_INPUT ") + list(APPEND ${_ARCHEUS_STD_SOURCES} ${ARCHEUS_STD_NONE_INPUT_SOURCES}) + endif() + + if(${ARCHEUS_STD_GRAPHICS_BACKEND} STREQUAL "NONE") + string(APPEND ${_ARCHEUS_STD_FLAGS} "-DARC_NONE_GRAPHICS ") + list(APPEND ${_ARCHEUS_STD_SOURCES} ${ARCHEUS_STD_NONE_GRAPHICS_SOURCES}) + endif() + + set(${_ARCHEUS_STD_FLAGS} ${${_ARCHEUS_STD_FLAGS}} PARENT_SCOPE) + set(${_ARCHEUS_STD_SOURCES} ${${_ARCHEUS_STD_SOURCES}} PARENT_SCOPE) +endfunction() \ No newline at end of file diff --git a/cmake/archeus_opengl.cmake b/cmake/archeus_opengl.cmake new file mode 100644 index 0000000..e69de29 diff --git a/cmake/archeus_sdl2.cmake b/cmake/archeus_sdl2.cmake new file mode 100644 index 0000000..fbdfe9b --- /dev/null +++ b/cmake/archeus_sdl2.cmake @@ -0,0 +1,64 @@ +set(ARCHEUS_STD_SDL2_WINDOW_SOURCES +) + +set(ARCHEUS_STD_SDL2_INPUT_SOURCES + src/input/sdl/keyboard.c + src/input/sdl/mouse.c +) + +set(ARCHEUS_STD_SDL2_GRAPHICS_SOURCES + src/graphics/sdl/circle.c + src/graphics/sdl/config.c + src/graphics/sdl/line.c + src/graphics/sdl/obround.c + src/graphics/sdl/rectangle.c + src/graphics/sdl/renderer.c + src/graphics/sdl/sprite.c + src/graphics/sdl/spritesheet.c + src/graphics/sdl/text.c + src/graphics/sdl/window.c +) + +function(sdl2_check_and_init_needed ARCHEUS_STD_FLAGS ARCHEUS_STD_SOURCES ARCHEUS_STD_WINDOW_BACKEND ARCHEUS_STD_INPUT_BACKEND ARCHEUS_STD_GRAPHICS_BACKEND) + #if no backend uses sdl return + if(NOT ARCHEUS_STD_WINDOW_BACKEND STREQUAL "SDL2" AND NOT ARCHEUS_STD_INPUT_BACKEND STREQUAL "SDL2" AND NOT ARCHEUS_STD_GRAPHICS_BACKEND STREQUAL "SDL2") + return() + endif() + + string(APPEND ARCHEUS_STD_FLAGS "-DARC_SDL ") + + #get needed libraries for backends + find_package(SDL2 REQUIRED) + + if(ARCHEUS_STD_GRAPHICS_BACKEND STREQUAL "SDL2") + if(NOT PNG AND WIN32 AND NOT MSVC) + set(PNG_LIBRARY "C:/Program Files(x86)/libpng") + set(PNG_PNG_INCLUDE_DIR "C:/Program Files(x86)/libpng/include") + endif() + + find_package(SDL2_image REQUIRED) + find_package(SDL2_ttf REQUIRED) + endif() + + #add matching files for the selected backends + if(ARCHEUS_STD_INPUT_BACKEND STREQUAL "SDL2") + list(APPEND ARCHEUS_STD_SOURCES ${ARCHEUS_STD_SDL2_INPUT_SOURCES}) + endif() + + if(ARCHEUS_STD_INPUT_BACKEND STREQUAL "SDL2") + list(APPEND ARCHEUS_STD_SOURCES ${ARCHEUS_STD_SDL2_INPUT_SOURCES}) + endif() + + if(ARCHEUS_STD_GRAPHICS_BACKEND STREQUAL "SDL2") + list(APPEND ARCHEUS_STD_SOURCES ${ARCHEUS_STD_SDL2_GRAPHICS_SOURCES}) + endif() + + target_include_directories(archeus_std + PRIVATE ${SDL2_INCLUDE_DIRS} + PRIVATE ${SDL2IMAGE_INCLUDE_DIRS} + ) + + target_link_libraries(archeus_std PUBLIC ${SDL2_LIBRARIES} SDL2_image::SDL2_image SDL2_ttf::SDL2_ttf) + + return(ARCHEUS_STD_SDL2_SOURCES) +endfunction() \ No newline at end of file diff --git a/include/arc/graphics/none/renderer.h b/include/arc/graphics/none/renderer.h new file mode 100644 index 0000000..72a3cf2 --- /dev/null +++ b/include/arc/graphics/none/renderer.h @@ -0,0 +1,14 @@ +#ifdef ARC_NONE_GRAPHICS + +#include "arc/graphics/renderer.h" + +#ifndef ARC_NONE_RENDERER_H_ +#define ARC_NONE_RENDERER_H_ + +typedef void ARC_RendererType; + +struct ARC_RenderInfo {}; + +#endif // !ARC_NONE_RENDERER_H_ + +#endif // !ARC_NONE_GRAPHICS diff --git a/include/arc/graphics/none/sprite.h b/include/arc/graphics/none/sprite.h new file mode 100644 index 0000000..9776248 --- /dev/null +++ b/include/arc/graphics/none/sprite.h @@ -0,0 +1,12 @@ +#ifdef ARC_NONE_GRAPHICS + +#ifndef ARC_NONE_SPRITE_H_ +#define ARC_NONE_SPRITE_H_ + +#include "arc/graphics/sprite.h" + +struct ARC_Sprite {}; + +#endif // !ARC_NONE_SPRITE_H_ + +#endif // !ARC_NONE_GRAPHICS diff --git a/include/arc/graphics/none/spritesheet.h b/include/arc/graphics/none/spritesheet.h new file mode 100644 index 0000000..d6013b0 --- /dev/null +++ b/include/arc/graphics/none/spritesheet.h @@ -0,0 +1,12 @@ +#ifdef ARC_NONE_GRAPHICS + +#ifndef ARC_NONE_SPRITESHEET_H_ +#define ARC_NONE_SPRITESHEET_H_ + +#include "arc/graphics/spritesheet.h" + +struct ARC_Spritesheet {}; + +#endif // !ARC_NONE_SPRITESHEET_H_ + +#endif // !ARC_NONE_GRAPHICS \ No newline at end of file diff --git a/include/arc/graphics/none/text.h b/include/arc/graphics/none/text.h new file mode 100644 index 0000000..6b8f5be --- /dev/null +++ b/include/arc/graphics/none/text.h @@ -0,0 +1,12 @@ +#ifdef ARC_NONE_GRAPHICS + +#ifndef ARC_NONE_TEXT_H_ +#define ARC_NONE_TEXT_H_ + +#include "arc/graphics/text.h" + +struct ARC_Text {}; + +#endif // !ARC_NONE_TEXT_H_ + +#endif // !ARC_NONE_GRAPHICS diff --git a/include/arc/graphics/none/window.h b/include/arc/graphics/none/window.h new file mode 100644 index 0000000..d2594a2 --- /dev/null +++ b/include/arc/graphics/none/window.h @@ -0,0 +1,14 @@ +#ifdef ARC_NONE_WINDOW + +#ifndef ARC_NONE_WINDOW_H_ +#define ARC_NONE_WINDOW_H_ + +#include "arc/graphics/window.h" + +typedef void ARC_WindowType; + +struct ARC_WindowInfo {}; + +#endif // !ARC_SDL_WINDOW_H_ + +#endif // !ARC_NONE_WINDOW \ No newline at end of file diff --git a/include/arc/input/none/keyboard.h b/include/arc/input/none/keyboard.h new file mode 100644 index 0000000..4e078c5 --- /dev/null +++ b/include/arc/input/none/keyboard.h @@ -0,0 +1,14 @@ +#ifdef ARC_NONE_INPUT + +#ifndef ARC_NONE_KEYBOARD_H_ +#define ARC_NONE_KEYBOARD_H_ + +#include "arc/input/keyboard.h" + +struct ARC_Keyboard {}; + +struct ARC_KeyboardInfo {}; + +#endif // !ARC_NONE_KEYBOARD_H_ + +#endif // !ARC_NONE_INPUT \ No newline at end of file diff --git a/include/arc/input/none/mouse.h b/include/arc/input/none/mouse.h new file mode 100644 index 0000000..38b3e22 --- /dev/null +++ b/include/arc/input/none/mouse.h @@ -0,0 +1,14 @@ +#ifdef ARC_NONE_INPUT + +#ifndef ARC_NONE_MOUSE_H_ +#define ARC_NONE_MOUSE_H_ + +#include "arc/input/mouse.h" + +struct ARC_Mouse {}; + +struct ARC_MouseInfo {}; + +#endif // !ARC_NONE_MOUSE_H_ + +#endif // !ARC_NONE_INPUT \ No newline at end of file diff --git a/src/graphics/none/circle.c b/src/graphics/none/circle.c new file mode 100644 index 0000000..ffe771b --- /dev/null +++ b/src/graphics/none/circle.c @@ -0,0 +1,10 @@ +#ifdef ARC_NONE_GRAPHICS + +#include "arc/graphics/circle.h" +#include + +void ARC_Circle_Render(ARC_Circle *circle, ARC_Renderer *renderer, ARC_Color *color){ + printf("No Graphics Backend Selected\n"); +} + +#endif // !ARC_NONE_GRAPHICS \ No newline at end of file diff --git a/src/graphics/none/config.c b/src/graphics/none/config.c new file mode 100644 index 0000000..c307299 --- /dev/null +++ b/src/graphics/none/config.c @@ -0,0 +1,10 @@ +#ifdef ARC_NONE_GRAPHICS + +#include "arc/graphics/config.h" +#include + +void ARC_GraphicsConfig_Init(ARC_Config *config, ARC_Renderer *renderer){ + printf("No Graphics Backend Selected\n"); +} + +#endif //ARC_NONE_GRAPHICS \ No newline at end of file diff --git a/src/graphics/none/line.c b/src/graphics/none/line.c new file mode 100644 index 0000000..2f59143 --- /dev/null +++ b/src/graphics/none/line.c @@ -0,0 +1,10 @@ +#ifdef ARC_NONE_GRAPHICS + +#include "arc/graphics/line.h" +#include + +void ARC_Line_Render(int32_t *x1, int32_t *y1, int32_t *x2, int32_t *y2, ARC_Renderer *renderer, ARC_Color *color){ + printf("No Graphics Backend Selected\n"); +} + +#endif // !ARC_NONE_GRAPHICS \ No newline at end of file diff --git a/src/graphics/none/obround.c b/src/graphics/none/obround.c new file mode 100644 index 0000000..4192c4f --- /dev/null +++ b/src/graphics/none/obround.c @@ -0,0 +1,14 @@ +#ifdef ARC_NONE_GRAPHICS + +#include "arc/graphics/obround.h" +#include + +void ARC_Obround_Render(ARC_Obround *obround, ARC_Renderer *renderer, ARC_Color *color){ + printf("No Graphics Backend Selected\n"); +} + +void ARC_FObround_Render(ARC_FObround *obround, ARC_Renderer *renderer, ARC_Color *color){ + printf("No Graphics Backend Selected\n"); +} + +#endif // ARC_NONE_GRAPHICS \ No newline at end of file diff --git a/src/graphics/none/rectangle.c b/src/graphics/none/rectangle.c new file mode 100644 index 0000000..a59b6f4 --- /dev/null +++ b/src/graphics/none/rectangle.c @@ -0,0 +1,22 @@ +#ifdef ARC_NONE_GRAPHICS + +#include "arc/graphics/rectangle.h" +#include + +void ARC_Rect_Render(ARC_Rect *rect, ARC_Renderer *renderer, ARC_Color *color){ + printf("No Graphics Backend Selected\n"); +} + +void ARC_Rect_RenderFill(ARC_Rect *rect, ARC_Renderer *renderer, ARC_Color *color){ + printf("No Graphics Backend Selected\n"); +} + +void ARC_FRect_Render(ARC_FRect *rect, ARC_Renderer *renderer, ARC_Color *color){ + printf("No Graphics Backend Selected\n"); +} + +void ARC_FRect_RenderFill(ARC_FRect *rect, ARC_Renderer *renderer, ARC_Color *color){ + printf("No Graphics Backend Selected\n"); +} + +#endif // !ARC_NONE_GRAPHICS \ No newline at end of file diff --git a/src/graphics/none/renderer.c b/src/graphics/none/renderer.c new file mode 100644 index 0000000..96c722e --- /dev/null +++ b/src/graphics/none/renderer.c @@ -0,0 +1,22 @@ +#ifdef ARC_NONE_GRAPHICS + +#include "arc/graphics/renderer.h" +#include + +void ARC_Renderer_Create(ARC_Renderer **renderer, ARC_RenderInfo *info){ + printf("No Graphics Backend Selected\n"); +} + +void ARC_Renderer_Destroy(ARC_Renderer *renderer){ + printf("No Graphics Backend Selected\n"); +} + +void ARC_Renderer_Clear(ARC_Renderer *renderer){ + printf("No Graphics Backend Selected\n"); +} + +void ARC_Renderer_Render(ARC_Renderer *renderer){ + printf("No Graphics Backend Selected\n"); +} + +#endif // !ARC_NONE_GRAPHICS diff --git a/src/graphics/none/sprite.c b/src/graphics/none/sprite.c new file mode 100644 index 0000000..0b3cb6f --- /dev/null +++ b/src/graphics/none/sprite.c @@ -0,0 +1,48 @@ +#ifdef ARC_NONE_GRAPHICS + +#include "arc/graphics/sprite.h" +#include + +void ARC_Sprite_Create(ARC_Sprite **sprite, ARC_Spritesheet *spritesheet, ARC_Array *frames){ + printf("No Graphics Backend Selected\n"); +} + +void ARC_Sprite_Destroy(ARC_Sprite *sprite){ + printf("No Graphics Backend Selected\n"); +} + +void ARC_Sprite_Copy(ARC_Sprite **newSprite, ARC_Sprite *oldSprite){ + printf("No Graphics Backend Selected\n"); +} + +void ARC_Sprite_Render(ARC_Sprite *sprite, ARC_Renderer *renderer, ARC_Rect *renderBounds){ + printf("No Graphics Backend Selected\n"); +} + +void ARC_Sprite_RenderFlip(ARC_Sprite *sprite, ARC_Renderer *renderer, ARC_Rect *renderBounds, enum ARC_Sprite_Axis axis){ + printf("No Graphics Backend Selected\n"); +} + +void ARC_Sprite_RenderRotated(ARC_Sprite *sprite, ARC_Renderer *renderer, ARC_Rect *renderBounds, ARC_Point *center, double angle){ + printf("No Graphics Backend Selected\n"); +} + +void ARC_Sprite_SetFrameIndex(ARC_Sprite *sprite, uint32_t index){ + printf("No Graphics Backend Selected\n"); +} + +void ARC_Sprite_IterateFrame(ARC_Sprite *sprite){ + printf("No Graphics Backend Selected\n"); +} + +ARC_Rect *ARC_Sprite_GetBounds(ARC_Sprite *sprite){ + printf("No Graphics Backend Selected\n"); + return NULL; +} + +ARC_Array *ARC_Sprite_GetAllBounds(ARC_Sprite *sprite){ + printf("No Graphics Backend Selected\n"); + return NULL; +} + +#endif // !ARC_NONE_GRAPHICS \ No newline at end of file diff --git a/src/graphics/none/spritesheet.c b/src/graphics/none/spritesheet.c new file mode 100644 index 0000000..a08d5ce --- /dev/null +++ b/src/graphics/none/spritesheet.c @@ -0,0 +1,21 @@ +#ifdef ARC_NONE_GRAPHICS + +#include "arc/graphics/spritesheet.h" +#include "arc/math/point.h" +#include + +void ARC_Spritesheet_RenderArea(ARC_Spritesheet *spritesheet, ARC_Rect *sheetBounds, ARC_Renderer *renderer, ARC_Rect *renderBounds){ + printf("No Graphics Backend Selected\n"); +} + +ARC_Point ARC_Spritesheet_GetSize(ARC_Spritesheet *spritesheet){ + printf("No Graphics Backend Selected\n"); + return (ARC_Point){ 0, 0 }; +} + +uint32_t *ARC_Spritesheet_GetTileSize(ARC_Spritesheet *spritesheet){ + printf("No Graphics Backend Selected\n"); + return NULL; +} + +#endif // !ARC_NONE_GRAPHICS \ No newline at end of file diff --git a/src/graphics/none/text.c b/src/graphics/none/text.c new file mode 100644 index 0000000..46efeea --- /dev/null +++ b/src/graphics/none/text.c @@ -0,0 +1,26 @@ +#ifdef ARC_NONE_GRAPHICS + +#include "arc/graphics/text.h" +#include + +void ARC_Text_Create(ARC_Text **text, ARC_String *path, int32_t size, ARC_Color color){ + printf("No Graphics Backend Selected\n"); +} + +void ARC_Text_Destroy(ARC_Text *font){ + printf("No Graphics Backend Selected\n"); +} + +void ARC_Text_SetString(ARC_Text *text, ARC_Renderer *renderer, ARC_String *string){ + printf("No Graphics Backend Selected\n"); +} + +void ARC_Text_Render(ARC_Text *text, ARC_Renderer *renderer){ + printf("No Graphics Backend Selected\n"); +} + +void ARC_Text_SetPos(ARC_Text *text, ARC_Point pos){ + printf("No Graphics Backend Selected\n"); +} + +#endif // !ARC_NONE_GRAPHICS \ No newline at end of file diff --git a/src/graphics/none/window.c b/src/graphics/none/window.c new file mode 100644 index 0000000..1413c8a --- /dev/null +++ b/src/graphics/none/window.c @@ -0,0 +1,14 @@ +#ifdef ARC_NONE_WINDOW + +#include "arc/graphics/window.h" +#include + +void ARC_Window_Create(ARC_Window **window, ARC_WindowInfo *info){ + printf("No Window Backend Selected\n"); +} + +void ARC_Window_Destroy(ARC_Window *window){ + printf("No Window Backend Selected\n"); +} + +#endif // !ARC_NONE_WINDOW \ No newline at end of file diff --git a/src/input/none/keyboard.c b/src/input/none/keyboard.c new file mode 100644 index 0000000..262f4a8 --- /dev/null +++ b/src/input/none/keyboard.c @@ -0,0 +1,23 @@ +#ifdef ARC_NONE_INPUT + +#include "arc/input/keyboard.h" +#include + +void ARC_Keyboard_Create(ARC_Keyboard **keyboard, ARC_KeyboardInfo *info){ + printf("No Input Backend Selected\n"); +} + +void ARC_Keyboard_Destroy(ARC_Keyboard *keyboard){ + printf("No Input Backend Selected\n"); +} + +void ARC_Keyboard_Update(ARC_Keyboard *keyboard){ + printf("No Input Backend Selected\n"); +} + +ARC_KeyboardState ARC_Keyboard_GetState(ARC_Keyboard *keyboard, enum ARC_KeyboardKey key){ + printf("No Input Backend Selected\n"); + return ARC_KEY_NONE; +} + +#endif // !ARC_NONE_INPUT \ No newline at end of file diff --git a/src/input/none/mouse.c b/src/input/none/mouse.c new file mode 100644 index 0000000..5bf6e4f --- /dev/null +++ b/src/input/none/mouse.c @@ -0,0 +1,37 @@ +#ifdef ARC_NONE_INPUT + +#include "arc/input/mouse.h" +#include + +void ARC_Mouse_Create(ARC_Mouse **mouse, ARC_MouseInfo *info){ + printf("No Input Backend Selected\n"); +} + +void ARC_Mouse_Destroy(ARC_Mouse *mouse){ + printf("No Input Backend Selected\n"); +} + +void ARC_Mouse_UpdateButton(ARC_Mouse *mouse, uint8_t button, uint32_t *buttons, uint32_t mask){ + printf("No Input Backend Selected\n"); +} + +void ARC_Mouse_Update(ARC_Mouse *mouse){ + printf("No Input Backend Selected\n"); +} + +ARC_Point *ARC_Mouse_GetCoords(ARC_Mouse *mouse){ + printf("No Input Backend Selected\n"); + return NULL; +} + +ARC_MouseState ARC_Mouse_GetState(ARC_Mouse *mouse, ARC_MouseButton button){ + printf("No Input Backend Selected\n"); + return ARC_MOUSE_NONE; +} + +int32_t *ARC_Mouse_GetScrollY(ARC_Mouse *mouse){ + printf("No Input Backend Selected\n"); + return NULL; +} + +#endif // !ARC_INPUT_NONE \ No newline at end of file diff --git a/src/std/errno.c b/src/std/errno.c new file mode 100644 index 0000000..f6748b2 --- /dev/null +++ b/src/std/errno.c @@ -0,0 +1,3 @@ +#include "arc/std/errno.h" + +int32_t arc_errno = 0; \ No newline at end of file