Fixes for Linux builds and cmake compiling!

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

@ -91,6 +91,15 @@ std::vector<std::unique_ptr<Bullet>>BULLET_LIST;
safemap<std::string,Renderable>GFX;
utils::datafile DATA;
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_RIGHT;
InputGroup AiL::KEY_UP;

@ -57,7 +57,7 @@ void DamageNumber::RecalculateSize(){
float damageMultRatio=damage/game->GetPlayer()->GetBaseStat("Attack")/2.f;
riseSpd=originalRiseSpd;
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;

@ -8,7 +8,9 @@ cmake_minimum_required(VERSION 3.10)
#
project("Adventures in Lestoria")
if (EMSCRIPTEN)
add_compile_options("-s" "USE_FREETYPE=1")
endif()
add_compile_options("-O2")
# Options you can set via command-line
@ -84,6 +86,12 @@ file(
GLOB SOURCE_CXX_FILES
"${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.
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)
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
if(USE_ALSA)
@ -277,6 +292,11 @@ if(UNIX AND NOT APPLE AND NOT EMSCRIPTEN)
# stdc++fs
target_link_libraries(${OutputExecutable} stdc++fs)
target_link_options(
${OutputExecutable}
PRIVATE
-g
"Adventures in Lestoria/discord_game_sdk.so")
endif() # Linux
@ -284,7 +304,6 @@ endif() # Linux
# Emscripten
######################################################################
if (EMSCRIPTEN)
# Generate an HTML file
set(CMAKE_EXECUTABLE_SUFFIX .html)

Loading…
Cancel
Save