Chariot
Chariot copied to clipboard
Establish a naming convention for locals that are resources, components, systems, and actions
My current thinking is:
- resource:
*_rc - component:
*_comp - system:
*_sys - action:
*_act
Which means the following code:
fetch_components!(arg, entities, [
components(on_screen: OnScreenComponent),
components(units: UnitComponent),
mut components(decals: DecalComponent),
mut components(selected_units: SelectedUnitComponent),
mut components(transforms: TransformComponent),
resource(keyboard_state: KeyboardKeyStates),
resource(mouse_state: MouseState),
resource(path_finder: PathFinder),
resource(players: Players),
resource(view_projector: ViewProjector),
resource(viewport: Viewport),
resource(occupied_tiles: OccupiedTiles),
resource(terrain: Terrain),
mut resource(action_batcher: ActionBatcher),
]);
Would be changed to:
fetch_components!(arg, entities, [
components(on_screen_comp: OnScreenComponent),
components(units_comp: UnitComponent),
mut components(decals_comp: DecalComponent),
mut components(selected_units_comp: SelectedUnitComponent),
mut components(transforms_comp: TransformComponent),
resource(keyboard_state_rc: KeyboardKeyStates),
resource(mouse_state_rc: MouseState),
resource(path_finder_rc: PathFinder),
resource(players_rc: Players),
resource(view_projector_rc: ViewProjector),
resource(viewport_rc: Viewport),
resource(occupied_tiles_rc: OccupiedTiles),
resource(terrain_rc: Terrain),
mut resource(action_batcher_rc: ActionBatcher),
]);
Of course these suffixes (could be prefixes but in general I don't find that helpful, could be convinced otherwise) could be made more brief:
- resource:
*_r - component:
*_c - system:
*_s - action:
*_a