Skip to content

画面を散らかす効果(肉球の足跡・爪とぎ跡)を追加#8

Merged
winebarrel merged 2 commits into
mainfrom
add-litter-effects
Jul 12, 2026
Merged

画面を散らかす効果(肉球の足跡・爪とぎ跡)を追加#8
winebarrel merged 2 commits into
mainfrom
add-litter-effects

Conversation

@winebarrel

Copy link
Copy Markdown
Owner

概要

猫が画面を散らかす効果を2種類追加しました。どちらもメニューから個別にON/OFFでき、初期状態では両方OFFです。

  • 肉球の足跡(Paw Prints): 走行中に一定距離ごと、進行方向へ向きを合わせて左右交互に落とす
  • 爪とぎ跡(Scratch Marks): 爪とぎ(togi)中に平行な引っかき線を落とす

跡は猫の1つ下のレベルに置いた全画面クリックスルーの透明オーバーレイパネルに CGContext で手描きし、寿命(肉球12秒・爪とぎ20秒)で徐々にフェードして消えます。最大400個で古いものから破棄。

実装

  • Neco/Litter.swift(新規): LitterField(跡の生成・寿命管理)と LitterView(描画)
  • Neco/NecoApp.swift: 全画面オーバーレイパネルの生成、メニュー項目(Paw Prints / Scratch Marks / Clear Mess)、UserDefaults による状態の永続化、画面構成変更への追従
  • Neco/Neko.swift: isRunning / isClawing を公開。chooseAfterStop を「画面端では従来どおり togi、端でなくても Tuning.togiChance(50%)でランダムに togi」に変更

レビュー

crit で重ね掛けレビュー(司令塔+独立3観点)を実施し、確定した2件を修正済み:

  • lastPawPos の初期値 .zero により起動直後に暴発していた最初の足跡を修正(optional化してシード)
  • togi ランダム化に伴い実態とズレていた isClawing のコメントを修正

パフォーマンス系(全画面再描画の dirtyRect 化ほか)は指摘として記録し、今回は見送り。

確認

  • ビルド成功(xcodebuild
  • swiftformat / swiftlint クリーン

🤖 Generated with Claude Code

winebarrel and others added 2 commits July 12, 2026 15:05
The cat now drops paw prints while running and scratch marks while
scratching (togi), drawn on a full-screen click-through overlay panel
that sits just below the cat. Marks fade over their lifetime and are
capped to bound memory.

togi fires at screen edges as before, plus a 50% chance on any stop away
from a wall. Both effects are off by default and toggled from the menu
(Paw Prints / Scratch Marks / Clear Mess), with state persisted in
UserDefaults.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pp772scLq2mo9cDaybWrLu
Address two correctness findings from the crit review:

- lastPawPos was initialized to .zero, so the very first running frame
  (the cat starts in .running near the cursor, far from the origin)
  dropped a paw print immediately, ignoring the spacing rule and using
  the heading-0 fallback angle. Make it optional and seed it on the
  first running frame so the first step drops no print.
- isClawing's doc still claimed scratch marks stay limited to walls,
  but togiChance now triggers togi at random stops anywhere. Update the
  comment to match.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pp772scLq2mo9cDaybWrLu

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

猫が画面上に「肉球の足跡」と「爪とぎ跡」を残す“散らかす”演出を追加し、全画面のクリック透過オーバーレイに CGContext で描画して一定時間でフェードアウトさせることで、デスクトップペットとしての表現を強化するPRです。

Changes:

  • LitterField / LitterView を新規追加し、足跡・爪とぎ跡の生成、寿命管理、描画を実装
  • NecoApp に全画面オーバーレイパネルとメニュー項目(ON/OFF、Clear)および UserDefaults 永続化を追加
  • Neko 側に「走行中 / 爪とぎ中」状態の公開と、停止後にランダムで togi へ遷移するロジックを追加

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
Neco/Neko.swift isRunning / isClawing の公開と、停止後に確率で togi へ遷移する挙動を追加
Neco/NecoApp.swift 足跡/爪とぎ跡用の全画面オーバーレイパネル、メニュー操作、UserDefaults 永続化、画面構成変更追従を追加
Neco/Litter.swift マーク生成・寿命管理(LitterField)と描画(LitterView)を新規実装

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@winebarrel
winebarrel merged commit a2c7e45 into main Jul 12, 2026
4 checks passed
@winebarrel
winebarrel deleted the add-litter-effects branch July 12, 2026 06:23
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.

2 participants