Merge branch 'master' of https://git.epicsparrow.com/epicsparrow/sparrowinput
This commit is contained in:
commit
da406827b1
@ -1,53 +1,15 @@
|
||||
project(SparrowInput)
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
if(WIN32)
|
||||
set(SYSTEM_LIB_PATH "win32")
|
||||
else(WIN32)
|
||||
set(SYSTEM_LIB_PATH "linux")
|
||||
endif(WIN32)
|
||||
# choose source file
|
||||
file(GLOB LIB_SRC_LIST src/*.cpp)
|
||||
file(GLOB LIB_HEAD_LIST src/*.h)
|
||||
list(REMOVE_ITEM LIB_SRC_LIST src/main.cpp)
|
||||
set(EXEC_SRC_LIST src/main.cpp)
|
||||
|
||||
set(LIB_SRC_LIST input.cpp keybindings.cpp textbuffer.cpp)
|
||||
#set compilation option
|
||||
set(IS_LIBRARY True)
|
||||
set(USE_OPENGL True)
|
||||
set(USE_SFML True)
|
||||
|
||||
set(EXECUTABLE_NAME "test${PROJECT_NAME}")
|
||||
set(LIBRARY_NAME ${PROJECT_NAME})
|
||||
|
||||
set(DEPENDENCIES_ROOT ${PROJECT_SOURCE_DIR}/../cpp_dependencies)
|
||||
set(INCLUDE_ROOT ${DEPENDENCIES_ROOT}/include)
|
||||
set(LIB_ROOT ${DEPENDENCIES_ROOT}/lib/${SYSTEM_LIB_PATH})
|
||||
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIB_ROOT}) #for SHARED
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIB_ROOT}) #for STATIC
|
||||
|
||||
add_library(${LIBRARY_NAME} STATIC ${LIB_SRC_LIST})
|
||||
add_executable(${EXECUTABLE_NAME} main.cpp)
|
||||
add_definitions(-std=c++11)
|
||||
|
||||
include_directories(
|
||||
${INCLUDE_ROOT}
|
||||
)
|
||||
|
||||
find_library(SFML_LIBRARY_WINDOW
|
||||
NAMES
|
||||
sfml-window
|
||||
PATHS
|
||||
${LIB_ROOT}
|
||||
)
|
||||
|
||||
find_library(SFML_LIBRARY_SYSTEM
|
||||
NAMES
|
||||
sfml-system
|
||||
PATHS
|
||||
${LIB_ROOT}
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
${LIBRARY_NAME}
|
||||
${SFML_LIBRARY_WINDOW}
|
||||
${SFML_LIBRARY_SYSTEM}
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
${EXECUTABLE_NAME}
|
||||
${LIBRARY_NAME}
|
||||
)
|
||||
include(../cmaketemplate/template.cmake)
|
||||
|
@ -54,6 +54,31 @@ KeyBindings::KeyBindings(const Context &context, const IKeysMap &keysmap)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int KeyBindings::getPressedAction(int key) const
|
||||
{
|
||||
return bindings_pressed.count(key) == 1? bindings_pressed.at(key) : -1;
|
||||
@ -67,6 +92,8 @@ int KeyBindings::getHoldAction(int key) const
|
||||
return bindings_hold.count(key) == 1? bindings_hold.at(key) : -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void KeyBindings::setPressedAction(int key, int action)
|
||||
{
|
||||
bindings_pressed[key]=action;
|
||||
@ -81,6 +108,7 @@ void KeyBindings::setHoldAction(int key, int action)
|
||||
bindings_hold[key]=action;
|
||||
}
|
||||
|
||||
|
||||
/* Implementation of Context class
|
||||
* @author: Thomas Brandého
|
||||
* @info: This class contains a list of actions available in a given situation (context).
|
||||
@ -99,3 +127,4 @@ std::vector<int> Context::getActions() const
|
||||
{
|
||||
return actions;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user