Skip to content
This repository was archived by the owner on Aug 15, 2023. It is now read-only.
This repository was archived by the owner on Aug 15, 2023. It is now read-only.

Optimzed loop #60

@elgopher

Description

@elgopher

There is a chance that a single frame processing will take more time than expected. The usual cause of the problem might be an inefficient image manipulation. But some pieces of code in the loop have to be executed in timely manner. One such piece is an input handling.

My initial idea is to create a new kind of optimzed loop which will support multiple callbacks, each executed at his own pace:

optimizedLoop := loop.NewOptimizedLoop(window)
// this function gets called at normal rate (at most 60 times per second)
optimizedLoop.Set(60, func(frame *pixiq.Frame) {
     // here goes the input processing
})
// this function gets called at lower rate (at most 30 times per second)
optimizedLoop.Set(30, func(frame *pixiq.Frame) {
     // here goes the screen draw
})
optimizedLoop.Execute()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions