diff --git a/addons/interact_menu/functions/fnc_renderIcon.sqf b/addons/interact_menu/functions/fnc_renderIcon.sqf index b582738a81..f26e4a5ca8 100644 --- a/addons/interact_menu/functions/fnc_renderIcon.sqf +++ b/addons/interact_menu/functions/fnc_renderIcon.sqf @@ -35,7 +35,10 @@ GVAR(iconCount) = GVAR(iconCount) + 1; if(_icon == "") then { _icon = DEFAULT_ICON; }; + _text = format ["%4", _icon, _color, _color, _text]; +//_text = format ["
%4", _icon, _color, _color, "ace_breakLine" callExtension _text]; + _ctrl ctrlSetStructuredText (parseText _text); _ctrl ctrlSetPosition [(_sPos select 0)-(0.0095*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.10*SafeZoneW, 0.035*SafeZoneW]; //_ctrl ctrlSetBackgroundColor [0, 1, 0, 0.1]; diff --git a/addons/laser_selfdesignate/stringtable.xml b/addons/laser_selfdesignate/stringtable.xml index da8030cb69..c19dcb92ae 100644 --- a/addons/laser_selfdesignate/stringtable.xml +++ b/addons/laser_selfdesignate/stringtable.xml @@ -3,14 +3,14 @@ - Laser<br/>Designator On - Lasermarkierer<br/>an - Laser<br/>Designador encendido + Laser Designator On + Lasermarkierer an + Laser Designador encendido - Laser<br/>Designator Off - Lasermarkierer<br/>aus - Laser<br/>Designador apagado + Laser Designator Off + Lasermarkierer aus + Laser Designador apagado diff --git a/extensions/CMakeLists.txt b/extensions/CMakeLists.txt index f0e21e9207..f5e6034d28 100644 --- a/extensions/CMakeLists.txt +++ b/extensions/CMakeLists.txt @@ -27,5 +27,6 @@ include_directories(AFTER "common") # Add extensions to build here add_subdirectory(fcs) +add_subdirectory(breakline) message("Build Type: ${CMAKE_BUILD_TYPE}") \ No newline at end of file diff --git a/extensions/breakLine/CMakeLists.txt b/extensions/breakLine/CMakeLists.txt new file mode 100644 index 0000000000..8981ec487e --- /dev/null +++ b/extensions/breakLine/CMakeLists.txt @@ -0,0 +1,11 @@ +set(ACE_EXTENSION_NAME "ace_breakLine") + +file(GLOB SOURCES *.h *.hpp *.c *.cpp) +add_library( ${ACE_EXTENSION_NAME} SHARED ${SOURCES}) +add_dependencies(${ACE_EXTENSION_NAME} ace_common) +SET_TARGET_PROPERTIES(${ACE_EXTENSION_NAME} PROPERTIES PREFIX "") + +if(CMAKE_COMPILER_IS_GNUCXX) + set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES LINK_SEARCH_START_STATIC 1) + set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES LINK_SEARCH_END_STATIC 1) +endif() \ No newline at end of file diff --git a/extensions/breakLine/ace_breakLine.cpp b/extensions/breakLine/ace_breakLine.cpp new file mode 100644 index 0000000000..74a32cc66d --- /dev/null +++ b/extensions/breakLine/ace_breakLine.cpp @@ -0,0 +1,79 @@ +/* + * ace_breakLine.cpp + * + * Takes a string and insert as many line breaks as needed so it fits a given width + * + * Takes: + * Localized string as string + * Example: "Check weapon temperature" + * + * Returns: + * String with line breaks + */ + +#include "ace_common.h" + +#include +#include +#include + +#define MAXCHARACTERS 14 + +static char version[] = "1.0"; + +extern "C" { + __declspec (dllexport) void __stdcall RVExtension(char *output, int outputSize, const char *function); +}; + +std::vector splitString(std::string input) { + std::istringstream ss(input); + std::string token; + + std::vector output; + while (std::getline(ss, token, ' ')) { + output.push_back(token); + } + + return output; +} + +std::string addLineBreaks(const std::vector &words) { + + std::stringstream sstream; + int numChar = 0; + int i = 0; + while (i < words.size()) { + if (numChar == 0) { + sstream << words[i]; + numChar += words[i].size(); + i++; + } else { + if (numChar + 1 + words[i].size() > MAXCHARACTERS) { + sstream << "
"; + numChar = 0; + } else { + sstream << " " << words[i]; + numChar += 1 + words[i].size(); + i++; + } + } + } + return sstream.str(); +} + +// i like to live dangerously. jk, fix strncpy sometime pls. +#pragma warning( push ) +#pragma warning( disable : 4996 ) + +void __stdcall RVExtension(char *output, int outputSize, const char *function) { + //strncpy(output, function, outputSize); + + if (!strcmp(function, "version")) { + strncpy(output, version, outputSize); + } else { + strcpy(output, addLineBreaks(splitString(function)).c_str()); + output[outputSize - 1] = '\0'; + } +} + +#pragma warning( pop )