Skip to content

Proposal: Utility classes and methods #21

@GuilhermeF03

Description

@GuilhermeF03

Goal

Create utility classes and methods to smooth usage of engine featues

Note

These features are to be delayed after release of 0.1.0.


1. Asset Registry

What is it?

A registry that holds loaded assets to be used

How the user uses it:

inside any block, it calls it similar to this:

resources {
    texture("player.png")
    sound("jump.wav")
    font("ui.ttf", size = 18)
} // Load data in batch 

Problems:

  • Handle resources lifetime, scope, etc...

Lazy asset loading

What is it?

Simple lazy asset loading

How the users use it?:

val playerTexture by asset<Texture>("player.png")

Screen utilities

What is it?

Utilities for transition, load, unload screens

How users would use it?

// Load into a registry - can be used for fast loads
app.load{ Screen() }

app.transition<Screen>(){
// transition config
}

Manager utilities

What is it?

Utility methods for managers, instead of explicit holding references to them

How would users use it?

scene{
 // use scene manager
}

inject<Type>() // same as ManagersRegistry.get(InjectionManager::class).inject<Type>()

// lazy version
val physics by inject<PhysicsSystem>()

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions