Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic support without steam_api + NDEBUG small fix #2042

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
cmake_minimum_required (VERSION 2.6)
project(keeper)
option(ENABLE_STEAM "Enable Steam integration" ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# set default cxxflags
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++1y -Wno-sign-compare -Wno-unused-variable -Wno-shift-count-overflow -ftemplate-depth=512 -DUSE_STEAMWORKS -I /home/michal/keeperrl/extern/steamworks/public")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++1y -Wno-sign-compare -Wno-unused-variable -Wno-shift-count-overflow -ftemplate-depth=512")
# clang specific cflags
if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-tautological-constant-out-of-range-compare -Wno-mismatched-tags")
Expand All @@ -14,8 +15,13 @@ set(STDAFX_H_GCH "${CMAKE_CURRENT_BINARY_DIR}/stdagx.h.gch")
# set debug cxxflags
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wimplicit-fallthrough -Wno-unused-function")
#if ((${CMAKE_BUILD_TYPE} MATCHES "Debug") AND (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang"))
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=lld -L ${CMAKE_CURRENT_SOURCE_DIR}/extern/steamworks/redistributable_bin/linux64/ -L /usr/local/lib -lsteam_api -Wl,-rpath=. -Wl,--gdb-index")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=lld -L /usr/local/lib -Wl,-rpath=. -Wl,--gdb-index")
#endif()
if(ENABLE_STEAM)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_STEAMWORKS -I ${CMAKE_CURRENT_SOURCE_DIR}/extern/steamworks/public")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L ${CMAKE_CURRENT_SOURCE_DIR}/extern/steamworks/redistributable_bin/linux64/ -lsteam_api")
endif()


# additional cmake modules directory
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
Expand Down Expand Up @@ -67,6 +73,9 @@ add_custom_command(

# rules to create `keeper` binary
file(GLOB SOURCES "*.cpp" "extern/*.cpp")
if(NOT ENABLE_STEAM)
list(FILTER SOURCES EXCLUDE REGEX ".*steam_.*\\.cpp$")
endif()
add_executable(keeper ${SOURCES} ${KEEPER_VERSION_H} ${CHECK_SERIAL_STAMP})
target_include_directories(keeper PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(keeper PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/extern)
Expand Down
2 changes: 2 additions & 0 deletions fx_particle_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ void defaultEmitParticle(AnimationContext &ctx, EmissionState &em, Particle &new
}

array<FVec2, 4> DrawContext::quadCorners(FVec2 pos, FVec2 size, float rotation) const {
#ifndef NDEBUG
PASSERT(size.x >= 0 && size.y >= 0) << size.x << " " << size.y;
#endif
auto corners = FRect(pos - size * 0.5f, pos + size * 0.5f).corners();
if (rotation != 0.0f) {
auto sc = sincos(rotation);
Expand Down
2 changes: 1 addition & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,8 @@ static int keeperMain(po::parser& commandLineFlags) {
#else
AppConfig appConfig(dataPath.file("appconfig-dev.txt"));
#endif
steamInput = make_unique<MySteamInput>();
#ifdef USE_STEAMWORKS
steamInput = make_unique<MySteamInput>();
optional<steam::Client> steamClient;
if (appConfig.get<int>("steamworks") > 0) {
if (steam::initAPI()) {
Expand Down
45 changes: 45 additions & 0 deletions steamless_input.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#ifndef USE_STEAMWORKS
#include "steam_input.h"

void MySteamInput::init() {
}

void MySteamInput::detectControllers() {
}

bool MySteamInput::isPressed(ControllerKey key) {
return false;
}

optional<FilePath> MySteamInput::getGlyph(ControllerKey key) {
return none;
}

void MySteamInput::runFrame() {
}

pair<double, double> MySteamInput::getJoyPos(ControllerJoy j) {
return {0, 0};
}

void MySteamInput::setGameActionLayer(GameActionLayer layer) {
}

optional<ControllerKey> MySteamInput::getEvent() {
return none;
}

void MySteamInput::showBindingScreen() {
}

bool MySteamInput::isRunningOnDeck() {
return false;
}

void MySteamInput::showFloatingKeyboard(Rectangle field) {
}

void MySteamInput::dismissFloatingKeyboard() {
}

#endif // USE_STEAMWORKS