Better centered text. Pass by reference for midi variable is not going to work with json serialization.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include "vmath.h"
|
||||
#include <raymath.h>
|
||||
#include <string>
|
||||
|
||||
namespace VISEQ::HELPER{
|
||||
inline void DrawSuperText(std::string text, Vec2Df start, Vec2Df end, float pos, float dist, float size, Color col){
|
||||
float d = start.dist(end);
|
||||
Vector2 text_length = MeasureTextEx(GetFontDefault(), text.c_str(), size, 2.0f);
|
||||
|
||||
Vec2Df middle_handle = start + (end - start) * ((d - text_length.x)*pos)/d;
|
||||
Vec2Df text_position = middle_handle + (start - end).norm().orth() * dist;
|
||||
|
||||
float rotation = Vector2Angle((Vector2){1,0}, (end - start)) * RAD2DEG;
|
||||
DrawTextPro(GetFontDefault(), text.c_str(), text_position, (Vector2){0,0}, rotation, size, 2.0f, col);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user