diff options
| author | LLLL Colonq <llll@colonq> | 2026-08-26 23:47:59 -0400 |
|---|---|---|
| committer | LLLL Colonq <llll@colonq> | 2026-08-26 23:47:59 -0400 |
| commit | 0d2d8cd897e94bd94e0b3ae7c6ce9aa580a44a0a (patch) | |
| tree | e9039d1c3aedca515d6cb499451d4b73aca4f5fd /2026/games/crm148/view.js | |
| parent | 242943e5b023ce40eb3be826c418a478d4672f78 (diff) | |
Add a_tension_span
Diffstat (limited to '2026/games/crm148/view.js')
| -rw-r--r-- | 2026/games/crm148/view.js | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/2026/games/crm148/view.js b/2026/games/crm148/view.js deleted file mode 100644 index 1d2fb5c..0000000 --- a/2026/games/crm148/view.js +++ /dev/null @@ -1,32 +0,0 @@ - -import Vec2 from './vec2.js'; - -class View { - center = Vec2.zero(); - zoom = 1.0; - - // Convert game coordinate to canvas coordinate - project(vec2) { - return new Vec2( - (gameCanvas.width / 2) + ((vec2.x - this.center.x) * this.zoom), - (gameCanvas.height / 2) - ((vec2.y - this.center.y) * this.zoom)); - } - // Covert canvas coordinate to game coordinate - unproject(vec2) { - return new Vec2( - this.center.x + (vec2.x - (gameCanvas.width / 2)) / this.zoom, - this.center.y - (vec2.y - (gameCanvas.height/2)) / this.zoom); - } -} - -function globalView() { - return gView; -} - -var gView = new View(); -window.view = gView; - -export { - View, - globalView, -} |
