Dawn/archive/ui/UIBorder.hpp
2023-03-05 12:58:59 -08:00

54 lines
1.3 KiB
C++

// Copyright (c) 2022 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "UIComponent.hpp"
#include "display/mesh/QuadMesh.hpp"
#include "display/Texture.hpp"
namespace Dawn {
class UIBorder : public UIComponent {
private:
Mesh mesh;
glm::vec2 edgeDimensions = glm::vec2(8.0f, 8.0f);
glm::vec2 uv0 = glm::vec2(0.0f, 0.0f);
glm::vec2 uv1 = glm::vec2(1.0f, 1.0f);
void updatePositions() override;
std::vector<struct ShaderPassItem> getSelfPassItems(
glm::mat4 projection,
glm::mat4 view,
glm::mat4 transform
) override;
public:
Texture *texture = nullptr;
UIBorder(UICanvas *canvas);
/**
* Changes the dimensions of the border.
*
* @param borderSize Size of the border.
*/
void setBorderSize(glm::vec2 borderSize);
/**
* Returns the size of the border.
*
* @return Border size of this UI border.
*/
glm::vec2 getBorderSize();
/**
* Returns the size of the area within the border.
*
* @return The inner content area size.
*/
glm::vec2 getInnerSize();
~UIBorder();
};
}