Skip to content

Instantly share code, notes, and snippets.

@victorholt
Created May 31, 2016 23:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save victorholt/6f5ae49a800ba06c1aac70c160ffc155 to your computer and use it in GitHub Desktop.
Save victorholt/6f5ae49a800ba06c1aac70c160ffc155 to your computer and use it in GitHub Desktop.
CurvedText3D.h
#pragma once
#include <Urho3D/Graphics/Drawable.h>
#include <Urho3D/Graphics/VertexBuffer.h>
#include <Urho3D/Math/Matrix3x4.h>
#include <Urho3D/UI/Text.h>
#include <Urho3D/UI/Text3D.h>
#include "../../Utils/LineTool.h"
using namespace CorFramework;
namespace Urho3D
{
/// 3D text component.
class URHO3D_API CurvedText3D : public Text3D
{
URHO3D_OBJECT(CurvedText3D, Text3D);
public:
/// Construct.
CurvedText3D(Context* context);
/// Destruct.
~CurvedText3D();
/// Register object factory. Drawable must be registered first.
static void RegisterObject(Context* context);
/// Apply attribute changes that can not be applied immediately.
virtual void ApplyAttributes();
/// Visualize the component as debug geometry.
virtual void DrawDebugGeometry(DebugRenderer* debug, bool depthTest);
/// Apply the curve to the text given the start/end location.
void ApplyCurve(Vector3 curveStart, Vector3 curveEnd, float curveAmount, float maxCurveHeight);
/// Sets the font point size.
inline void SetFontPointSize(float fontPointSize) { fontPointSize_ = fontPointSize; }
/// Set the max font size.
inline void SetMaxFontPointSize(float maxFontPointSize) { maxFontPointSize_ = maxFontPointSize; }
/// Set the min font size.
inline void SetMinFontPointSize(float minFontPointSize) { minFontPointSize_ = minFontPointSize; }
/// Returns the font point size.
inline float GetFontPointSize() const { return fontPointSize_; }
/// Returns the max font point size.
inline float GetMaxFontPointSize() const { return maxFontPointSize_; }
/// Returns the min font point size.
inline float GetMinFontPointSize() const { return minFontPointSize_; }
protected:
/// The current font size.
float fontPointSize_;
/// The max font point size.
float maxFontPointSize_;
/// The min font point size.
float minFontPointSize_;
/// CorFramework line tool.
LineTool* lineTool_;
/// Flag to hide/show the line tool.
bool useLineTool_;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment