Enabling MessageQueue for Scripting (#4201)

As @Benau suggested to use MessageQueue for *making the Game Flow of the Tutorial smoother* (#4187), this Pull Request enable MessageQueue for Track-Scripts.

For me it works well with MessageQueue, however i think we could make the Font of a Message a little bit bigger, since it is quite small, especially on mobile.
This commit is contained in:
CodedOre 2020-01-05 18:11:46 +01:00 committed by Benau
parent ea948fd5d5
commit 4ce88158c8

View File

@ -30,6 +30,7 @@
#include "tracks/track_object_manager.hpp"
#include "utils/string_utils.hpp"
#include "utils/translation.hpp"
#include "guiengine/message_queue.hpp"
#include <angelscript.h>
#include "scriptarray.hpp"
@ -76,6 +77,22 @@ namespace Scripting
new TutorialMessageDialog((out), true);
}
/** Display a Message using MessageQueue */
void displayGenericMessage(std::string* input)
{
irr::core::stringw msg = StringUtils::utf8ToWide(*input);
MessageQueue::MessageType type = MessageQueue::MT_GENERIC;
MessageQueue::add(type, msg);
}
/** Display a Error Message using MessageQueue */
void displayErrorMessage(std::string* input)
{
irr::core::stringw msg = StringUtils::utf8ToWide(*input);
MessageQueue::MessageType type = MessageQueue::MT_ERROR;
MessageQueue::add(type, msg);
}
void clearOverlayMessages()
{
World::getWorld()->getRaceGUI()->clearAllMessages();
@ -192,8 +209,16 @@ namespace Scripting
asDWORD call_conv = mp ? asCALL_GENERIC : asCALL_CDECL;
int r; // of type asERetCodes
r = engine->RegisterGlobalFunction("void displayModalMessage(const string &in)",
mp ? WRAP_FN(displayModalMessage) : asFUNCTION(displayModalMessage),
r = engine->RegisterGlobalFunction("void displayGenericMessage(const string &in)",
mp ? WRAP_FN(displayGenericMessage) : asFUNCTION(displayGenericMessage),
call_conv); assert(r >= 0);
r = engine->RegisterGlobalFunction("void displayErrorMessage(const string &in)",
mp ? WRAP_FN(displayErrorMessage) : asFUNCTION(displayErrorMessage),
call_conv); assert(r >= 0);
r = engine->RegisterGlobalFunction("void displayModalMessage(const string &in)",
mp ? WRAP_FN(displayModalMessage) : asFUNCTION(displayModalMessage),
call_conv); assert(r >= 0);
r = engine->RegisterGlobalFunction("void displayOverlayMessage(const string &in)",