- Added methods for file watching, including `watch`, `unwatch`, `unwatchAll`, `getWatchCount`, `pollWatch`, `getLastWatchPath`, and `getLastWatchRealPath`. - Enhanced the `Filesystem` class to support monitoring file changes, allowing for real-time updates. - Updated the `physfs` implementation to handle file watch targets and events. - Improved documentation and added unit tests to validate the new file watching features. Co-authored-by: Cursor <cursoragent@cursor.com>
51 lines
1.1 KiB
Plaintext
51 lines
1.1 KiB
Plaintext
// Declarative UIComponent demo (use as main.nut).
|
|
|
|
class HudPanel extends eve.UIComponent {
|
|
hp = 100
|
|
volume = 0.5
|
|
constructor(uiRef) {
|
|
base.constructor(uiRef)
|
|
hp = 100
|
|
volume = 0.5
|
|
}
|
|
function build() {
|
|
local u = ui()
|
|
u.beginWindow("HUD", "root")
|
|
u.text("HP " + hp, "hp")
|
|
u.progress(hp / 100.0, "bar", hp + "%")
|
|
u.slider("Vol", volume, 0.0, 1.0, "vol")
|
|
u.button("Hurt", "hurt")
|
|
u.end()
|
|
}
|
|
}
|
|
|
|
eve_init = function() {
|
|
hud <- HudPanel(ui)
|
|
hud.mountAs("hud")
|
|
};
|
|
|
|
eve_update = function(dt) {
|
|
local c = ui.consumeClick();
|
|
while (c != "") {
|
|
if (c == "hud/hurt") {
|
|
hud.hp -= 10;
|
|
if (hud.hp < 0) hud.hp = 0;
|
|
hud.setState();
|
|
hud.updateIfDirty();
|
|
}
|
|
c = ui.consumeClick();
|
|
}
|
|
local ch = ui.consumeChange();
|
|
while (ch != "") {
|
|
if (ch == "hud/vol") {
|
|
hud.volume = ui.getValue("vol");
|
|
}
|
|
ch = ui.consumeChange();
|
|
}
|
|
};
|
|
|
|
eve_render = function() {
|
|
gfx.clear();
|
|
ui.beginFrameAndRender();
|
|
};
|