UI
This commit is contained in:
43
archive/ui/UISprite.cpp
Normal file
43
archive/ui/UISprite.cpp
Normal file
@ -0,0 +1,43 @@
|
||||
// Copyright (c) 2022 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#include "UISprite.hpp"
|
||||
#include "game/DawnGame.hpp"
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
UISprite::UISprite(UICanvas *canvas) : UIComponent(canvas) {
|
||||
this->mesh.createBuffers(QUAD_VERTICE_COUNT, QUAD_INDICE_COUNT);
|
||||
}
|
||||
|
||||
void UISprite::updatePositions() {
|
||||
UIComponent::updatePositions();
|
||||
|
||||
QuadMesh::bufferQuadMesh(
|
||||
&this->mesh,
|
||||
glm::vec2(0, 0), glm::vec2(0, 0),
|
||||
glm::vec2(this->width, this->height), glm::vec2(1, 1),
|
||||
0, 0
|
||||
);
|
||||
}
|
||||
|
||||
std::vector<struct ShaderPassItem> UISprite::getSelfPassItems(
|
||||
glm::mat4 projection,
|
||||
glm::mat4 view,
|
||||
glm::mat4 transform
|
||||
) {
|
||||
std::vector<struct ShaderPassItem> items;
|
||||
|
||||
items.push_back(this->getGame()->renderManager.uiShaderProgram.getUIPassItem(
|
||||
projection,
|
||||
view,
|
||||
transform,
|
||||
this->texture,
|
||||
this->color,
|
||||
&this->mesh,
|
||||
this->z
|
||||
));
|
||||
return items;
|
||||
}
|
Reference in New Issue
Block a user