From a57cc508031a6ce0104adddfec45019827f86aa2 Mon Sep 17 00:00:00 2001 From: Nyeogmi Date: Sun, 23 Feb 2025 18:37:34 -0800 Subject: [PATCH] Put colors in instance variables --- src/button.ts | 18 ++++------- src/checkmodal.ts | 34 +++++++++++++------- src/colors.ts | 77 +++++++++++++++++++++++---------------------- src/endgamemodal.ts | 38 +++++++++++----------- src/game.ts | 4 +-- src/hud.ts | 36 +++++++++------------ src/huntmode.ts | 15 +++------ src/pickups.ts | 16 +++++----- src/skillsmodal.ts | 23 ++++++-------- src/vnmodal.ts | 17 ++++++---- src/world3d.ts | 11 ++----- 11 files changed, 140 insertions(+), 149 deletions(-) diff --git a/src/button.ts b/src/button.ts index 250511d..3ea007b 100644 --- a/src/button.ts +++ b/src/button.ts @@ -1,12 +1,6 @@ import { DrawPile } from "./drawpile.ts"; import { AlignX, AlignY, Point, Rect, Size } from "./engine/datatypes.ts"; -import { - BG_INSET, - FG_BOLD, - FG_TEXT, - FG_TEXT_DISABLED, - FG_TEXT_ENDORSED, -} from "./colors.ts"; +import { C } from "./colors.ts"; import { D } from "./engine/public.ts"; export function addButton( @@ -31,18 +25,18 @@ export function addButton( drawpile.addClickable( 0, (hover) => { - let [bg, fg, fgLabel] = [BG_INSET, FG_TEXT, FG_BOLD]; + let [bg, fg, fgLabel] = [C.BG_INSET, C.FG_TEXT, C.FG_BOLD]; if (!enabled) { - fgLabel = FG_TEXT_DISABLED; + fgLabel = C.FG_TEXT_DISABLED; } if (enabled && options?.endorse) { - fg = FG_TEXT_ENDORSED; - fgLabel = FG_TEXT_ENDORSED; + fg = C.FG_TEXT_ENDORSED; + fgLabel = C.FG_TEXT_ENDORSED; } if (hover) { - [bg, fg, fgLabel] = [FG_BOLD, BG_INSET, BG_INSET]; + [bg, fg, fgLabel] = [C.FG_BOLD, C.BG_INSET, C.BG_INSET]; } D.fillRect( topLeftPadded.offset(new Point(-1, -1)), diff --git a/src/checkmodal.ts b/src/checkmodal.ts index 8d7a174..7b34342 100644 --- a/src/checkmodal.ts +++ b/src/checkmodal.ts @@ -3,10 +3,10 @@ import { CheckData, CheckDataOption, ChoiceOption } from "./newmap.ts"; import { getPartLocation, withCamera } from "./layout.ts"; import { AlignX, AlignY, Point, Rect, Size } from "./engine/datatypes.ts"; import { D } from "./engine/public.ts"; -import { BG_INSET, FG_BOLD } from "./colors.ts"; import { addButton } from "./button.ts"; import { getSkills } from "./skills.ts"; import { getPlayerProgress } from "./playerprogress.ts"; +import { C } from "./colors.ts"; export class CheckModal { #drawpile: DrawPile; @@ -54,17 +54,22 @@ export class CheckModal { let size = this.#size; this.#drawpile.add(0, () => { - D.fillRect(new Point(-4, -4), size.add(new Size(8, 8)), BG_INSET); + D.fillRect(new Point(-4, -4), size.add(new Size(8, 8)), C.BG_INSET); }); let success = this.#success; if (success) { this.#drawpile.add(0, () => { - D.drawText(success, new Point(size.w / 2, (size.h - 64) / 2), FG_BOLD, { - forceWidth: size.w, - alignX: AlignX.Center, - alignY: AlignY.Middle, - }); + D.drawText( + success, + new Point(size.w / 2, (size.h - 64) / 2), + C.FG_BOLD, + { + forceWidth: size.w, + alignX: AlignX.Center, + alignY: AlignY.Middle, + }, + ); }); addButton( this.#drawpile, @@ -80,11 +85,16 @@ export class CheckModal { let labelText = check.label; this.#drawpile.add(0, () => { - D.drawText(labelText, new Point(size.w / 2, (size.h - 64) / 2), FG_BOLD, { - forceWidth: size.w, - alignX: AlignX.Center, - alignY: AlignY.Middle, - }); + D.drawText( + labelText, + new Point(size.w / 2, (size.h - 64) / 2), + C.FG_BOLD, + { + forceWidth: size.w, + alignX: AlignX.Center, + alignY: AlignY.Middle, + }, + ); }); let options = check.options; diff --git a/src/colors.ts b/src/colors.ts index 7e6215b..c0a2944 100644 --- a/src/colors.ts +++ b/src/colors.ts @@ -1,46 +1,49 @@ import { Color } from "./engine/datatypes.ts"; import { Stat } from "./datatypes.ts"; -export const BG_OUTER = Color.parseHexCode("#143464"); -export const BG_WALL_OR_UNREVEALED = Color.parseHexCode("#143464"); -export const BG_INSET = Color.parseHexCode("#242234"); -export const FG_TEXT = Color.parseHexCode("#c0c0c0"); -export const FG_TEXT_DISABLED = Color.parseHexCode("#808080"); -export const FG_TOO_EXPENSIVE = Color.parseHexCode("#ff8080"); -export const FG_TEXT_ENDORSED = Color.parseHexCode("#80ff80"); -export const FG_BOLD = Color.parseHexCode("#ffffff"); -export const BG_CEILING = Color.parseHexCode("#143464"); -export const FG_MOULDING = FG_TEXT; +export class ColorSystem { + readonly BG_INSET = Color.parseHexCode("#242234"); + readonly FG_TEXT = Color.parseHexCode("#c0c0c0"); + readonly FG_TEXT_DISABLED = Color.parseHexCode("#808080"); + readonly FG_TOO_EXPENSIVE = Color.parseHexCode("#ff8080"); + readonly FG_TEXT_ENDORSED = Color.parseHexCode("#80ff80"); + readonly FG_BOLD = Color.parseHexCode("#ffffff"); + readonly BG_OUTER = Color.parseHexCode("#143464"); + readonly BG_WALL_OR_UNREVEALED = Color.parseHexCode("#143464"); + readonly BG_CEILING = Color.parseHexCode("#143464"); -// stat colors -export const SWATCH_EXP: [Color, Color] = [ - Color.parseHexCode("#b9bffb"), - Color.parseHexCode("#e3e6ff"), -]; + // stat colors + readonly SWATCH_EXP: [Color, Color] = [ + Color.parseHexCode("#b9bffb"), + Color.parseHexCode("#e3e6ff"), + ]; -export const SWATCH_AGI: [Color, Color] = [ - Color.parseHexCode("#df3e23"), - Color.parseHexCode("#fa6a0a"), -]; + readonly SWATCH_AGI: [Color, Color] = [ + Color.parseHexCode("#df3e23"), + Color.parseHexCode("#fa6a0a"), + ]; -export const SWATCH_INT: [Color, Color] = [ - Color.parseHexCode("#285cc4"), - Color.parseHexCode("#249fde"), -]; + readonly SWATCH_INT: [Color, Color] = [ + Color.parseHexCode("#285cc4"), + Color.parseHexCode("#249fde"), + ]; -export const SWATCH_CHA: [Color, Color] = [ - Color.parseHexCode("#793a80"), - Color.parseHexCode("#bc4a9b"), -]; + readonly SWATCH_CHA: [Color, Color] = [ + Color.parseHexCode("#793a80"), + Color.parseHexCode("#bc4a9b"), + ]; -export const SWATCH_PSI: [Color, Color] = [ - Color.parseHexCode("#9cdb43"), - Color.parseHexCode("#d6f264"), -]; + readonly SWATCH_PSI: [Color, Color] = [ + Color.parseHexCode("#9cdb43"), + Color.parseHexCode("#d6f264"), + ]; -export const SWATCH_STAT: Record = { - AGI: SWATCH_AGI, - INT: SWATCH_INT, - CHA: SWATCH_CHA, - PSI: SWATCH_PSI, -}; + readonly SWATCH_STAT: Record = { + AGI: this.SWATCH_AGI, + INT: this.SWATCH_INT, + CHA: this.SWATCH_CHA, + PSI: this.SWATCH_PSI, + }; +} + +export let C = new ColorSystem(); diff --git a/src/endgamemodal.ts b/src/endgamemodal.ts index a8c730e..83a4bb0 100644 --- a/src/endgamemodal.ts +++ b/src/endgamemodal.ts @@ -1,6 +1,5 @@ import { withCamera } from "./layout.ts"; import { D } from "./engine/public.ts"; -import { BG_INSET, FG_BOLD, FG_TEXT } from "./colors.ts"; import { AlignX, AlignY, Point, Rect, Size } from "./engine/datatypes.ts"; import { DrawPile } from "./drawpile.ts"; import { addButton } from "./button.ts"; @@ -8,6 +7,7 @@ import { ALL_STATS, Ending } from "./datatypes.ts"; import { getStateManager } from "./statemanager.ts"; import { getWishes } from "./wishes.ts"; import { sndEnding } from "./sounds.ts"; +import { C } from "./colors.ts"; const WIDTH = 384; const HEIGHT = 384; @@ -89,22 +89,22 @@ export class EndgameModal { D.drawText( "It is time to announce the sentence of fate.", new Point(0, 0), - FG_TEXT, + C.FG_TEXT, ); D.drawText( "You are no longer a fledgling. Your new rank:", new Point(0, 32), - FG_TEXT, + C.FG_TEXT, ); - D.drawText(rank, new Point(WIDTH / 2, 64), FG_BOLD, { + D.drawText(rank, new Point(WIDTH / 2, 64), C.FG_BOLD, { alignX: AlignX.Center, }); D.drawText( "You have achieved a DOMICILE STATUS of:", new Point(0, 96), - FG_TEXT, + C.FG_TEXT, ); - D.drawText(domicile, new Point(WIDTH / 2, 128), FG_BOLD, { + D.drawText(domicile, new Point(WIDTH / 2, 128), C.FG_BOLD, { alignX: AlignX.Center, }); let whereLabel = @@ -113,8 +113,8 @@ export class EndgameModal { : mortalServants >= 1 ? "where you live with a couple of friends." : "where you live without friends."; - D.drawText(whereLabel, new Point(0, 160), FG_TEXT); - D.drawText("You have achieved:", new Point(0, 192), FG_TEXT); + D.drawText(whereLabel, new Point(0, 160), C.FG_TEXT); + D.drawText("You have achieved:", new Point(0, 192), C.FG_TEXT); let itemsPurloinedText = itemsPurloined == 1 ? "item purloined" : "items purloined"; let vampiricSkillsText = @@ -131,13 +131,13 @@ export class EndgameModal { D.drawText( `${itemsPurloined} ${itemsPurloinedText}\n${vampiricSkills} ${vampiricSkillsText}\n${mortalServants} ${mortalServantsText}`, new Point(WIDTH / 2, 224), - FG_TEXT, + C.FG_TEXT, { alignX: AlignX.Center }, ); D.drawText( `${itemsPurloined} ${itemsPurloinedSpcr}\n${vampiricSkills} ${vampiricSkillsSpcr}\n${mortalServants} ${mortalServantsSpcr}`, new Point(WIDTH / 2, 224), - FG_BOLD, + C.FG_BOLD, { alignX: AlignX.Center }, ); let msg = "That's pretty dreadful."; @@ -147,14 +147,14 @@ export class EndgameModal { if (mortalServants >= 30) { msg = "That feels like a lot!"; } - D.drawText(msg, new Point(0, 288), FG_TEXT); + D.drawText(msg, new Point(0, 288), C.FG_TEXT); let reignSentence = this.#ending?.personal?.reignSentence ?? "Your reign is in an unknown state."; D.drawText( `${reignSentence} It is now time to`, new Point(0, 320), - FG_TEXT, + C.FG_TEXT, { forceWidth: WIDTH }, ); }); @@ -169,7 +169,7 @@ export class EndgameModal { ); } else if (this.#page == 1) { this.#drawpile.add(0, () => { - D.drawText("Choose your successor:", new Point(0, 0), FG_TEXT); + D.drawText("Choose your successor:", new Point(0, 0), C.FG_TEXT); }); this.#addCandidate(0, new Point(0, 16)); @@ -184,7 +184,7 @@ export class EndgameModal { D.drawText( `Plan their destiny:${optionalNote}`, new Point(0, 224), - FG_TEXT, + C.FG_TEXT, ); }); @@ -293,9 +293,9 @@ export class EndgameModal { this.#drawpile.addClickable( 0, (hover) => { - let [bg, fg, fgBold] = [BG_INSET, FG_TEXT, FG_BOLD]; + let [bg, fg, fgBold] = [C.BG_INSET, C.FG_TEXT, C.FG_BOLD]; if (hover || selected) { - [bg, fg, fgBold] = [FG_BOLD, BG_INSET, BG_INSET]; + [bg, fg, fgBold] = [C.FG_BOLD, C.BG_INSET, C.BG_INSET]; } D.fillRect(at.offset(new Point(0, 4)), new Size(w, h - 8), bg); D.drawRect(at.offset(new Point(0, 4)), new Size(w, h - 8), fg); @@ -383,9 +383,9 @@ export class EndgameModal { this.#drawpile.addClickable( 0, (hover) => { - let [bg, fg, fgBold] = [BG_INSET, FG_TEXT, FG_BOLD]; + let [bg, fg, fgBold] = [C.BG_INSET, C.FG_TEXT, C.FG_BOLD]; if (hover || selected) { - [bg, fg, fgBold] = [FG_BOLD, BG_INSET, BG_INSET]; + [bg, fg, fgBold] = [C.FG_BOLD, C.BG_INSET, C.BG_INSET]; } D.fillRect(at.offset(new Point(2, 4)), new Size(w - 4, h - 8), bg); D.drawRect(at.offset(new Point(2, 4)), new Size(w - 4, h - 8), fg); @@ -403,7 +403,7 @@ export class EndgameModal { D.drawText( wishData.profile.note, at.offset(new Point(w / 2, h)), - FG_TEXT, + C.FG_TEXT, { alignX: AlignX.Center, }, diff --git a/src/game.ts b/src/game.ts index 95a9936..9db3d84 100644 --- a/src/game.ts +++ b/src/game.ts @@ -1,4 +1,3 @@ -import { BG_OUTER } from "./colors.ts"; import { D, I } from "./engine/public.ts"; import { IGame, Point, Size } from "./engine/datatypes.ts"; import { getHotbar, Hotbar } from "./hotbar.ts"; @@ -7,6 +6,7 @@ import { getVNModal, VNModal } from "./vnmodal.ts"; import { Gameplay, getGameplay } from "./gameplay.ts"; import { getEndgameModal } from "./endgamemodal.ts"; import { CheckModal, getCheckModal } from "./checkmodal.ts"; +import { C } from "./colors.ts"; export class Game implements IGame { #mainThing: Gameplay | VNModal | null; @@ -28,7 +28,7 @@ export class Game implements IGame { // draw screen background let oldCamera = D.camera; D.camera = new Point(0, 0); - D.fillRect(new Point(0, 0), D.size, BG_OUTER); + D.fillRect(new Point(0, 0), D.size, C.BG_OUTER); D.camera = oldCamera; this.drawGameplay(); diff --git a/src/hud.ts b/src/hud.ts index 5483b52..6e23801 100644 --- a/src/hud.ts +++ b/src/hud.ts @@ -1,17 +1,11 @@ import { D } from "./engine/public.ts"; import { Point, Size } from "./engine/datatypes.ts"; -import { - BG_OUTER, - FG_BOLD, - FG_TEXT, - FG_TEXT_ENDORSED, - FG_TOO_EXPENSIVE, -} from "./colors.ts"; import { ALL_STATS } from "./datatypes.ts"; import { getPlayerProgress } from "./playerprogress.ts"; import { getHuntMode } from "./huntmode.ts"; import { getStateManager } from "./statemanager.ts"; import { withCamera } from "./layout.ts"; +import { C } from "./colors.ts"; export class Hud { get size(): Size { @@ -33,45 +27,45 @@ export class Hud { #update() {} #draw() { - D.fillRect(new Point(-4, -4), this.size.add(new Size(8, 8)), BG_OUTER); - D.drawText(getPlayerProgress().name, new Point(0, 0), FG_BOLD); + D.fillRect(new Point(-4, -4), this.size.add(new Size(8, 8)), C.BG_OUTER); + D.drawText(getPlayerProgress().name, new Point(0, 0), C.FG_BOLD); let levelText = `Level ${getHuntMode().getDepth()}`; let zoneLabel = getHuntMode().getZoneLabel(); if (zoneLabel != null) { levelText += ": " + zoneLabel; } - D.drawText(levelText, new Point(0, 16), FG_TEXT); + D.drawText(levelText, new Point(0, 16), C.FG_TEXT); D.drawText( `Turn ${getStateManager().getTurn()}/${getStateManager().getMaxTurns()}`, new Point(0, 32), - FG_TEXT, + C.FG_TEXT, ); let y = 64; let prog = getPlayerProgress(); for (let s of ALL_STATS.values()) { - D.drawText(`${s}`, new Point(0, y), FG_BOLD); - D.drawText(`${prog.getStat(s)}`, new Point(32, y), FG_TEXT); + D.drawText(`${s}`, new Point(0, y), C.FG_BOLD); + D.drawText(`${prog.getStat(s)}`, new Point(32, y), C.FG_TEXT); let talent = prog.getTalent(s); if (talent > 0) { - D.drawText(`(+${talent})`, new Point(56, y), FG_TEXT); + D.drawText(`(+${talent})`, new Point(56, y), C.FG_TEXT); } if (talent < 0) { - D.drawText(`(${talent})`, new Point(56, y), FG_TEXT); + D.drawText(`(${talent})`, new Point(56, y), C.FG_TEXT); } y += 16; } - D.drawText("EXP", new Point(0, 144), FG_BOLD); - D.drawText(`${prog.getExperience()}`, new Point(32, 144), FG_TEXT); - D.drawText("BLD", new Point(0, 160), FG_BOLD); + D.drawText("EXP", new Point(0, 144), C.FG_BOLD); + D.drawText(`${prog.getExperience()}`, new Point(32, 144), C.FG_TEXT); + D.drawText("BLD", new Point(0, 160), C.FG_BOLD); let bloodAmount = prog.getBlood(); - let bloodColor = FG_TEXT; + let bloodColor = C.FG_TEXT; if (bloodAmount >= 2000) { - bloodColor = FG_TEXT_ENDORSED; + bloodColor = C.FG_TEXT_ENDORSED; } if (bloodAmount < 100) { - bloodColor = FG_TOO_EXPENSIVE; + bloodColor = C.FG_TOO_EXPENSIVE; } D.drawText(`${prog.getBlood()}cc`, new Point(32, 160), bloodColor); } diff --git a/src/huntmode.ts b/src/huntmode.ts index a3e147e..f5ceba4 100644 --- a/src/huntmode.ts +++ b/src/huntmode.ts @@ -1,12 +1,6 @@ import { Circle, Point, Size } from "./engine/datatypes.ts"; import { DrawPile } from "./drawpile.ts"; import { D, I } from "./engine/public.ts"; -import { - BG_INSET, - FG_TEXT, - FG_TEXT_ENDORSED, - FG_TOO_EXPENSIVE, -} from "./colors.ts"; import { getPlayerProgress } from "./playerprogress.ts"; import { Architecture, LoadedNewMap } from "./newmap.ts"; import { FLOOR_CELL_SIZE, GridArt } from "./gridart.ts"; @@ -17,6 +11,7 @@ import { Block3D, Floor3D, World3D } from "./world3d.ts"; import { Floater } from "./floater.ts"; import { displace } from "./physics.ts"; import { getThralls } from "./thralls.ts"; +import { C } from "./colors.ts"; export class HuntMode { map: LoadedNewMap; @@ -300,11 +295,11 @@ export class HuntMode { highlighted = false; } - let color = BG_INSET; + let color = C.BG_INSET; if (highlighted) { - color = FG_TEXT; + color = C.FG_TEXT; if (tooExpensive) { - color = FG_TOO_EXPENSIVE; + color = C.FG_TOO_EXPENSIVE; } } @@ -426,7 +421,7 @@ export class HuntMode { D.fillRect( cellOffset.offset(new Point(-4, -4)), new Size(8, 8), - FG_TEXT_ENDORSED, + C.FG_TEXT_ENDORSED, ); }); } diff --git a/src/pickups.ts b/src/pickups.ts index b09ea00..71104e8 100644 --- a/src/pickups.ts +++ b/src/pickups.ts @@ -15,7 +15,6 @@ import { GridArt } from "./gridart.ts"; import { getCheckModal } from "./checkmodal.ts"; import { Point, Size } from "./engine/datatypes.ts"; import { choose } from "./utils.ts"; -import { FG_BOLD, FG_TEXT, SWATCH_EXP, SWATCH_STAT } from "./colors.ts"; import { Block3D } from "./world3d.ts"; import { DrawPile } from "./drawpile.ts"; import { Floater } from "./floater.ts"; @@ -27,6 +26,7 @@ import { sndRewardFor, sndRewardHuge, } from "./sounds.ts"; +import { C } from "./colors.ts"; export type Pickup = | LockPickup @@ -211,9 +211,9 @@ export class StatPickupCallbacks { getBlock(progress: number) { return new Block3D( - progress > 0.6 ? FG_BOLD : SWATCH_STAT[this.#stat][1], - progress > 0.6 ? FG_TEXT : SWATCH_STAT[this.#stat][0], - progress > 0.6 ? FG_BOLD : SWATCH_STAT[this.#stat][1], + progress > 0.6 ? C.FG_BOLD : C.SWATCH_STAT[this.#stat][1], + progress > 0.6 ? C.FG_TEXT : C.SWATCH_STAT[this.#stat][0], + progress > 0.6 ? C.FG_BOLD : C.SWATCH_STAT[this.#stat][1], ); } @@ -258,9 +258,9 @@ export class ExperiencePickupCallbacks { getBlock(progress: number) { return new Block3D( - progress > 0.6 ? FG_BOLD : SWATCH_EXP[1], - progress > 0.6 ? FG_TEXT : SWATCH_EXP[0], - progress > 0.6 ? FG_BOLD : SWATCH_EXP[1], + progress > 0.6 ? C.FG_BOLD : C.SWATCH_EXP[1], + progress > 0.6 ? C.FG_TEXT : C.SWATCH_EXP[0], + progress > 0.6 ? C.FG_BOLD : C.SWATCH_EXP[1], ); } @@ -608,7 +608,7 @@ export class ThrallCollectionPlatePickup { D.drawRect( gridArt.project(0).offset(new Point(-18, -18)), new Size(36, 36), - FG_TEXT, + C.FG_TEXT, ); } else { D.drawSprite(data.sprite, gridArt.project(2), 3, { diff --git a/src/skillsmodal.ts b/src/skillsmodal.ts index 234a213..d8fa248 100644 --- a/src/skillsmodal.ts +++ b/src/skillsmodal.ts @@ -2,16 +2,11 @@ import { getPartLocation, withCamera } from "./layout.ts"; import { AlignX, Point, Rect, Size } from "./engine/datatypes.ts"; import { DrawPile } from "./drawpile.ts"; import { D } from "./engine/public.ts"; -import { - BG_INSET, - FG_BOLD, - FG_TEXT_DISABLED, - FG_TEXT_ENDORSED, -} from "./colors.ts"; import { addButton } from "./button.ts"; import { getSkills } from "./skills.ts"; import { getPlayerProgress } from "./playerprogress.ts"; import { Skill, SkillData } from "./datatypes.ts"; +import { C } from "./colors.ts"; export class SkillsModal { #drawpile: DrawPile; @@ -50,7 +45,7 @@ export class SkillsModal { this.#drawpile.clear(); let size = this.#size; this.#drawpile.add(0, () => { - D.fillRect(new Point(-4, -4), size.add(new Size(8, 8)), BG_INSET); + D.fillRect(new Point(-4, -4), size.add(new Size(8, 8)), C.BG_INSET); }); // draw skills @@ -71,24 +66,24 @@ export class SkillsModal { 0, (hover) => { // two column layout - let [bg, fg] = [BG_INSET, FG_BOLD]; + let [bg, fg] = [C.BG_INSET, C.FG_BOLD]; let overpriced = getSkills().computeCost(skill) > getPlayerProgress().getExperience(); let atMinimum = getSkills().isAtMinimum(skill); if (overpriced) { - fg = FG_TEXT_DISABLED; + fg = C.FG_TEXT_DISABLED; } else if (atMinimum) { - fg = FG_TEXT_ENDORSED; + fg = C.FG_TEXT_ENDORSED; } if (selected || hover) { - [bg, fg] = [FG_BOLD, BG_INSET]; + [bg, fg] = [C.FG_BOLD, C.BG_INSET]; if (overpriced) { // still use the same BG, for contrast } else if (atMinimum) { - bg = FG_TEXT_ENDORSED; + bg = C.FG_TEXT_ENDORSED; } } D.fillRect(skillRect.top, skillRect.size, bg); @@ -117,8 +112,8 @@ export class SkillsModal { let remainingWidth = size.w - 160; this.#drawpile.add(0, () => { - D.fillRect(new Point(160, 0), new Size(remainingWidth, 96), FG_BOLD); - D.drawText(createFullDescription(data), new Point(164, 0), BG_INSET, { + D.fillRect(new Point(160, 0), new Size(remainingWidth, 96), C.FG_BOLD); + D.drawText(createFullDescription(data), new Point(164, 0), C.BG_INSET, { forceWidth: remainingWidth - 8, }); }); diff --git a/src/vnmodal.ts b/src/vnmodal.ts index 1f79f13..7afd81a 100644 --- a/src/vnmodal.ts +++ b/src/vnmodal.ts @@ -1,8 +1,8 @@ import { D, I } from "./engine/public.ts"; import { AlignX, AlignY, Point } from "./engine/datatypes.ts"; -import { FG_BOLD } from "./colors.ts"; import { withCamera } from "./layout.ts"; import { VNScene, VNSceneMessage, VNScenePart } from "./vnscene.ts"; +import { C } from "./colors.ts"; const WIDTH = 384; const HEIGHT = 384; @@ -119,11 +119,16 @@ class SceneMessageCathexis { } draw() { - D.drawText(this.#message.text, new Point(WIDTH / 2, HEIGHT / 2), FG_BOLD, { - alignX: AlignX.Center, - alignY: AlignY.Middle, - forceWidth: WIDTH, - }); + D.drawText( + this.#message.text, + new Point(WIDTH / 2, HEIGHT / 2), + C.FG_BOLD, + { + alignX: AlignX.Center, + alignY: AlignY.Middle, + forceWidth: WIDTH, + }, + ); } } diff --git a/src/world3d.ts b/src/world3d.ts index 13074d0..e193feb 100644 --- a/src/world3d.ts +++ b/src/world3d.ts @@ -1,12 +1,7 @@ import { Color, Grid, Point, Rect, Size } from "./engine/datatypes.ts"; import { DrawPile } from "./drawpile.ts"; import { GridArt } from "./gridart.ts"; -import { - BG_CEILING, - BG_WALL_OR_UNREVEALED, - FG_BOLD, - FG_TEXT, -} from "./colors.ts"; +import { C } from "./colors.ts"; export class World3D { #grid: Grid; @@ -27,7 +22,7 @@ export class World3D { if (here == null) { drawpile.add(OFFSET_TOP, () => { - gridArt.drawCeiling(BG_CEILING); + gridArt.drawCeiling(C.BG_CEILING); }); return; } @@ -135,6 +130,6 @@ export class Block3D { } static standardWall(): Block3D { - return new Block3D(FG_BOLD, FG_TEXT, BG_WALL_OR_UNREVEALED); + return new Block3D(C.FG_BOLD, C.FG_TEXT, C.BG_WALL_OR_UNREVEALED); } }