4 ms·
Immediate mode gui - psuedocode where volumeSlider is a slider used for setting the audio volume and spectrograph includes a bar which displays the volume visua
by pkphilip 3y ago
Immediate mode gui - psuedocode where volumeSlider is a slider used for setting the audio volume and spectrograph includes a bar which displays the volume visually:
function volumeSlider_onChange() {
audioEngine.setVolume(volumeSlider.value);
spectrograph.setVolume(volumeSlider.value);
}
function stopButton_onClick() {
audioEngine.getCurrentTrack().stop();
}
function audioEngine_statusCallback(Track track) {
spectrograph.update(track.status);
}
To do something like this in a declarative UI, you will need some sort of a state machine, that state machine will then need to have a bunch of state variables, callbacks/hooks, providers/notifiers etc. And you have to have this managed for each variable.
That is, there will be a LOT more code that needs to be run before updates flow from the GUI to the engine or from the engine back to the GUI.
Why would you think that declarative UI will be more efficient?