unix4ever / imvue Goto Github PK
View Code? Open in Web Editor NEWDeclarative reactive ImGui bindings inspired by Vue.js
License: MIT License
Declarative reactive ImGui bindings inspired by Vue.js
License: MIT License
Parsing CSS is a first step.
Then need to implement actual cascade style selector.
Preferably this should be implemented using ImGui coding style.
For example:
// read css from memory/file
ImU32 styleID = ImVue::LoadStyle(data);
...
ImVue::PushStyle(styleID);
// render styleable button
ImVue::Button("label", "btn btn-toggle", "id");
ImVue::PopStyle();
Inside ImVue::Button
:
IMVUE_API Button(const char* label, const char* classes, const char* id) {
...
Context& ctx = GetContext();
// this style selector should be really fast
// probably it's possible to hash all these strings and cache this view
Style* s = ctx.selectStyle("button", classes, id);
if(s) {
// should have some common code that can render any kind of shapes
if(s.fontFamily) {
// style parser should load this font
ImGui::PushFont(s.fontFamily);
// https://github.com/ocornut/imgui/issues/1018 can use the following approach to scale the font
ImGui::TextUnformatted(label);
ImGui::PopFont();
}
} else {
return ImGui::Button(label);
}
Can probably utilise window key value storage to generate and save hashes for elements.
libcss already supports them, need to add this support in ImVue
Handle field change in C++, propagate to script system if there is handler bind for the property.
Trying to set 100% to the first child of a component causes flickering.
E.g.:
ImU32
unsigned short
V8 integration itself shouldn't be really complicated.
But it would make sense to actually make this library behave as an actual web browser (with limited functional). Therefore it would be required to support low level JS functions that are provided by browsers, like: getElementById
, appendChild
, events, and others.
But this task scope can be limited to adding same set of features Lua has but in Javascript.
Implement custom elements for all most common tags:
<a>
<b>
<body>
<br>
-- make simple alias to <new-line>
.<button>
-- override imgui button tag.<canvas>
-- should expose imgui drawlist to script.<datalist>
<div>
<footer>
<form>
-- can be implemented using custom component (?).<h1> to <h6>
<head>
<header>
<html>
<i>
<img>
-- should unite ImGui::Image and ImVue:SvgImage.<input>
-- override input to make it support various kind of operation mode.<li>
<option>
<p>
<s>
<script>
-- run script in the body? Why not.<select>
<span>
-- make span default element. Can fall back to rendering span if can't resolve child tag in html node.<style>
<svg>
-- inline svg.<table>
<tbody>
<td>
<tr>
<textarea>
<tfoot>
<thead>
<th>
v-model works great for <input>
. If autogenerated widgets get the same functional it will be make them much more convenient to use.
Create initial library version with the list of core features, like parsing xml, scripting support, reactive updates and others.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.