Skip to content

Commit

Permalink
Add ImGuiWS::addResource() method (#25)
Browse files Browse the repository at this point in the history
It allows having files like index.html compiled into the application
binary.
  • Loading branch information
wentasah committed Oct 28, 2023
1 parent 654be40 commit 5e51bbf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/imgui-ws/imgui-ws.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class ImGuiWS {
bool setTexture(TextureId textureId, Texture::Type textureType, int32_t width, int32_t height, const char * data);
bool setDrawData(const struct ImDrawData * drawData);
bool addVar(const TPath & path, TGetter && getter);
void addResource(const std::string & url, const std::string & content);


int32_t nConnected() const;
Expand Down
4 changes: 4 additions & 0 deletions src/imgui-ws.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ bool ImGuiWS::addVar(const TPath & path, TGetter && getter) {
return m_impl->incpp.var(path, std::move(getter));
}

void ImGuiWS::addResource(const std::string & url, const std::string & content) {
m_impl->incpp.setResource(url, content);
}

bool ImGuiWS::init(int32_t port, std::string pathHttp, std::vector<std::string> resources) {
m_impl->incpp.var("my_id[%d]", [](const auto & idxs) {
static int32_t id;
Expand Down

0 comments on commit 5e51bbf

Please sign in to comment.