mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-09 17:52:08 -10:00
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.
40 lines
896 B
C++
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
|