Skip to content

Instantly share code, notes, and snippets.

View viridia's full-sized avatar

Talin viridia

View GitHub Profile
@viridia
viridia / bevy-ui-improvements.md
Last active September 24, 2023 02:33
Bevy UI Improvements

Bevy UI Improvments: Brainstorm

This document is a collection of ideas related to improving Bevy UI at the foundational level. These ideas are chosen to be ones that will not interfere with large-scale efforts to develop a UI asset and templating system. This means that the items listed here either either template-agnostic, or are general enough that they would conceivably mesh with any future templating system being contemplated.

Preparing for Style Assets

This section establishes a set of working assumptions. We don't know yet what form style assets will take, but we can assume the following:

  • Style assets will be a thing.
  • The design of style assets won't be a clone of CSS stylesheets, but will take some ideas from CSS.
@viridia
viridia / guise-notebook.md
Last active September 23, 2023 03:08
Bevy Guise / Design Notes

Bevy / Guise Design Notes

Guiding principles:

(This list is not comprehensive)

  • Artist friendly workflow - this means that non-technical artists can create UIs without writing code. It also means that UI designs which are highly art- and animation- intensive can be supported.
  • Separation of Concerns - an artist should be able to re-style a widget without needing to modify the source code of the widget. This means that style must be separable from logic.

These principles dictate an asset-centric, rather than a code-centric, approach to UI authoring. The primary creative output of the artist will be UI assets; the primary creative output of the programmer will be modular components ("presenters") that can be referenced from those assets.

@viridia
viridia / asset-migration.md
Last active January 5, 2025 07:18
Migrating to Bevy Assets V2

Migrating to Bevy Assets V2

Migrating a custom asset loader

Existing asset loaders will need a few small changes to get them to work with Bevy Assets V2.

First, you'll need to add the asset type as an associated type of the loader. This type is called Asset and represents the type of the "default asset" produced by the loader.

You'll also need to add a Settings type which represents options that can be passed to the loader when you request an asset. If your asset has no settings, then you can just set it to the unit type.

@viridia
viridia / SaveGame.ts
Created January 31, 2023 19:17
Example of Structural Sharing for saved games.
export class SavedGameStore<T extends object> {
private prev: { [key: string]: string } = {};
private next: { [key: string]: string } = {};
constructor(private options: ISaveGameOptions = {}) {}
/** Return a list of saved games. */
public list(): ISavedGameRoot[] {
/** Get all the local storage keys that begin with the word 'save'. */
return Object.keys(localStorage)