2D_Game_Engine
Loading...
Searching...
No Matches
textqueue.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <textrenderer.hpp>
4
5struct TextData{
7 std::string text;
8 float x;
9 float y;
10 float scale;
12 int layer;
13
14 TextData(TextRenderer *renderer,const std::string &text,float x,float y,float scale,Vec3 color,int layer):
16};
17
19 bool operator()(const TextData &a,const TextData &b){
20 return a.layer>b.layer;
21 }
22};
23
25public:
26 TextQueue()=default;
27
28 void Push(TextRenderer *renderer,const std::string &text,float x,float y,float scale,Vec3 color,int layer);
29
30 inline int GetQueueMinLayer(){
31 return m_TextQueue.empty()?std::numeric_limits<int>::max():(m_TextQueue.top().layer!=std::numeric_limits<int>::max()-1?m_TextQueue.top().layer:std::numeric_limits<int>::max());
32 }
36 void Render(int layer);
37
38private:
39 std::priority_queue<TextData,std::vector<TextData>,CompareTextData> m_TextQueue;
40};
void Render(int layer)
Definition textqueue.cpp:8
int GetQueueMinLayer()
Definition textqueue.hpp:30
TextQueue()=default
void Push(TextRenderer *renderer, const std::string &text, float x, float y, float scale, Vec3 color, int layer)
Definition textqueue.cpp:4
bool operator()(const TextData &a, const TextData &b)
Definition textqueue.hpp:19
TextData(TextRenderer *renderer, const std::string &text, float x, float y, float scale, Vec3 color, int layer)
Definition textqueue.hpp:14
Vec3 color
Definition textqueue.hpp:11
float x
Definition textqueue.hpp:8
std::string text
Definition textqueue.hpp:7
float y
Definition textqueue.hpp:9
TextRenderer * renderer
Definition textqueue.hpp:6
float scale
Definition textqueue.hpp:10