Examples - Wire up Update Slider
This commit is contained in:
parent
7a87ad3749
commit
914b2aa5dd
4 changed files with 12 additions and 6 deletions
|
|
@ -130,7 +130,9 @@ void addControls(Example ex) {
|
|||
|
||||
// Don't add controls which don't work anyways (for simple examples)
|
||||
if(examples.indexOf(ex) <= 1) return;
|
||||
VariableUpdates loop = (ex.loop as VariableUpdates);
|
||||
|
||||
// Update Speed Slider
|
||||
group
|
||||
..append(new LabelElement()
|
||||
..htmlFor = "update_speed"
|
||||
|
|
@ -138,11 +140,11 @@ void addControls(Example ex) {
|
|||
..append(new InputElement(type: "range")
|
||||
..id = "update_speed"
|
||||
..min = "1"
|
||||
..max = "20"
|
||||
..max = "50"
|
||||
..value = "3"
|
||||
..step = "1"
|
||||
..onInput.listen((Event e) {
|
||||
ex.loop;
|
||||
loop.MS_PER_UPDATE = (1000 / int.parse((e.target as InputElement).value));
|
||||
}));
|
||||
// querySelector('#reset').onClick.listen((e) => ex.loop.game.reset());
|
||||
// querySelector('#plus').onClick.listen((e) => _changeGrid(-5));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue