Skip to content

Commit 4a19d7d

Browse files
committed
Initial run at a hitbox editor, not quite finished
1 parent 0f6d7cc commit 4a19d7d

10 files changed

Lines changed: 1930 additions & 0 deletions

File tree

arcade/cli/cli.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,8 @@ def run(self) -> int:
5454
def run_arcade_cli():
5555
cli = CLI()
5656
cli.register_command(InfoCommand)
57+
58+
from arcade.hitbox_editor.commands import HitBoxEditorCommand
59+
cli.register_command(HitBoxEditorCommand)
60+
5761
return cli.run()

arcade/hitbox_editor/__init__.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"""HitBox Editor - A visual tool for creating and editing sprite hitbox regions."""
2+
3+
from __future__ import annotations
4+
5+
from pathlib import Path
6+
7+
8+
def run_editor(
9+
texture_path: str | Path | None = None,
10+
hitbox_path: str | Path | None = None,
11+
width: int = 1280,
12+
height: int = 720,
13+
) -> int:
14+
"""Launch the HitBox Editor application.
15+
16+
Args:
17+
texture_path: Optional path to a texture image file to load on startup.
18+
hitbox_path: Optional path to an existing hitbox JSON file to load.
19+
width: Window width in pixels.
20+
height: Window height in pixels.
21+
22+
Returns:
23+
Exit code (0 for success).
24+
"""
25+
import arcade
26+
from arcade.hitbox_editor.app import HitBoxEditorView
27+
28+
window = arcade.Window(width, height, "HitBox Editor", resizable=True)
29+
view = HitBoxEditorView(texture_path=texture_path, hitbox_path=hitbox_path)
30+
window.show_view(view)
31+
arcade.run()
32+
return 0

0 commit comments

Comments
 (0)