Skip to content

Add Rgba map to Styles. Use for tints of weapon rounds. #19

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

Merged
merged 3 commits into from
Mar 9, 2024

Conversation

karnkaul
Copy link
Member

@karnkaul karnkaul commented Mar 9, 2024

Close #10

@karnkaul karnkaul marked this pull request as ready for review March 9, 2024 07:53
@karnkaul karnkaul requested a review from swagween March 9, 2024 07:53
@karnkaul karnkaul enabled auto-merge (squash) March 9, 2024 07:53
Copy link
Contributor

@swagween swagween left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved, just one question about how you approach inclusion of services

@@ -12,7 +12,7 @@ class GunBeam final : public Weapon {
float dps{1.0f};
};

explicit GunBeam(Services const& services) : Weapon(services, "DeathRay") {}
explicit GunBeam(Services const& services);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why pass a reference to services here, and in all the other places? could you also have some ServiceLocator with services and include it in any needed .cpps? if not, why not?

Copy link
Member Author

@karnkaul karnkaul Mar 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Services is a service locator, it's just not globally accessible / a singleton. It has its own lifetime and ownership, which supercedes all the services it owns, thereby also giving them explicit lifetime and ownership. Globals, especially singletons, take away both of these very important aspects in C++.

The rest of your thinking is spot on: instead of passing dozens of different references in various constructors (which would be most explicit and correct, but too cumbersome and volatile), we design commonly referenced items as services, initialized by the game driver (Spaced).

@karnkaul karnkaul merged commit 1b034a1 into main Mar 9, 2024
@karnkaul karnkaul deleted the karnage/rgba-map branch March 9, 2024 17:13
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

Successfully merging this pull request may close these issues.

Colors
2 participants