mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 12:31:51 +00:00
add get_text, set_text, get_pos, set_pos
This commit is contained in:
parent
d74b530a83
commit
501f1b568d
6 changed files with 62 additions and 1 deletions
|
|
@ -6,6 +6,10 @@ TextNote::TextNote(std::wstring text, NotePreset preset, glm::vec3 position)
|
|||
position(std::move(position)) {
|
||||
}
|
||||
|
||||
void TextNote::setText(std::wstring_view text) {
|
||||
this->text = text;
|
||||
}
|
||||
|
||||
const std::wstring& TextNote::getText() const {
|
||||
return text;
|
||||
}
|
||||
|
|
@ -14,6 +18,10 @@ const NotePreset& TextNote::getPreset() const {
|
|||
return preset;
|
||||
}
|
||||
|
||||
void TextNote::setPosition(const glm::vec3& position) {
|
||||
this->position = position;
|
||||
}
|
||||
|
||||
const glm::vec3& TextNote::getPosition() const {
|
||||
return position;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,9 +10,13 @@ class TextNote {
|
|||
public:
|
||||
TextNote(std::wstring text, NotePreset preset, glm::vec3 position);
|
||||
|
||||
void setText(std::wstring_view text);
|
||||
|
||||
const std::wstring& getText() const;
|
||||
|
||||
const NotePreset& getPreset() const;
|
||||
|
||||
void setPosition(const glm::vec3& position);
|
||||
|
||||
const glm::vec3& getPosition() const;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -96,6 +96,14 @@ u64id_t TextsRenderer::add(std::unique_ptr<TextNote> note) {
|
|||
return uid;
|
||||
}
|
||||
|
||||
TextNote* TextsRenderer::get(u64id_t id) const {
|
||||
const auto& found = notes.find(id);
|
||||
if (found == notes.end()) {
|
||||
return nullptr;
|
||||
}
|
||||
return found->second.get();
|
||||
}
|
||||
|
||||
void TextsRenderer::remove(u64id_t id) {
|
||||
notes.erase(id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,5 +41,7 @@ public:
|
|||
|
||||
u64id_t add(std::unique_ptr<TextNote> note);
|
||||
|
||||
TextNote* get(u64id_t id) const;
|
||||
|
||||
void remove(u64id_t id);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue