Skip to content

Commit

Permalink
Enhance script storage with deleting keys with setting them to nil, a…
Browse files Browse the repository at this point in the history
…nd store more complex data structures
  • Loading branch information
daid committed Jan 31, 2025
1 parent 9be34b2 commit dd876ef
Showing 1 changed file with 94 additions and 13 deletions.
107 changes: 94 additions & 13 deletions src/script/dataStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


static string scriptstorage_path = "scriptstorage.json";
std::unordered_map<std::string, std::string> data;
static nlohmann::json data;

static void initScriptStorage()
{
Expand All @@ -29,11 +29,7 @@ static void initScriptStorage()
std::string err;
if (auto parsed_json = sp::json::parse(s, err); parsed_json)
{
auto json = parsed_json.value();
for (const auto& [key, value] : json.items())
{
data[key] = value.get<std::string>();
}
data = parsed_json.value();
}
else
{
Expand All @@ -42,16 +38,100 @@ static void initScriptStorage()
}
}

static void luaPushJson(lua_State* L, const nlohmann::json& json)
{
switch(json.type()) {
case nlohmann::json::value_t::null:
lua_pushnil(L);
break;
case nlohmann::json::value_t::object:
lua_newtable(L);
for(const auto& [key, value] : json.items()) {
luaPushJson(L, key);
luaPushJson(L, value);
lua_settable(L, -3);
}
break;
case nlohmann::json::value_t::array:
lua_newtable(L);
{
int index = 1;
for(const auto& value : json) {
luaPushJson(L, value);
lua_seti(L, -2, index++);
}
}
break;
case nlohmann::json::value_t::string:
lua_pushstring(L, static_cast<std::string>(json).c_str());
break;
case nlohmann::json::value_t::boolean:
lua_pushboolean(L, static_cast<bool>(json));
break;
case nlohmann::json::value_t::number_integer:
case nlohmann::json::value_t::number_unsigned:
lua_pushnumber(L, static_cast<int>(json));
break;
case nlohmann::json::value_t::number_float:
lua_pushnumber(L, static_cast<float>(json));
break;
case nlohmann::json::value_t::binary:
lua_pushnil(L);
break;
case nlohmann::json::value_t::discarded:
lua_pushnil(L);
break;
}
}

static nlohmann::json luaGetJson(lua_State* L, int index)
{
nlohmann::json res{nullptr};
switch(lua_type(L, index))
{
case LUA_TBOOLEAN:
res = bool(lua_toboolean(L, index));
break;
case LUA_TNUMBER:
res = lua_tonumber(L, index);
break;
case LUA_TSTRING:
res = lua_tostring(L, index);
break;
case LUA_TTABLE:
index = lua_absindex(L, index);
if (lua_rawlen(L, index) > 0) {
res = nlohmann::json::array();
for(int n=1; n<=lua_rawlen(L, index); n++) {
lua_geti(L, index, n);
res.push_back(luaGetJson(L, -1));
lua_pop(L, 1);
}
} else {
res = nlohmann::json::object();
lua_pushnil(L);
while(lua_next(L, index)) {
auto key = luaGetJson(L, -2);
auto value = luaGetJson(L, -1);
if (key.is_string())
res[key] = value;
lua_pop(L, 1);
}
}
break;
}
return res;
}

static int luaScriptDataStorageSet(lua_State* L)
{
string key = luaL_checkstring(L, 2);
string value = luaL_checkstring(L, 3);
if (data[key] == value)
return 0;

data[key] = value;
if (lua_isnil(L, 3)) {
data.erase(key);
} else {
data[key] = luaGetJson(L, 3);
}
FILE* f = fopen(scriptstorage_path.c_str(), "wt");

if (f)
{
auto s = nlohmann::json(data).dump();
Expand All @@ -67,7 +147,8 @@ static int luaScriptDataStorageGet(lua_State* L)
auto it = data.find(key);
if (it == data.end())
return 0;
lua_pushstring(L, it->second.c_str());

luaPushJson(L, *it);
return 1;
}

Expand Down

1 comment on commit dd876ef

@daid-tinyci
Copy link

@daid-tinyci daid-tinyci bot commented on dd876ef Jan 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TinyCI build failure:

[/home/tinyci/builds/daid/EmptyEpsilon/_build_native:ninja -j 10 package] returned [1]:


[2/47] Building CXX object CMakeFiles/EE_GuiLIB.dir/src/gui/gui2_slider.cpp.o

[3/47] Building CXX object CMakeFiles/EE_GuiLIB.dir/src/gui/gui2_arrowbutton.cpp.o

[4/47] Building CXX object CMakeFiles/EE_GuiLIB.dir/src/gui/gui2_scrolltext.cpp.o

FAILED: CMakeFiles/EE_GuiLIB.dir/src/gui/gui2_scrolltext.cpp.o 

/usr/bin/c++  -I/data/tinyci_builds/daid/EmptyEpsilon/src -I/data/tinyci_builds/daid/EmptyEpsilon/_build_native/include -I/data/tinyci_builds/daid/SeriousProton/src -I/data/tinyci_builds/daid/EmptyEpsilon/_build_native/SeriousProton/include -I/data/tinyci_builds/daid/SeriousProton/libs/Box2D/.. -I/data/tinyci_builds/daid/SeriousProton/libs/glad -I/data/tinyci_builds/daid/SeriousProton/libs/lua/.. -I/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/.. -I/data/tinyci_builds/daid/SeriousProton/libs/freetype2/include -I/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/basis-src -I/data/tinyci_builds/daid/SeriousProton/libs/libopus/include -I/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/meshoptimizer-src/src -isystem /usr/include/SDL2 -O2 -g -DNDEBUG -fdiagnostics-color -g1 -O3 -flto -funsafe-math-optimizations -Wall -Wextra -Woverloaded-virtual -Wdouble-promotion -Wsuggest-override -Werror=return-type -Wno-unused-parameter -Wno-unused-but-set-parameter -MD -MT CMakeFiles/EE_GuiLIB.dir/src/gui/gui2_scrolltext.cpp.o -MF CMakeFiles/EE_GuiLIB.dir/src/gui/gui2_scrolltext.cpp.o.d -o CMakeFiles/EE_GuiLIB.dir/src/gui/gui2_scrolltext.cpp.o -c /data/tinyci_builds/daid/EmptyEpsilon/src/gui/gui2_scrolltext.cpp

/data/tinyci_builds/daid/EmptyEpsilon/src/gui/gui2_scrolltext.cpp: In member function ‘virtual void GuiScrollText::onDraw(sp::RenderTarget&)’:

/data/tinyci_builds/daid/EmptyEpsilon/src/gui/gui2_scrolltext.cpp:33:64: error: no matching function for call to ‘sp::Font::prepare(string&, int, float&, glm::u8vec4, glm::vec2&, sp::Alignment, int)’

   33 |     auto prepared = sp::RenderTarget::getDefaultFont()->prepare(this->text, 32, text_size, selectColor(colorConfig.textbox.forground), text_rect.size, sp::Alignment::TopLeft, sp::Font::FlagClip | sp::Font::FlagLineWrap);

      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In file included from /data/tinyci_builds/daid/EmptyEpsilon/src/gui/gui2_element.h:10,

                 from /data/tinyci_builds/daid/EmptyEpsilon/src/gui/gui2_scrolltext.h:4,

                 from /data/tinyci_builds/daid/EmptyEpsilon/src/gui/gui2_scrolltext.cpp:1:

/data/tinyci_builds/daid/SeriousProton/src/graphics/font.h:52:24: note: candidate: ‘sp::Font::PreparedFontString sp::Font::prepare(std::string_view, int, float, glm::vec2, sp::Alignment, int)’

   52 |     PreparedFontString prepare(std::string_view s, int pixel_size, float text_size, glm::vec2 area_size, Alignment alignment, int flags=0);

      |                        ^~~~~~~

/data/tinyci_builds/daid/SeriousProton/src/graphics/font.h:52:24: note:   candidate expects 6 arguments, 7 provided

/data/tinyci_builds/daid/EmptyEpsilon/src/gui/gui2_scrolltext.cpp: In member function ‘virtual void GuiScrollFormattedText::onDraw(sp::RenderTarget&)’:

/data/tinyci_builds/daid/EmptyEpsilon/src/gui/gui2_scrolltext.cpp:71:57: error: ‘class sp::Font’ has no member named ‘start’

   71 |     auto prepared = sp::RenderTarget::getDefaultFont()->start(32, text_rect.size, sp::Alignment::TopLeft, sp::Font::FlagClip | sp::Font::FlagLineWrap);

      |                                                         ^~~~~

[5/47] Building CXX object CMakeFiles/EE_GuiLIB.dir/src/gui/gui2_label.cpp.o

FAILED: CMakeFiles/EE_GuiLIB.dir/src/gui/gui2_label.cpp.o 

/usr/bin/c++  -I/data/tinyci_builds/daid/EmptyEpsilon/src -I/data/tinyci_builds/daid/EmptyEpsilon/_build_native/include -I/data/tinyci_builds/daid/SeriousProton/src -I/data/tinyci_builds/daid/EmptyEpsilon/_build_native/SeriousProton/include -I/data/tinyci_builds/daid/SeriousProton/libs/Box2D/.. -I/data/tinyci_builds/daid/SeriousProton/libs/glad -I/data/tinyci_builds/daid/SeriousProton/libs/lua/.. -I/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/.. -I/data/tinyci_builds/daid/SeriousProton/libs/freetype2/include -I/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/basis-src -I/data/tinyci_builds/daid/SeriousProton/libs/libopus/include -I/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/meshoptimizer-src/src -isystem /usr/include/SDL2 -O2 -g -DNDEBUG -fdiagnostics-color -g1 -O3 -flto -funsafe-math-optimizations -Wall -Wextra -Woverloaded-virtual -Wdouble-promotion -Wsuggest-override -Werror=return-type -Wno-unused-parameter -Wno-unused-but-set-parameter -MD -MT CMakeFiles/EE_GuiLIB.dir/src/gui/gui2_label.cpp.o -MF CMakeFiles/EE_GuiLIB.dir/src/gui/gui2_label.cpp.o.d -o CMakeFiles/EE_GuiLIB.dir/src/gui/gui2_label.cpp.o -c /data/tinyci_builds/daid/EmptyEpsilon/src/gui/gui2_label.cpp

/data/tinyci_builds/daid/EmptyEpsilon/src/gui/gui2_label.cpp: In member function ‘virtual void GuiAutoSizeLabel::onUpdate()’:

/data/tinyci_builds/daid/EmptyEpsilon/src/gui/gui2_label.cpp:76:33: error: no matching function for call to ‘sp::Font::prepare(string&, int, float&, <brace-enclosed initializer list>, glm::vec2&, sp::Alignment&, const int&)’

   76 |         auto pfs = font->prepare(text, 32, text_size, {255, 255, 255, 255}, size, text_alignment, sp::Font::FlagLineWrap);

      |                    ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In file included from /data/tinyci_builds/daid/EmptyEpsilon/src/gui/gui2_element.h:10,

                 from /data/tinyci_builds/daid/EmptyEpsilon/src/gui/gui2_label.h:4,

                 from /data/tinyci_builds/daid/EmptyEpsilon/src/gui/gui2_label.cpp:1:

/data/tinyci_builds/daid/SeriousProton/src/graphics/font.h:52:24: note: candidate: ‘sp::Font::PreparedFontString sp::Font::prepare(std::string_view, int, float, glm::vec2, sp::Alignment, int)’

   52 |     PreparedFontString prepare(std::string_view s, int pixel_size, float text_size, glm::vec2 area_size, Alignment alignment, int flags=0);

      |                        ^~~~~~~

/data/tinyci_builds/daid/SeriousProton/src/graphics/font.h:52:24: note:   candidate expects 6 arguments, 7 provided

[6/47] Building CXX object CMakeFiles/EE_GuiLIB.dir/src/gui/gui2_progressslider.cpp.o

[7/47] Building CXX object CMakeFiles/EE_GuiLIB.dir/src/gui/gui2_textentry.cpp.o

FAILED: CMakeFiles/EE_GuiLIB.dir/src/gui/gui2_textentry.cpp.o 

/usr/bin/c++  -I/data/tinyci_builds/daid/EmptyEpsilon/src -I/data/tinyci_builds/daid/EmptyEpsilon/_build_native/include -I/data/tinyci_builds/daid/SeriousProton/src -I/data/tinyci_builds/daid/EmptyEpsilon/_build_native/SeriousProton/include -I/data/tinyci_builds/daid/SeriousProton/libs/Box2D/.. -I/data/tinyci_builds/daid/SeriousProton/libs/glad -I/data/tinyci_builds/daid/SeriousProton/libs/lua/.. -I/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/.. -I/data/tinyci_builds/daid/SeriousProton/libs/freetype2/include -I/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/basis-src -I/data/tinyci_builds/daid/SeriousProton/libs/libopus/include -I/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/meshoptimizer-src/src -isystem /usr/include/SDL2 -O2 -g -DNDEBUG -fdiagnostics-color -g1 -O3 -flto -funsafe-math-optimizations -Wall -Wextra -Woverloaded-virtual -Wdouble-promotion -Wsuggest-override -Werror=return-type -Wno-unused-parameter -Wno-unused-but-set-parameter -MD -MT CMakeFiles/EE_GuiLIB.dir/src/gui/gui2_textentry.cpp.o -MF CMakeFiles/EE_GuiLIB.dir/src/gui/gui2_textentry.cpp.o.d -o CMakeFiles/EE_GuiLIB.dir/src/gui/gui2_textentry.cpp.o -c /data/tinyci_builds/daid/EmptyEpsilon/src/gui/gui2_textentry.cpp

/data/tinyci_builds/daid/EmptyEpsilon/src/gui/gui2_textentry.cpp: In member function ‘virtual void GuiTextEntry::onDraw(sp::RenderTarget&)’:

/data/tinyci_builds/daid/EmptyEpsilon/src/gui/gui2_textentry.cpp:35:40: error: no matching function for call to ‘sp::Font::prepare(std::string&, int, float&, <brace-enclosed initializer list>, glm::vec2&, sp::Alignment, const int&)’

   35 |     auto prepared = front.font->prepare(shown_text, 32, text_size, {255,255,255,255}, text_rect.size, multiline ? sp::Alignment::TopLeft : sp::Alignment::CenterLeft, sp::Font::FlagClip);

      |                     ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In file included from /data/tinyci_builds/daid/EmptyEpsilon/src/gui/gui2_element.h:10,

                 from /data/tinyci_builds/daid/EmptyEpsilon/src/gui/gui2_textentry.h:4,

                 from /data/tinyci_builds/daid/EmptyEpsilon/src/gui/gui2_textentry.cpp:1:

/data/tinyci_builds/daid/SeriousProton/src/graphics/font.h:52:24: note: candidate: ‘sp::Font::PreparedFontString sp::Font::prepare(std::string_view, int, float, glm::vec2, sp::Alignment, int)’

   52 |     PreparedFontString prepare(std::string_view s, int pixel_size, float text_size, glm::vec2 area_size, Alignment alignment, int flags=0);

      |                        ^~~~~~~

/data/tinyci_builds/daid/SeriousProton/src/graphics/font.h:52:24: note:   candidate expects 6 arguments, 7 provided

/data/tinyci_builds/daid/EmptyEpsilon/src/gui/gui2_textentry.cpp:97:102: error: no matching function for call to ‘glm::vec<2, float, glm::packed_highp>::vec(<brace-enclosed initializer list>)’

   97 |                     sp::Rect(rect.position + glm::vec2{d.position.x + 16 - text_size * 0.05f, start_y},

      |                                                                                                      ^

In file included from /data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/../gtc/.././ext/../detail/.././ext/vector_bool2.hpp:5,

                 from /data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/../gtc/.././ext/../detail/../vec2.hpp:5,

                 from /data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/../gtc/.././ext/../detail/../matrix.hpp:18,

                 from /data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/../gtc/.././ext/../detail/type_mat4x4.inl:1,

                 from /data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/../gtc/.././ext/../detail/type_mat4x4.hpp:188,

                 from /data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/../gtc/.././ext/matrix_double4x4.hpp:5,

                 from /data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/../gtc/../mat4x4.hpp:5,

                 from /data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/../gtc/matrix_transform.hpp:24,

                 from /data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/quaternion.hpp:18,

                 from /data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/type_precision.hpp:17,

                 from /data/tinyci_builds/daid/EmptyEpsilon/src/gui/colorConfig.h:4,

                 from /data/tinyci_builds/daid/EmptyEpsilon/src/gui/gui2_element.h:6:

/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/../gtc/.././ext/../detail/.././ext/../detail/type_vec2.hpp:130:58: note: candidate: ‘template<class U, glm::qualifier P> constexpr glm::vec<2, T, Q>::vec(const glm::vec<2, U, P>&) [with glm::qualifier P = U; T = float; glm::qualifier Q = glm::packed_highp]’

  130 |                 GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<2, U, P> const& v);

      |                                                          ^~~

/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/../gtc/.././ext/../detail/.././ext/../detail/type_vec2.hpp:130:58: note:   template argument deduction/substitution failed:

/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/../gtc/.././ext/../detail/.././ext/../detail/type_vec2.hpp:126:58: note: candidate: ‘template<class U, glm::qualifier P> constexpr glm::vec<2, T, Q>::vec(const glm::vec<4, U, P>&) [with glm::qualifier P = U; T = float; glm::qualifier Q = glm::packed_highp]’

  126 |                 GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<4, U, P> const& v);

      |                                                          ^~~

/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/../gtc/.././ext/../detail/.././ext/../detail/type_vec2.hpp:126:58: note:   template argument deduction/substitution failed:

/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/../gtc/.././ext/../detail/.././ext/../detail/type_vec2.hpp:123:58: note: candidate: ‘template<class U, glm::qualifier P> constexpr glm::vec<2, T, Q>::vec(const glm::vec<3, U, P>&) [with glm::qualifier P = U; T = float; glm::qualifier Q = glm::packed_highp]’

  123 |                 GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<3, U, P> const& v);

      |                                                          ^~~

/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/../gtc/.././ext/../detail/.././ext/../detail/type_vec2.hpp:123:58: note:   template argument deduction/substitution failed:

/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/../gtc/.././ext/../detail/.././ext/../detail/type_vec2.hpp:117:45: note: candidate: ‘template<class A, class B> constexpr glm::vec<2, T, Q>::vec(const glm::vec<1, X, Q>&, const glm::vec<1, Y, Q>&) [with B = A; T = float; glm::qualifier Q = glm::packed_highp]’

  117 |                 GLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, A, Q> const& x, vec<1, B, Q> const& y);

      |                                             ^~~

/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/../gtc/.././ext/../detail/.././ext/../detail/type_vec2.hpp:117:45: note:   template argument deduction/substitution failed:

/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/../gtc/.././ext/../detail/.././ext/../detail/type_vec2.hpp:115:45: note: candidate: ‘template<class A, class B> constexpr glm::vec<2, T, Q>::vec(A, const glm::vec<1, Y, Q>&) [with B = A; T = float; glm::qualifier Q = glm::packed_highp]’

  115 |                 GLM_FUNC_DECL GLM_CONSTEXPR vec(A x, vec<1, B, Q> const& y);

      |                                             ^~~

/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/../gtc/.././ext/../detail/.././ext/../detail/type_vec2.hpp:115:45: note:   template argument deduction/substitution failed:

/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/../gtc/.././ext/../detail/.././ext/../detail/type_vec2.hpp:113:45: note: candidate: ‘template<class A, class B> constexpr glm::vec<2, T, Q>::vec(const glm::vec<1, X, Q>&, B) [with B = A; T = float; glm::qualifier Q = glm::packed_highp]’

  113 |                 GLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, A, Q> const& x, B y);

      |                                             ^~~

/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/../gtc/.././ext/../detail/.././ext/../detail/type_vec2.hpp:113:45: note:   template argument deduction/substitution failed:

/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/../gtc/.././ext/../detail/.././ext/../detail/type_vec2.hpp:111:45: note: candidate: ‘template<class A, class B> constexpr glm::vec<2, T, Q>::vec(A, B) [with B = A; T = float; glm::qualifier Q = glm::packed_highp]’

  111 |                 GLM_FUNC_DECL GLM_CONSTEXPR vec(A x, B y);

      |                                             ^~~

/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/../gtc/.././ext/../detail/.././ext/../detail/type_vec2.hpp:111:45: note:   template argument deduction/substitution failed:

/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/../gtc/.././ext/../detail/.././ext/../detail/type_vec2.hpp:107:54: note: candidate: ‘template<class U, glm::qualifier P> constexpr glm::vec<2, T, Q>::vec(const glm::vec<1, U, P>&) [with glm::qualifier P = U; T = float; glm::qualifier Q = glm::packed_highp]’

  107 |                 GLM_FUNC_DECL GLM_CONSTEXPR explicit vec(vec<1, U, P> const& v);

      |                                                      ^~~

/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/../gtc/.././ext/../detail/.././ext/../detail/type_vec2.hpp:107:54: note:   template argument deduction/substitution failed:

/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/../gtc/.././ext/../detail/.././ext/../detail/type_vec2.hpp:97:45: note: candidate: ‘template<glm::qualifier P> constexpr glm::vec<2, T, Q>::vec(const glm::vec<2, T, P>&) [with glm::qualifier P = P; T = float; glm::qualifier Q = glm::packed_highp]’

   97 |                 GLM_FUNC_DECL GLM_CONSTEXPR vec(vec<2, T, P> const& v);

      |                                             ^~~

/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/../gtc/.././ext/../detail/.././ext/../detail/type_vec2.hpp:97:45: note:   template argument deduction/substitution failed:

In file included from /data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/../gtc/.././ext/../detail/.././ext/../detail/type_vec2.hpp:398:

/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/../gtc/.././ext/../detail/.././ext/../detail/type_vec2.inl:37:42: note: candidate: ‘constexpr glm::vec<2, T, Q>::vec(T, T) [with T = float; glm::qualifier Q = glm::packed_highp]’

   37 |         GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q>::vec(T _x, T _y)

      |                                          ^~~~~~~~~~~~

/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/../gtc/.././ext/../detail/.././ext/../detail/type_vec2.inl:37:42: note:   conversion of argument 1 would be ill-formed:

/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/../gtc/.././ext/../detail/.././ext/../detail/type_vec2.inl:32:42: note: candidate: ‘constexpr glm::vec<2, T, Q>::vec(T) [with T = float; glm::qualifier Q = glm::packed_highp]’

   32 |         GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q>::vec(T scalar)

      |                                          ^~~~~~~~~~~~

/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/../gtc/.././ext/../detail/.././ext/../detail/type_vec2.inl:32:42: note:   candidate expects 1 argument, 2 provided

/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/../gtc/.././ext/../detail/.././ext/../detail/type_vec2.hpp:95:45: note: candidate: ‘constexpr glm::vec<2, T, Q>::vec(const glm::vec<2, T, Q>&) [with T = float; glm::qualifier Q = glm::packed_highp]’

   95 |                 GLM_FUNC_DECL GLM_CONSTEXPR vec(vec const& v) GLM_DEFAULT;

      |                                             ^~~

/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/../gtc/.././ext/../detail/.././ext/../detail/type_vec2.hpp:95:45: note:   candidate expects 1 argument, 2 provided

/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/../gtc/.././ext/../detail/.././ext/../detail/type_vec2.hpp:94:45: note: candidate: ‘glm::vec<2, T, Q>::vec() [with T = float; glm::qualifier Q = glm::packed_highp]’

   94 |                 GLM_FUNC_DECL GLM_CONSTEXPR vec() GLM_DEFAULT;

      |                                             ^~~

/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/../glm/gtc/../gtc/../gtc/.././ext/../detail/.././ext/../detail/type_vec2.hpp:94:45: note:   candidate expects 0 arguments, 2 provided

/data/tinyci_builds/daid/EmptyEpsilon/src/gui/gui2_textentry.cpp: In member function ‘int GuiTextEntry::getTextOffsetForPosition(glm::vec2)’:

/data/tinyci_builds/daid/EmptyEpsilon/src/gui/gui2_textentry.cpp:454:59: error: cannot convert ‘<brace-enclosed initializer list>’ to ‘glm::vec2’ {aka ‘glm::vec<2, float, glm::packed_highp>’}

  454 |     auto pfs = sp::RenderTarget::getDefaultFont()->prepare(shown_text, 32, text_size, {255,255,255,255}, rect.size - glm::vec2(32, 0), multiline ? sp::Alignment::TopLeft : sp::Alignment::CenterLeft);

      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/data/tinyci_builds/daid/SeriousProton/src/graphics/font.h:52:95: note:   initializing argument 4 of ‘sp::Font::PreparedFontString sp::Font::prepare(std::string_view, int, float, glm::vec2, sp::Alignment, int)’

   52 |     PreparedFontString prepare(std::string_view s, int pixel_size, float text_size, glm::vec2 area_size, Alignment alignment, int flags=0);

      |                                                                                     ~~~~~~~~~~^~~~~~~~~

[8/47] Building CXX object CMakeFiles/EE_GuiLIB.dir/src/gui/gui2_progressbar.cpp.o

[9/47] Building CXX object CMakeFiles/EE_GuiLIB.dir/src/gui/gui2_canvas.cpp.o

[10/47] Building CXX object CMakeFiles/EE_GuiLIB.dir/src/gui/hotkeyBinder.cpp.o

[11/47] Building CXX object CMakeFiles/EE_GuiLIB.dir/src/gui/gui2_button.cpp.o

[12/47] Building CXX object CMakeFiles/EE_GuiLIB.dir/src/gui/gui2_advancedscrolltext.cpp.o

FAILED: CMakeFiles/EE_GuiLIB.dir/src/gui/gui2_advancedscrolltext.cpp.o 

/usr/bin/c++  -I/data/tinyci_builds/daid/EmptyEpsilon/src -I/data/tinyci_builds/daid/EmptyEpsilon/_build_native/include -I/data/tinyci_builds/daid/SeriousProton/src -I/data/tinyci_builds/daid/EmptyEpsilon/_build_native/SeriousProton/include -I/data/tinyci_builds/daid/SeriousProton/libs/Box2D/.. -I/data/tinyci_builds/daid/SeriousProton/libs/glad -I/data/tinyci_builds/daid/SeriousProton/libs/lua/.. -I/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/glm-src/glm/.. -I/data/tinyci_builds/daid/SeriousProton/libs/freetype2/include -I/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/basis-src -I/data/tinyci_builds/daid/SeriousProton/libs/libopus/include -I/data/tinyci_builds/daid/EmptyEpsilon/_build_native/_deps/meshoptimizer-src/src -isystem /usr/include/SDL2 -O2 -g -DNDEBUG -fdiagnostics-color -g1 -O3 -flto -funsafe-math-optimizations -Wall -Wextra -Woverloaded-virtual -Wdouble-promotion -Wsuggest-override -Werror=return-type -Wno-unused-parameter -Wno-unused-but-set-parameter -MD -MT CMakeFiles/EE_GuiLIB.dir/src/gui/gui2_advancedscrolltext.cpp.o -MF CMakeFiles/EE_GuiLIB.dir/src/gui/gui2_advancedscrolltext.cpp.o.d -o CMakeFiles/EE_GuiLIB.dir/src/gui/gui2_advancedscrolltext.cpp.o -c /data/tinyci_builds/daid/EmptyEpsilon/src/gui/gui2_advancedscrolltext.cpp

/data/tinyci_builds/daid/EmptyEpsilon/src/gui/gui2_advancedscrolltext.cpp: In constructor ‘GuiAdvancedScrollText::GuiAdvancedScrollText(GuiContainer*, string)’:

/data/tinyci_builds/daid/EmptyEpsilon/src/gui/gui2_advancedscrolltext.cpp:9:74: error: cannot convert ‘<brace-enclosed initializer list>’ to ‘glm::vec2’ {aka ‘glm::vec<2, float, glm::packed_highp>’}

    9 |     scrollbar->setClickChange(sp::RenderTarget::getDefaultFont()->prepare("1", 32, text_size, {255, 255, 255, 255}, rect.size, sp::Alignment::TopLeft).getUsedAreaSize().y);

      |                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In file included from /data/tinyci_builds/daid/EmptyEpsilon/src/gui/gui2_element.h:10,

                 from /data/tinyci_builds/daid/EmptyEpsilon/src/gui/gui2_advancedscrolltext.h:4,

                 from /data/tinyci_builds/daid/EmptyEpsilon/src/gui/gui2_advancedscrolltext.cpp:1:

