23 lines
814 B
C++
23 lines
814 B
C++
#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);
|
|
}
|
|
|
|
inline float GetRotation(Vec2Df start, Vec2Df end){
|
|
return Vector2Angle((Vector2){1,0}, (end - start)) * RAD2DEG;
|
|
}
|
|
}
|