soywiz-archive / korge-samples

Korge Samples
55 stars 23 forks source link

Simple refresh of Shape Sample to more recent KorGE features #22

Closed emign closed 4 years ago

emign commented 4 years ago

very minor

RezMike commented 4 years ago

Hm, could we save both versions? The old one like more straightforward/thorough and the new one like more optimal and recommended?

soywiz commented 4 years ago

It should use fixed updater if not using the parameter with the time. You can compute a multiplier with:

val ratio = it / 16.milliseconds x += 2 * ratio

Or use fixedUpdater

For example I have a 144hz screen. If not doing so, I would see it something like 2.1x times faster than when using a 60hz screen

emign commented 4 years ago

addUpdater is every frame and fixedUpdater 60 times per second?

soywiz commented 4 years ago

addFixedUpdater allows you to configure times per second. For example:

view.addFixedUpdater(16.666666.milliseconds) {
}

or

view.addFixedUpdater((1.0 / 60.0).seconds) {
}

after the new version you will also be able to do too:

view.addFixedUpdater(60.timesPerSecond) {
}
emign commented 4 years ago

Nice. We need a video for that

soywiz commented 4 years ago

Indeed