huge core redesign

This commit is contained in:
herbglitch 2024-01-12 19:48:17 -07:00
parent 85d0bad350
commit c614c679a9
23 changed files with 457 additions and 0 deletions

41
cmake/archeus_none.cmake Normal file
View file

@ -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()

View file

64
cmake/archeus_sdl2.cmake Normal file
View file

@ -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()