Files
asarium f12a8ff432 Add scrolling text element for libRocket
This emulates the "scrolling text" effect that is present in briefings.
It is not exactly the same since it just goes pixel wise and not by
character but it looks good enough.
2020-08-10 09:38:30 +02:00

40 lines
896 B
C++

#pragma once
// Our Assert conflicts with the definitions inside libRocket
#pragma push_macro("Assert")
#undef Assert
#include <Rocket/Core/Element.h>
#include <Rocket/Core/Geometry.h>
#include <Rocket/Core/Texture.h>
#pragma pop_macro("Assert")
namespace scpui {
namespace elements {
using namespace Rocket::Core;
class ScrollingTextElement : public Rocket::Core::Element {
public:
ScrollingTextElement(const String& tag_in);
~ScrollingTextElement() override;
protected:
void OnAttributeChange(const AttributeNameList& changed_attributes) override;
void OnBeforeRender() override;
void OnAfterRender() override;
void OnChildAdd(Element* child) override;
void OnChildRemove(Element* child) override;
void OnUpdate() override;
float _duration = 1.5f;
float _animation_start_time = -1.0f;
bool _newAnimationStarted = false;
};
} // namespace elements
} // namespace scpui