mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
build 190701. basic radio call event launch support
This commit is contained in:
30
EvLaunch.cpp
30
EvLaunch.cpp
@@ -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_() {
|
||||
|
||||
Reference in New Issue
Block a user