Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Establish a naming convention for locals that are resources, components, systems, and actions #15

Open
phrohdoh opened this issue Feb 5, 2018 · 0 comments

Comments

@phrohdoh
Copy link
Member

phrohdoh commented Feb 5, 2018

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant