GithubHelp home page GithubHelp logo

Comments (4)

Nazariglez avatar Nazariglez commented on May 19, 2024

Hey @reformat0r !

Sorry for the late response. The App struct contains some time information.

  • app.timer.delta_f32() -> f32
  • app.timer.delta() -> Instant
  • app.timer.init_time() -> Instant

You can use the delta to calculate your uniforms, or if you want, you can check the init time or the delta to avoid draw to the GPU some frames.

from notan.

reformat0r avatar reformat0r commented on May 19, 2024

Nice!

  • Do you think the framework should provide a way for the user to set the target (max) FPS?
  • Should I change the examples such that they use the delta-function to compute the uniforms? Otherwise people might wonder why they don't exhibit consistent behavior...

from notan.

Nazariglez avatar Nazariglez commented on May 19, 2024

I think it's a good idea to provide a way to limit the frames. Let me think about it a little because it's possible to do this with a plugin, but it will need some changes in how the app loop works probably (to be sure that the delta times are right).

Said that I think that it's also a good idea to use the delta time to set the values of the uniforms or any other value that creates animation. Just to avoid weird visual glitches if the frame is not always the same.

from notan.

Nazariglez avatar Nazariglez commented on May 19, 2024

This is done in the main branch right now. If you're loading the types using notan::prelude::* you can just use .add_plugin(FpsPlugin::new(60)) to use the plugin.

from notan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.