8000 Modularize Context · Issue #480 · ggez/ggez · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Modularize Context #480
Open
Open
@icefoxen

Description

@icefoxen

I swore there was an issue discussing this but I can't find it, so I'm making it now.

Basically, it would be nice to be able to initialize only part of a Context... for example, having graphics with no audio or such. We're already partially set up for that by having sub-Context objects. The trick is doing it without sticking Option and unwrap() everywhere.

I think it would be better to make each sub-context a trait object, and then we can, for example, have an AudioContext that uses rodio to play sounds, and a NullAudioContext that has all the same methods but just does nothing with them, or has any calls to them panic at runtime. This way w 637E e don't have to check to make sure the context is valid Every. Single. Time. We. Touch. It.

That said, trait objects have their own limitations, soooo. This might be harder than it looks, and it doesn't look easy.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0