Basic animations
This commit is contained in:
@ -96,6 +96,14 @@ float_t UIComponent::getHeight() {
|
||||
return this->height;
|
||||
}
|
||||
|
||||
float_t UIComponent::getContentWidth() {
|
||||
return this->width;
|
||||
}
|
||||
|
||||
float_t UIComponent::getContentHeight() {
|
||||
return this->height;
|
||||
}
|
||||
|
||||
float_t UIComponent::getRelativeX() {
|
||||
return this->relativeX;
|
||||
}
|
||||
@ -104,6 +112,14 @@ float_t UIComponent::getRelativeY() {
|
||||
return this->relativeY;
|
||||
}
|
||||
|
||||
DawnGame * UIComponent::getGame() {
|
||||
return this->canvas->getGame();
|
||||
}
|
||||
|
||||
Scene * UIComponent::getScene() {
|
||||
return this->canvas->getScene();
|
||||
}
|
||||
|
||||
void UIComponent::setTransform(
|
||||
UIComponentAlign xAlign,
|
||||
UIComponentAlign yAlign,
|
||||
|
@ -68,14 +68,30 @@ namespace Dawn {
|
||||
*
|
||||
* @return Width of the component.
|
||||
*/
|
||||
float_t getWidth();
|
||||
virtual float_t getWidth();
|
||||
|
||||
/**
|
||||
* Returns the calculated height, based on the internal alignment values.
|
||||
*
|
||||
* @return Height of the component.
|
||||
*/
|
||||
float_t getHeight();
|
||||
virtual float_t getHeight();
|
||||
|
||||
/**
|
||||
* Returns the internal width of the content within this element, e.g.
|
||||
* the content width.
|
||||
*
|
||||
* @return Content width.
|
||||
*/
|
||||
virtual float_t getContentWidth();
|
||||
|
||||
/**
|
||||
* Returns the internal height of the content within this element, e.g.
|
||||
* the content height.
|
||||
*
|
||||
* @return Content height.
|
||||
*/
|
||||
virtual float_t getContentHeight();
|
||||
|
||||
/**
|
||||
* Returns the X position, relative to this components' parent.
|
||||
@ -91,6 +107,20 @@ namespace Dawn {
|
||||
*/
|
||||
float_t getRelativeY();
|
||||
|
||||
/**
|
||||
* Gets the game that this UI component belongs to.
|
||||
*
|
||||
* @return Game instance.
|
||||
*/
|
||||
DawnGame * getGame();
|
||||
|
||||
/**
|
||||
* Gets the scene that thsi UI Component belongs to.
|
||||
*
|
||||
* @return Scene instance.
|
||||
*/
|
||||
Scene * getScene();
|
||||
|
||||
/**
|
||||
* Updates the transformation for this component.
|
||||
*
|
||||
|
@ -21,7 +21,7 @@ void UILabel::updateMesh() {
|
||||
if(this->font == nullptr || !this->font->isReady()) return;
|
||||
if(this->text.size() == 0) return;
|
||||
|
||||
float_t width = this->getWidth();
|
||||
float_t width = this->width;
|
||||
if(width == 0) width = -1;
|
||||
|
||||
this->font->buffer(
|
||||
@ -54,6 +54,16 @@ void UILabel::setFontSize(float_t fontSize) {
|
||||
this->needsRebuffering = true;
|
||||
}
|
||||
|
||||
float_t UILabel::getContentWidth() {
|
||||
this->updateMesh();
|
||||
return this->measure.getWidth();
|
||||
}
|
||||
|
||||
float_t UILabel::getContentHeight() {
|
||||
this->updateMesh();
|
||||
return this->measure.getHeight();
|
||||
}
|
||||
|
||||
void UILabel::drawSelf(UIShader *shader, glm::mat4 selfTransform) {
|
||||
if(this->font == nullptr || this->text.size() == 0) return;
|
||||
|
||||
|
@ -29,6 +29,8 @@ namespace Dawn {
|
||||
|
||||
UILabel(UICanvas *canvas);
|
||||
void drawSelf(UIShader *shader, glm::mat4 selfTransform) override;
|
||||
virtual float_t getContentWidth() override;
|
||||
virtual float_t getContentHeight() override;
|
||||
void setTransform(
|
||||
UIComponentAlign xAlign,
|
||||
UIComponentAlign yAlign,
|
||||
|
Reference in New Issue
Block a user