Fixes for Linux builds and cmake compiling!

pull/35/head
sigonasr2 10 months ago
parent b8da4fbbbe
commit 7af67b25b6
  1. 11
      Adventures in Lestoria/AdventuresInLestoria.cpp
  2. 2
      Adventures in Lestoria/DamageNumber.cpp
  3. 25
      CMakeLists.txt

@ -91,6 +91,15 @@ std::vector<std::unique_ptr<Bullet>>BULLET_LIST;
safemap<std::string,Renderable>GFX; safemap<std::string,Renderable>GFX;
utils::datafile DATA; utils::datafile DATA;
AiL*game; AiL*game;
#undef KEY_LEFT //Stupid Linux
#undef KEY_RIGHT //Stupid Linux
#undef KEY_UP //Stupid Linux
#undef KEY_DOWN //Stupid Linux
#undef KEY_MENU //Stupid Linux
#undef KEY_SCROLLUP //Stupid Linux
#undef KEY_SCROLLDOWN //Stupid Linux
#undef KEY_BACK //Stupid Linux
#undef KEY_SELECT //Stupid Linux
InputGroup AiL::KEY_LEFT; InputGroup AiL::KEY_LEFT;
InputGroup AiL::KEY_RIGHT; InputGroup AiL::KEY_RIGHT;
InputGroup AiL::KEY_UP; InputGroup AiL::KEY_UP;
@ -2925,4 +2934,4 @@ std::string operator ""_FS(const char*key,std::size_t len){
void AiL::DisableFadeIn(const bool disable){ void AiL::DisableFadeIn(const bool disable){
disableFadeIn=disable; disableFadeIn=disable;
} }

@ -57,7 +57,7 @@ void DamageNumber::RecalculateSize(){
float damageMultRatio=damage/game->GetPlayer()->GetBaseStat("Attack")/2.f; float damageMultRatio=damage/game->GetPlayer()->GetBaseStat("Attack")/2.f;
riseSpd=originalRiseSpd; riseSpd=originalRiseSpd;
if(!friendly){ if(!friendly){
float newSize=std::clamp(round(damageMultRatio),1.0f,4.0f); float newSize=std::clamp(roundf(damageMultRatio),1.0f,4.0f);
if(type==HEALTH_LOSS||type==CRIT)riseSpd*=newSize; if(type==HEALTH_LOSS||type==CRIT)riseSpd*=newSize;

@ -8,7 +8,9 @@ cmake_minimum_required(VERSION 3.10)
# #
project("Adventures in Lestoria") project("Adventures in Lestoria")
add_compile_options("-s" "USE_FREETYPE=1") if (EMSCRIPTEN)
add_compile_options("-s" "USE_FREETYPE=1")
endif()
add_compile_options("-O2") add_compile_options("-O2")
# Options you can set via command-line # Options you can set via command-line
@ -84,6 +86,12 @@ file(
GLOB SOURCE_CXX_FILES GLOB SOURCE_CXX_FILES
"${SOURCE_CXX_SRC_DIR}/*.cpp" "${SOURCE_CXX_SRC_DIR}/*.cpp"
) )
file(
GLOB SOURCE_CXX_FILES2
"${SOURCE_CXX_SRC_DIR}/discord-files/*.cpp"
)
list(APPEND SOURCE_CXX_FILES ${SOURCE_CXX_FILES2})
# Search in the "cmake" directory for additional CMake modules. # Search in the "cmake" directory for additional CMake modules.
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
@ -244,6 +252,13 @@ if(UNIX AND NOT APPLE AND NOT EMSCRIPTEN)
target_link_libraries(${OutputExecutable} Threads::Threads) target_link_libraries(${OutputExecutable} Threads::Threads)
include_directories(${Threads_INCLUDE_DIRS}) include_directories(${Threads_INCLUDE_DIRS})
find_package(Freetype REQUIRED)
target_link_libraries(${OutputExecutable} ${FREETYPE_LIBRARIES})
target_include_directories(${OutputExecutable} PRIVATE ${FREETYPE_INCLUDE_DIRS})
target_include_directories(${OutputExecutable} PRIVATE "${C_CXX_SOURCES_DIR}/discord-files")
link_directories("Adventures in Lestoria")
# TODO: sanity checks # TODO: sanity checks
if(USE_ALSA) if(USE_ALSA)
@ -276,7 +291,12 @@ if(UNIX AND NOT APPLE AND NOT EMSCRIPTEN)
include_directories(${PNG_INCLUDE_DIRS}) include_directories(${PNG_INCLUDE_DIRS})
# stdc++fs # stdc++fs
target_link_libraries(${OutputExecutable} stdc++fs) target_link_libraries(${OutputExecutable} stdc++fs)
target_link_options(
${OutputExecutable}
PRIVATE
-g
"Adventures in Lestoria/discord_game_sdk.so")
endif() # Linux endif() # Linux
@ -284,7 +304,6 @@ endif() # Linux
# Emscripten # Emscripten
###################################################################### ######################################################################
if (EMSCRIPTEN) if (EMSCRIPTEN)
# Generate an HTML file # Generate an HTML file
set(CMAKE_EXECUTABLE_SUFFIX .html) set(CMAKE_EXECUTABLE_SUFFIX .html)

Loading…
Cancel
Save