16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 20:59:19 +02:00

merge, with tmj renderer

This commit is contained in:
milek7
2017-08-18 00:56:05 +02:00
85 changed files with 6815 additions and 3770 deletions

View File

@@ -24,8 +24,8 @@ struct ui_panel {
{}
std::vector<text_line> text_lines;
float origin_x;
float origin_y;
int origin_x;
int origin_y;
};
class ui_layer {
@@ -41,15 +41,23 @@ public:
// methods:
bool
init( GLFWwindow *Window );
void
set_unit( GLint const Textureunit ) { m_textureunit = Textureunit; }
// draws requested UI elements
void
render();
// stores operation progress
void
set_progress( float const Progress = 0.0f, float const Subtaskprogress = 0.0f );
void
set_progress( std::string const &Text ) { m_progresstext = Text; }
// sets the ui background texture, if any
void
set_background( std::string const &Filename = "" );
void
set_texture( GLuint Texture = 0 ) { m_texture = Texture; }
void
set_tooltip( std::string const &Tooltip ) { m_tooltip = Tooltip; }
void
clear_texts() { m_panels.clear(); }
void
@@ -62,11 +70,15 @@ private:
// draws background quad with specified earlier texture
void
render_background();
void
render_texture();
// draws a progress bar in defined earlier state
void
render_progress();
void
render_panels();
void
render_tooltip();
// prints specified text, using display lists font
void
print( std::string const &Text );
@@ -76,11 +88,20 @@ private:
// members:
GLuint m_fontbase{ (GLuint)-1 }; // numer DL dla znaków w napisach
float m_progress{ 0.0f }; // percentage of filled progres bar, to indicate lengthy operations.
float m_subtaskprogress{ 0.0f }; // percentage of filled progres bar, to indicate lengthy operations.
texture_handle m_background; // path to texture used as the background. size depends on mAspect.
GLFWwindow *m_window { nullptr };
GLint m_textureunit{ GL_TEXTURE0 };
GLuint m_fontbase { (GLuint)-1 }; // numer DL dla znaków w napisach
// progress bar config. TODO: put these together into an object
float m_progress { 0.0f }; // percentage of filled progres bar, to indicate lengthy operations.
float m_subtaskprogress{ 0.0f }; // percentage of filled progres bar, to indicate lengthy operations.
std::string m_progresstext; // label placed over the progress bar
bool m_progressbottom { false }; // location of the progress bar
texture_handle m_background { null_handle }; // path to texture used as the background. size depends on mAspect.
GLuint m_texture { 0 };
std::vector<std::shared_ptr<ui_panel> > m_panels;
std::string m_tooltip;
};
extern ui_layer UILayer;