1.7 KiB
1.7 KiB
features
One project per client feature (features/<name>, ADR 0046). Each is a Module from :framework.
- Depend on
:frameworkonly. Never the game, the platform or another feature; each feature has aBoundaryTestsaying so. If the framework can't tell or let you do something, add that to the framework (itsAGENTS.md), not a way around it. - Declare, don't wire. Settings as fields (
settings().bool(...)), HUD elements withhud(...)and listeners withon(...)in the constructor. Never draw a settings screen: it's generated. - Colors by tone. Draw HUD text and panels in a
Tone; a fixed color only from aColorSettingthe player chose. The theme decides the rest, so the client's restyle reaches every feature. - Hot paths don't allocate: event listeners and
HudElement.draw. Make strings once, keep state in fields. - Ids are forever: the module's, each setting's and each HUD element's are config keys.
- Names and descriptions are short and plain: a setting's description is one sentence, shown as its tooltip.
- Test with
TestGame(:framework's test fixtures): enable the module, fire events, draw the HUD on its recording canvas.
Adding a feature
features/<name>/build.gradle.ktsastogglesprint's, and its sources underincari.features.<name>, with aBoundaryTestand tests.include(":features:<name>")insettings.gradle.kts; a:features:<name> :frameworkline ingradle/module-boundaries.txt, and:features:<name>added to:client's line there.implementation(project(":features:<name>"))inclient/build.gradle.kts, and the module inincari.client.modules.Features../gradlew :features:<name>:check, then./gradlew :client:strictCompile.