Working on removing ui label
This commit is contained in:
59
archive/UILabel.hpp
Normal file
59
archive/UILabel.hpp
Normal file
@ -0,0 +1,59 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "UIComponentRenderable.hpp"
|
||||
#include "display/font/Font.hpp"
|
||||
|
||||
#define UI_LABEL_MAX_WIDTH_NONE -1
|
||||
#define UI_LABEL_MAX_WIDTH_ALIGN 0
|
||||
|
||||
namespace Dawn {
|
||||
class UILabel : public UIComponentRenderable {
|
||||
private:
|
||||
bool_t needsRebuffering = true;
|
||||
Mesh mesh;
|
||||
|
||||
/**
|
||||
* Returns true if the label contains renderable text.
|
||||
*
|
||||
* @return True if the label has text, otherwise false.
|
||||
*/
|
||||
bool_t hasText();
|
||||
|
||||
/**
|
||||
* Internally performs the mesh update.
|
||||
*/
|
||||
void updateMesh();
|
||||
|
||||
public:
|
||||
//@optional
|
||||
StateProperty<std::string> text;
|
||||
// @optional
|
||||
StateProperty<float_t> fontSize;
|
||||
/* @optional */
|
||||
StateProperty<Font*> font;
|
||||
/* @optional */
|
||||
StateProperty<float_t> maxWidth;
|
||||
/* @optional */
|
||||
struct Color textColor = COLOR_WHITE;
|
||||
// @optional
|
||||
StateProperty<int32_t> startQuad;
|
||||
// @optional
|
||||
StateProperty<int32_t> quadCount;
|
||||
|
||||
StateEvent<> eventFontRebuffered;
|
||||
StateEvent<> eventTextChanged;
|
||||
|
||||
struct FontMeasure measure;
|
||||
|
||||
UILabel(SceneItem *item);
|
||||
|
||||
float_t getContentWidth() override;
|
||||
float_t getContentHeight() override;
|
||||
std::vector<struct ShaderPassItem> getUIRenderPasses() override;
|
||||
void onStart() override;
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user