build 190701. basic radio call event launch support

This commit is contained in:
tmj-fstate
2019-07-02 01:37:05 +02:00
parent 0f0c30dbff
commit 06b7f009cc
14 changed files with 135 additions and 33 deletions

View File

@@ -56,12 +56,25 @@ bool TEventLauncher::Load(cParser *parser)
dRadius *= dRadius; // do kwadratu, pod warunkiem, że nie jest ujemne
parser->getTokens(); // klawisz sterujący
*parser >> token;
if (token != "none")
{
if( token.size() == 1 )
if (token != "none") {
if( token.size() == 1 ) {
// single char, assigned activation key
iKey = vk_to_glfw_key( token[ 0 ] );
else
iKey = vk_to_glfw_key(stol_def( token, 0 )); // a jak więcej, to jakby numer klawisza jest
}
else {
// this launcher may be activated by radio message
std::map<std::string, int> messages {
{ "radio_call1", radio_message::call1 },
{ "radio_call3", radio_message::call3 }
};
auto lookup = messages.find( token );
iKey = (
lookup != messages.end() ?
lookup->second :
// a jak więcej, to jakby numer klawisza jest
vk_to_glfw_key( stol_def( token, 0 ) ) );
}
}
parser->getTokens();
*parser >> DeltaTime;
@@ -139,7 +152,7 @@ bool TEventLauncher::check_activation() {
auto bCond { false };
if( iKey != 0 ) {
if( iKey > 0 ) {
if( iKey > 255 ) {
// key and modifier
auto const modifier = ( iKey & 0xff00 ) >> 8;
@@ -203,6 +216,11 @@ bool TEventLauncher::IsGlobal() const {
&& ( dRadius < 0.0 ) ); // bez ograniczenia zasięgu
}
bool TEventLauncher::IsRadioActivated() const {
return ( iKey < 0 );
}
// radius() subclass details, calculates node's bounding radius
float
TEventLauncher::radius_() {