Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
e0b0ee11d0
1
.gitignore
vendored
1
.gitignore
vendored
@ -10,6 +10,5 @@ CmakeCache.txt
|
|||||||
|
|
||||||
|
|
||||||
bin/
|
bin/
|
||||||
lib/
|
|
||||||
include/
|
include/
|
||||||
build/
|
build/
|
@ -8,6 +8,12 @@ if ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
|
|||||||
endif()
|
endif()
|
||||||
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "bin" "doc" "CMakeFiles" "lib" "include")
|
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "bin" "doc" "CMakeFiles" "lib" "include")
|
||||||
|
|
||||||
|
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
||||||
|
#set(CMAKE_CXX_COMPILER "clang++")
|
||||||
|
|
||||||
|
#set(CMAKE_C_COMPILER "/usr/bin/clang")
|
||||||
|
#set(CMAKE_CXX_COMPILER "/usr/bin/clang++")
|
||||||
|
|
||||||
project(Shared_Memory)
|
project(Shared_Memory)
|
||||||
set(CMAKE_CXX_STANDARD 14)
|
set(CMAKE_CXX_STANDARD 14)
|
||||||
|
|
||||||
@ -32,3 +38,6 @@ target_link_libraries(UnitTests Catch2::Catch2)
|
|||||||
include(CTest)
|
include(CTest)
|
||||||
include(Catch)
|
include(Catch)
|
||||||
catch_discover_tests(UnitTests)
|
catch_discover_tests(UnitTests)
|
||||||
|
|
||||||
|
#toml
|
||||||
|
include_directories(lib/toml)
|
||||||
|
3668
lib/toml/cpptoml.h
Normal file
3668
lib/toml/cpptoml.h
Normal file
File diff suppressed because it is too large
Load Diff
15
res/config.toml
Normal file
15
res/config.toml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#defaultKey = 12345
|
||||||
|
newKey = 0
|
||||||
|
layoutVersion = 0
|
||||||
|
width = 0
|
||||||
|
height = 0
|
||||||
|
mode = 0
|
||||||
|
redrawInterval = 0
|
||||||
|
timerInterruptInterval = 0
|
||||||
|
backgroundColor = 0
|
||||||
|
foregroundColor = 0
|
||||||
|
charactersPerRow = 0
|
||||||
|
charactersPerColumn = 0
|
||||||
|
font = 0
|
||||||
|
mousePositionX = 0
|
||||||
|
mousePositionY = 0
|
@ -2,6 +2,11 @@
|
|||||||
#include "SharedMemory.h"
|
#include "SharedMemory.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <cpptoml.h>
|
||||||
|
#include <vkvm.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
key_t changedKey()
|
key_t changedKey()
|
||||||
{
|
{
|
||||||
@ -15,6 +20,10 @@ key_t changedKey()
|
|||||||
std::cout <<"New Key is -> " << newKey << std::endl;
|
std::cout <<"New Key is -> " << newKey << std::endl;
|
||||||
keyFile << newKey;
|
keyFile << newKey;
|
||||||
keyFile.close();
|
keyFile.close();
|
||||||
|
|
||||||
|
auto config = cpptoml::parse_file(configFile);
|
||||||
|
newKey = config->get_as<int>("newKey").value_or(0); //toml
|
||||||
|
|
||||||
return key_t(newKey);
|
return key_t(newKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,3 +92,40 @@ void deleteSharedMemory(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void getConfig(){
|
||||||
|
auto config = cpptoml::parse_file(configFile);
|
||||||
|
|
||||||
|
int layoutVersion = config->get_as<int>("layoutVersion").value_or(0);
|
||||||
|
int width = config->get_as<int>("width").value_or(0);
|
||||||
|
int height = config->get_as<int>("height").value_or(0);
|
||||||
|
int mode = config->get_as<int>("mode").value_or(0);
|
||||||
|
int timerInterruptInterval = config->get_as<int>("timerInterruptInterval").value_or(0);
|
||||||
|
int backgroundColor = config->get_as<int>("backgroundColor").value_or(0);
|
||||||
|
int foregroundColor = config->get_as<int>("foregroundColor").value_or(0);
|
||||||
|
int charactersPerRow = config->get_as<int>("charactersPerRow").value_or(0);
|
||||||
|
int charactersPerColumn = config->get_as<int>("charactersPerColumn").value_or(0);
|
||||||
|
int font = config->get_as<int>("font").value_or(0);
|
||||||
|
int mousePositionX = config->get_as<int>("mousePositionX").value_or(0);
|
||||||
|
int mousePositionY = config->get_as<int>("mousePositionY").value_or(0);
|
||||||
|
|
||||||
|
/*
|
||||||
|
//convert to hex
|
||||||
|
std::string result;
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << std::hex << result;
|
||||||
|
ss >> result;
|
||||||
|
*/
|
||||||
|
|
||||||
|
vkvm::setLayoutVersion((vkvm::LayoutVersion) layoutVersion);
|
||||||
|
vkvm::setWidth(width);
|
||||||
|
vkvm::setHeight(height);
|
||||||
|
vkvm::setMode((vkvm::GraphicMode) mode);
|
||||||
|
vkvm::setTimerInterruptInterval(timerInterruptInterval);
|
||||||
|
vkvm::setBackgroundColor(vkvm::Color(backgroundColor));
|
||||||
|
vkvm::setForegroundColor(vkvm::Color(foregroundColor));
|
||||||
|
vkvm::setCharactersPerRow(charactersPerRow);
|
||||||
|
vkvm::setCharactersPerColumn(charactersPerColumn);
|
||||||
|
vkvm::setFont(vkvm::FontType(font,"",0,0));
|
||||||
|
vkvm::setMousePosition(mousePositionX, mousePositionY);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -13,4 +13,6 @@ void deleteSharedMemory(void);
|
|||||||
void initSharedMemory(void);
|
void initSharedMemory(void);
|
||||||
key_t changedKey();
|
key_t changedKey();
|
||||||
std::string getAnswerFromUser();
|
std::string getAnswerFromUser();
|
||||||
|
//Config File
|
||||||
|
#define configFile "res/config.toml"
|
||||||
#endif //SHARED_MEMORY_H
|
#endif //SHARED_MEMORY_H
|
||||||
|
Loading…
Reference in New Issue
Block a user