/data/tinyci_builds/daid/SeriousProton/src/graphics/font.h:52:95: note:   initializing argument 4 of ‘sp::Font::PreparedFontString sp::Font::prepare(std::string_view, int, float, glm::vec2, sp::Alignment, int)’

   52 |     PreparedFontString prepare(std::string_view s, int pixel_size, float text_size, glm::vec2 area_size, Alignment alignment, int flags=0);

      |                                                                                     ~~~~~~~~~~^~~~~~~~~

/data/tinyci_builds/daid/EmptyEpsilon/src/gui/gui2_advancedscrolltext.cpp: In member function ‘GuiAdvancedScrollText* GuiAdvancedScrollText::setTextSize(float)’:

/data/tinyci_builds/daid/EmptyEpsilon/src/gui/gui2_advancedscrolltext.cpp:31:74: error: cannot convert ‘<brace-enclosed initializer list>’ to ‘glm::vec2’ {aka ‘glm::vec<2, float, glm::packed_highp>’}

   31 |     scrollbar->setClickChange(sp::RenderTarget::getDefaultFont()->prepare("1", 32, text_size, {255, 255, 255, 255}, rect.size, sp::Alignment::TopLeft).getUsedAreaSize().y);

      |                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/data/tinyci_builds/daid/SeriousProton/src/graphics/font.h:52:95: note:   initializing argument 4 of ‘sp::Font::PreparedFontString sp::Font::prepare(std::string_view, int, float, glm::vec2, sp::Alignment, int)’

   52 |     PreparedFontString prepare(std::string_view s, int pixel_size, float text_size, glm::vec2 area_size, Alignment alignment, int flags=0);

      |                                                                                     ~~~~~~~~~~^~~~~~~~~

/data/tinyci_builds/daid/EmptyEpsilon/src/gui/gui2_advancedscrolltext.cpp: In member function ‘GuiAdvancedScrollText::Entry GuiAdvancedScrollText::prepEntry(Entry&)’:

/data/tinyci_builds/daid/EmptyEpsilon/src/gui/gui2_advancedscrolltext.cpp:43:68: error: cannot convert ‘<brace-enclosed initializer list>’ to ‘glm::vec2’ {aka ‘glm::vec<2, float, glm::packed_highp>’}

   43 |     e.prepared_prefix = sp::RenderTarget::getDefaultFont()->prepare(e.prefix, 32, text_size, {255, 255, 255, 255}, rect.size, sp::Alignment::TopLeft);

      |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/data/tinyci_builds/daid/SeriousProton/src/graphics/font.h:52:95: note:   initializing argument 4 of ‘sp::Font::PreparedFontString sp::Font::prepare(std::string_view, int, float, glm::vec2, sp::Alignment, int)’

   52 |     PreparedFontString prepare(std::string_view s, int pixel_size, float text_size, glm::vec2 area_size, Alignment alignment, int flags=0);

      |                                                                                     ~~~~~~~~~~^~~~~~~~~

/data/tinyci_builds/daid/EmptyEpsilon/src/gui/gui2_advancedscrolltext.cpp:47:66: error: no matching function for call to ‘sp::Font::prepare(string&, int, float&, glm::u8vec4&, <brace-enclosed initializer list>, sp::Alignment, int)’

   47 |     e.prepared_text = sp::RenderTarget::getDefaultFont()->prepare(e.text, 32, text_size, e.color, {rect.size.x - max_prefix_width - 50.0f, rect.size.y}, sp::Alignment::TopLeft, sp::Font::FlagLineWrap | sp::Font::FlagClip);

      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/data/tinyci_builds/daid/SeriousProton/src/graphics/font.h:52:24: note: candidate: ‘sp::Font::PreparedFontString sp::Font::prepare(std::string_view, int, float, glm::vec2, sp::Alignment, int)’

   52 |     PreparedFontString prepare(std::string_view s, int pixel_size, float text_size, glm::vec2 area_size, Alignment alignment, int flags=0);

      |                        ^~~~~~~

/data/tinyci_builds/daid/SeriousProton/src/graphics/font.h:52:24: note:   candidate expects 6 arguments, 7 provided

[13/47] Building CXX object CMakeFiles/EE_GuiLIB.dir/src/gui/gui2_element.cpp.o

ninja: build stopped: subcommand failed.

Please sign in to comment.