summaryrefslogtreecommitdiff
path: root/engine-ocean/Game/Systems/UI/UITextures/uidisplay.h
blob: 4b739cc0bc492bb80ab3f65441666e48c4aa2b1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef UIDISPLAY_H
#define UIDISPLAY_H
#include "uitexture.h"
#include <set>



class UIDisplay : public UITexture
{
public:
    UIDisplay(TextureData tex, glm::vec2 pos, glm::vec2 scale, std::set<std::string>& shownScreens,
              AspectRatio ratio = FIT_SCREEN);
    ~UIDisplay();
    void draw() override;
    GLuint getTexID() override;
    glm::vec2 getPos() override;
    glm::vec2 getScale() override;

    void setWindowPos(int width, int height) override;
    glm::vec2 getWindowPos();

    int getHeight() override;
    int getWidth() override;
    Bounds2f getBounds() override;
    float getTextureRatio() override;
    float getTextureScaleAspect() override;
    void setPos(glm::vec2 pos);
    void setScale(glm::vec2 scale);

    AspectRatio getAspectRatio();


   // glm::vec2 getCornerPos(CornerPosition corner, glm::vec2 elementDimensions);
    void setTransformationMat(glm::vec2 translation, glm::vec2 scale);
    glm::mat4 getTransformationMat();

private:
    int getScreenHeight();
    int getScreenWidth();
    void setTexID(GLuint &newTexID);
    glm::mat4 getScaleMatrix(glm::vec2 scale);



    TextureData m_tex;
    glm::vec2 m_pos;
    glm::vec2 m_scale;
    Bounds2f m_bounds;
    glm::vec2 m_windowPos; // width, height
    int m_windowHeight = 480.f;
    int m_windowWidth = 640.f;
    float m_toScreenScale = 1.f;

    int m_screenImageHeight;
    int m_screenImageWidth;
    float m_tex_aspectRatio = 1.f;
    bool m_isCloseButton = false;
    std::string m_attachedWindow;

    std::set<std::string>& m_shownScreens;
    glm::mat4 m_transformationMat;
    float m_textureAspect = 1.f;

    AspectRatio m_aspectRatio;
};

#endif // UIDISPLAY_H