I need a way to ask if a cell exists for more dynamic layouts.

This commit is contained in:
Zed A. Shaw 2026-04-04 14:50:15 -04:00
parent aff0fb839c
commit 25e3935170
3 changed files with 6 additions and 1 deletions

View file

@ -68,6 +68,7 @@ namespace guecs {
sf::Vector2f get_size();
void layout(const string& grid);
Entity init_entity(const string& name);
bool contains(const string& name);
Entity entity(const string& name);
Entity entity(const string& name, int id);
const std::string& name_for(Entity gui_id);

View file

@ -3,7 +3,7 @@
# HEY BUG: when you have a . spec in a LEL it doesn't work on text
project('lel-guecs', 'cpp',
version: '0.7.1',
version: '0.7.2',
default_options: [
'cpp_std=c++23',
'cpp_args=-D_GLIBCXX_DEBUG=1 -D_GLIBCXX_DEBUG_PEDANTIC=1',

View file

@ -51,6 +51,10 @@ namespace guecs {
return $ents_name.at(gui_id);
}
bool UI::contains(const string& name) {
return $name_ents.contains(name);
}
Entity UI::entity(const string& name) {
assert($name_ents.contains(name) &&
"GUECS entity does not exist. Mispelled cell name?");