mirror of
https://github.com/shadoll/dev.shadoll.git
synced 2026-08-28 03:26:56 +00:00
- Introduced a new logo system consisting of individual letter SVG icons for "shadolldev". - Implemented LogoController to manage the floating logo word, including physics for movement and collisions with entities. - Added LogoLetter class to handle individual letter behavior, including ejection and reattachment based on collisions. - Integrated logo functionality into the main application flow, ensuring it initializes alongside the evolution system. - Enhanced settings to control debug visibility for letter hit counts. - Created styles for the logo letters, including animations for ejection and hit effects. - Updated constants to define logo-related parameters such as letter size, speed, and collision properties.
57 lines
2.4 KiB
JavaScript
57 lines
2.4 KiB
JavaScript
/**
|
|
* main.js
|
|
* Application entry point.
|
|
*
|
|
* Responsibilities:
|
|
* - Instantiate all controllers
|
|
* - Wire the settings button to the modal
|
|
* - Kick off the gradient and evolution system
|
|
*
|
|
* Keep this file thin — business logic lives in the controllers.
|
|
*/
|
|
|
|
import { GradientController } from './gradient.js';
|
|
import { ModalController } from './modal.js';
|
|
import { SettingsController } from './settings.js';
|
|
import { EvolutionController } from './evolution.js';
|
|
import { GuideController } from './guide.js';
|
|
import { LogoController } from './logoController.js';
|
|
import { DEFAULTS } from './constants.js';
|
|
|
|
// ── Initialise controllers ─────────────────────────────────
|
|
const gradient = new GradientController();
|
|
const modal = new ModalController();
|
|
const evolution = new EvolutionController();
|
|
const guide = new GuideController();
|
|
|
|
// SettingsController bridges UI → gradient + evolution
|
|
const settings = new SettingsController(gradient, evolution);
|
|
|
|
// ── Wire up settings button ────────────────────────────────
|
|
document.getElementById('settingsBtn').addEventListener('click', (e) => {
|
|
modal.open(/** @type {HTMLElement} */ (e.currentTarget));
|
|
});
|
|
|
|
// ── Wire up evolution guide ────────────────────────────────
|
|
guide.init(evolution);
|
|
|
|
// ── Boot gradient ──────────────────────────────────────────
|
|
gradient.init(DEFAULTS.GRADIENT_COLOR);
|
|
|
|
// Apply saved settings after gradient has set its defaults
|
|
settings.loadSaved();
|
|
|
|
// ── Boot logo + evolution ──────────────────────────────────
|
|
// Sequence: evolution.init() → reads localStorage (populates savedLogoState)
|
|
// logo.init(savedLogoState) → mounts letters, restores state
|
|
// setLogoController(logo) → arms per-tick calls
|
|
const logo = new LogoController();
|
|
const container = document.getElementById('evolutionContainer');
|
|
|
|
evolution.init(container)
|
|
.then(() => logo.init(container, evolution.savedLogoState))
|
|
.then(() => {
|
|
evolution.setLogoController(logo);
|
|
settings.setLogoController(logo);
|
|
});
|