Reorganize source into playscii/ package
Move all root .py files into playscii/ package directory. Rename playscii.py to app.py, add __main__.py entry point. Convert bare imports to relative (within package) and absolute (in formats/ and games/). Data dirs stay at root.
This commit is contained in:
parent
c0621ff717
commit
4f8b009a71
89 changed files with 276 additions and 257 deletions
|
|
@ -7,7 +7,7 @@ we maintain our own git repo.
|
||||||
|
|
||||||
running
|
running
|
||||||
-------
|
-------
|
||||||
just run launch the app (uv run python playscii.py)
|
just run launch the app (uv run python -m playscii)
|
||||||
just check lint gate (ruff check + format)
|
just check lint gate (ruff check + format)
|
||||||
just lint ruff check --fix + ruff format
|
just lint ruff check --fix + ruff format
|
||||||
just typecheck ty check (601 errors, legacy code, not in check gate)
|
just typecheck ty check (601 errors, legacy code, not in check gate)
|
||||||
|
|
@ -16,14 +16,19 @@ running
|
||||||
|
|
||||||
project structure
|
project structure
|
||||||
-----------------
|
-----------------
|
||||||
all python source lives at the repo root (no src/ layout)
|
python source organized as playscii/ package (~50 .py files)
|
||||||
~50 .py files, flat structure, no packages
|
data directories (charsets/, palettes/, etc.) live at repo root
|
||||||
|
formats/ and games/ also at root (loaded dynamically via importlib)
|
||||||
|
|
||||||
|
playscii/
|
||||||
|
__init__.py package marker
|
||||||
|
__main__.py entry point for python -m playscii
|
||||||
|
app.py main application, SDL2/OpenGL setup (was playscii.py)
|
||||||
|
art.py art/canvas management, the core data model
|
||||||
|
ui*.py ~20 UI modules (dialogs, panels, menus, toolbar, etc.)
|
||||||
|
game_*.py game engine (objects, rooms, world, HUD)
|
||||||
|
renderable*.py rendering pipeline (sprites, lines, framebuffer)
|
||||||
|
|
||||||
playscii.py main entry point, app init, SDL2/OpenGL setup
|
|
||||||
art.py art/canvas management, the core data model
|
|
||||||
ui*.py ~20 UI modules (dialogs, panels, menus, toolbar, etc.)
|
|
||||||
game_*.py game engine (objects, rooms, world, HUD)
|
|
||||||
renderable*.py rendering pipeline (sprites, lines, framebuffer)
|
|
||||||
formats/ import/export handlers (ANS, ATA, BMP, EDSCII, PNG, GIF, TXT)
|
formats/ import/export handlers (ANS, ATA, BMP, EDSCII, PNG, GIF, TXT)
|
||||||
games/ bundled example games (crawler, fireplace, flood, maze, shmup, etc.)
|
games/ bundled example games (crawler, fireplace, flood, maze, shmup, etc.)
|
||||||
charsets/ 30+ classic computer character sets (.char + .png)
|
charsets/ 30+ classic computer character sets (.char + .png)
|
||||||
|
|
@ -44,6 +49,12 @@ dependencies
|
||||||
|
|
||||||
gotchas
|
gotchas
|
||||||
-------
|
-------
|
||||||
|
package structure:
|
||||||
|
all python source now lives in playscii/ package. files use relative
|
||||||
|
imports (from .art import ...). formats/ and games/ use absolute imports
|
||||||
|
(from playscii.art import ...). data directories stay at root since the
|
||||||
|
app uses CWD-relative paths to load charsets, shaders, etc.
|
||||||
|
|
||||||
art scripts and exec():
|
art scripts and exec():
|
||||||
art.py imports random at module level with a noqa comment. art scripts
|
art.py imports random at module level with a noqa comment. art scripts
|
||||||
(.arsc files) are loaded via exec() in art.py's scope. they use random
|
(.arsc files) are loaded via exec() in art.py's scope. they use random
|
||||||
|
|
@ -52,14 +63,14 @@ gotchas
|
||||||
in art.py — check before removing anything.
|
in art.py — check before removing anything.
|
||||||
|
|
||||||
pdoc detection:
|
pdoc detection:
|
||||||
playscii.py has a contextlib.suppress block that tries to import pdoc.
|
app.py has a contextlib.suppress block that tries to import pdoc.
|
||||||
the import MUST stay inside the suppress block. if it gets moved or
|
the import MUST stay inside the suppress block. if it gets moved or
|
||||||
removed, pdoc_available becomes unconditionally True and the help menu
|
removed, pdoc_available becomes unconditionally True and the help menu
|
||||||
breaks when pdoc isn't installed.
|
breaks when pdoc isn't installed.
|
||||||
|
|
||||||
SDL2 init ordering:
|
SDL2 init ordering:
|
||||||
many modules import from playscii.py's namespace or expect SDL2 to be
|
many modules import from app.py's namespace or expect SDL2 to be
|
||||||
initialized before they run. import order in playscii.py matters — E402
|
initialized before they run. import order in app.py matters — E402
|
||||||
is disabled for this reason.
|
is disabled for this reason.
|
||||||
|
|
||||||
mutable default arguments:
|
mutable default arguments:
|
||||||
|
|
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,6 +1,7 @@
|
||||||
venv/*.*
|
venv/*.*
|
||||||
dist/*.*
|
dist/*.*
|
||||||
build/*.*
|
build/*.*
|
||||||
|
playscii/__pycache__/*.*
|
||||||
__pycache__/*.*
|
__pycache__/*.*
|
||||||
.idea/*.*
|
.idea/*.*
|
||||||
playscii.profile
|
playscii.profile
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from art_import import ArtImporter
|
from playscii.art_import import ArtImporter
|
||||||
|
|
||||||
DEFAULT_FG, DEFAULT_BG = 7, 0
|
DEFAULT_FG, DEFAULT_BG = 7, 0
|
||||||
WIDTH = 80
|
WIDTH = 80
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from art_import import ArtImporter
|
from playscii.art_import import ArtImporter
|
||||||
|
|
||||||
# import as white on black for ease of edit + export
|
# import as white on black for ease of edit + export
|
||||||
DEFAULT_FG, DEFAULT_BG = 113, 1
|
DEFAULT_FG, DEFAULT_BG = 113, 1
|
||||||
|
|
|
||||||
|
|
@ -4,14 +4,13 @@
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
from playscii.art import DEFAULT_CHARSET, DEFAULT_HEIGHT, DEFAULT_PALETTE, DEFAULT_WIDTH
|
||||||
from art import DEFAULT_CHARSET, DEFAULT_HEIGHT, DEFAULT_PALETTE, DEFAULT_WIDTH
|
from playscii.art_import import ArtImporter
|
||||||
from art_import import ArtImporter
|
from playscii.image_convert import ImageConverter
|
||||||
from image_convert import ImageConverter
|
from playscii.palette import PaletteFromFile
|
||||||
from palette import PaletteFromFile
|
from playscii.ui_art_dialog import ImportOptionsDialog
|
||||||
from ui_art_dialog import ImportOptionsDialog
|
from playscii.ui_dialog import Field, UIDialog
|
||||||
from ui_dialog import Field, UIDialog
|
from playscii.ui_file_chooser_dialog import ImageFileChooserDialog
|
||||||
from ui_file_chooser_dialog import ImageFileChooserDialog
|
|
||||||
|
|
||||||
# custom chooser showing image previews, shares parent w/ "palette from image"
|
# custom chooser showing image previews, shares parent w/ "palette from image"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,11 @@
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from formats.in_bitmap import (
|
from formats.in_bitmap import (
|
||||||
BitmapImageImporter,
|
BitmapImageImporter,
|
||||||
ConvertImageChooserDialog,
|
ConvertImageChooserDialog,
|
||||||
ConvertImageOptionsDialog,
|
ConvertImageOptionsDialog,
|
||||||
)
|
)
|
||||||
from image_convert import ImageConverter
|
from playscii.image_convert import ImageConverter
|
||||||
from ui_dialog import Field, SkipFieldType, UIDialog
|
from playscii.ui_dialog import Field, SkipFieldType, UIDialog
|
||||||
|
|
||||||
|
|
||||||
class TwoColorConvertImageOptionsDialog(ConvertImageOptionsDialog):
|
class TwoColorConvertImageOptionsDialog(ConvertImageOptionsDialog):
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import os
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import formats.in_bitmap as bm
|
import formats.in_bitmap as bm
|
||||||
import image_convert
|
from playscii import image_convert
|
||||||
|
|
||||||
|
|
||||||
class ImageSequenceConverter:
|
class ImageSequenceConverter:
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
from art_import import ArtImporter
|
from playscii.art_import import ArtImporter
|
||||||
from ui_art_dialog import ImportOptionsDialog
|
from playscii.ui_art_dialog import ImportOptionsDialog
|
||||||
from ui_dialog import Field, UIDialog
|
from playscii.ui_dialog import Field, UIDialog
|
||||||
|
|
||||||
|
|
||||||
class EDSCIIImportOptionsDialog(ImportOptionsDialog):
|
class EDSCIIImportOptionsDialog(ImportOptionsDialog):
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from art_import import ArtImporter
|
from playscii.art_import import ArtImporter
|
||||||
|
|
||||||
|
|
||||||
class EndDoomImporter(ArtImporter):
|
class EndDoomImporter(ArtImporter):
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from art_import import ArtImporter
|
from playscii.art_import import ArtImporter
|
||||||
|
|
||||||
|
|
||||||
class TextImporter(ArtImporter):
|
class TextImporter(ArtImporter):
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from art_export import ArtExporter
|
from playscii.art_export import ArtExporter
|
||||||
|
|
||||||
WIDTH = 80
|
WIDTH = 80
|
||||||
ENCODING = "cp1252" # old default
|
ENCODING = "cp1252" # old default
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
from art import TileIter
|
from playscii.art import TileIter
|
||||||
from art_export import ArtExporter
|
from playscii.art_export import ArtExporter
|
||||||
|
|
||||||
|
|
||||||
class ANSExporter(ArtExporter):
|
class ANSExporter(ArtExporter):
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from art_export import ArtExporter
|
from playscii.art_export import ArtExporter
|
||||||
|
|
||||||
WIDTH, HEIGHT = 80, 25
|
WIDTH, HEIGHT = 80, 25
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
from art_export import ArtExporter
|
from playscii.art_export import ArtExporter
|
||||||
from image_export import export_animation
|
from playscii.image_export import export_animation
|
||||||
|
|
||||||
|
|
||||||
class GIFExporter(ArtExporter):
|
class GIFExporter(ArtExporter):
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from art_export import ArtExporter
|
from playscii.art_export import ArtExporter
|
||||||
from image_export import export_still_image
|
from playscii.image_export import export_still_image
|
||||||
from ui_art_dialog import ExportOptionsDialog
|
from playscii.ui_art_dialog import ExportOptionsDialog
|
||||||
from ui_dialog import Field, UIDialog
|
from playscii.ui_dialog import Field, UIDialog
|
||||||
|
|
||||||
DEFAULT_SCALE = 4
|
DEFAULT_SCALE = 4
|
||||||
DEFAULT_CRT = True
|
DEFAULT_CRT = True
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from art_export import ArtExporter
|
from playscii.art_export import ArtExporter
|
||||||
from image_export import export_still_image
|
from playscii.image_export import export_still_image
|
||||||
from renderable import LAYER_VIS_FULL, LAYER_VIS_NONE
|
from playscii.renderable import LAYER_VIS_FULL, LAYER_VIS_NONE
|
||||||
from ui_art_dialog import ExportOptionsDialog
|
from playscii.ui_art_dialog import ExportOptionsDialog
|
||||||
from ui_dialog import Field, UIDialog
|
from playscii.ui_dialog import Field, UIDialog
|
||||||
|
|
||||||
FILE_EXTENSION = "png"
|
FILE_EXTENSION = "png"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from art_export import ArtExporter
|
from playscii.art_export import ArtExporter
|
||||||
|
|
||||||
|
|
||||||
class TextExporter(ArtExporter):
|
class TextExporter(ArtExporter):
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from game_object import GameObject
|
from playscii.game_object import GameObject
|
||||||
|
|
||||||
# initial work: 2019-02-17 and 18
|
# initial work: 2019-02-17 and 18
|
||||||
# FP view research: 2021-11-22
|
# FP view research: 2021-11-22
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import vector
|
from playscii import vector
|
||||||
from game_object import GameObject
|
from playscii.game_object import GameObject
|
||||||
from renderable_line import DebugLineRenderable
|
from playscii.renderable_line import DebugLineRenderable
|
||||||
|
|
||||||
# stuff for troubleshooting "get tiles intersecting line" etc
|
# stuff for troubleshooting "get tiles intersecting line" etc
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
from game_util_objects import Player
|
|
||||||
from games.crawler.scripts.crawler import (
|
from games.crawler.scripts.crawler import (
|
||||||
DIR_EAST,
|
DIR_EAST,
|
||||||
DIR_NAMES,
|
DIR_NAMES,
|
||||||
|
|
@ -9,6 +8,7 @@ from games.crawler.scripts.crawler import (
|
||||||
OPPOSITE_DIRS,
|
OPPOSITE_DIRS,
|
||||||
RIGHT_TURN_DIRS,
|
RIGHT_TURN_DIRS,
|
||||||
)
|
)
|
||||||
|
from playscii.game_util_objects import Player
|
||||||
|
|
||||||
|
|
||||||
class CrawlPlayer(Player):
|
class CrawlPlayer(Player):
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
from art import TileIter
|
|
||||||
from game_object import GameObject
|
|
||||||
from games.crawler.scripts.crawler import (
|
from games.crawler.scripts.crawler import (
|
||||||
DIR_EAST,
|
DIR_EAST,
|
||||||
DIR_NORTH,
|
DIR_NORTH,
|
||||||
DIR_SOUTH,
|
DIR_SOUTH,
|
||||||
DIR_WEST,
|
DIR_WEST,
|
||||||
)
|
)
|
||||||
from vector import get_tiles_along_integer_line
|
from playscii.art import TileIter
|
||||||
|
from playscii.game_object import GameObject
|
||||||
|
from playscii.vector import get_tiles_along_integer_line
|
||||||
|
|
||||||
|
|
||||||
class CrawlTopDownView(GameObject):
|
class CrawlTopDownView(GameObject):
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,9 @@
|
||||||
from game_util_objects import DynamicBoxObject, Pickup, StaticTileObject, TopDownPlayer
|
from playscii.game_util_objects import (
|
||||||
|
DynamicBoxObject,
|
||||||
|
Pickup,
|
||||||
|
StaticTileObject,
|
||||||
|
TopDownPlayer,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class CronoPlayer(TopDownPlayer):
|
class CronoPlayer(TopDownPlayer):
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,8 @@ import os
|
||||||
import webbrowser
|
import webbrowser
|
||||||
from random import choice, randint
|
from random import choice, randint
|
||||||
|
|
||||||
from art import TileIter
|
from playscii.art import TileIter
|
||||||
from game_object import GameObject
|
from playscii.game_object import GameObject
|
||||||
|
|
||||||
#
|
#
|
||||||
# some tuning knobs
|
# some tuning knobs
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from random import choice
|
from random import choice
|
||||||
|
|
||||||
from art import TileIter
|
from playscii.art import TileIter
|
||||||
from game_object import GameObject
|
from playscii.game_object import GameObject
|
||||||
|
|
||||||
# TODO:
|
# TODO:
|
||||||
# solver? https://stackoverflow.com/questions/1430962/how-to-optimally-solve-the-flood-fill-puzzle
|
# solver? https://stackoverflow.com/questions/1430962/how-to-optimally-solve-the-flood-fill-puzzle
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from game_hud import GameHUD, GameHUDRenderable
|
from playscii.game_hud import GameHUD, GameHUDRenderable
|
||||||
|
|
||||||
|
|
||||||
class MazeHUD(GameHUD):
|
class MazeHUD(GameHUD):
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
import math
|
import math
|
||||||
import random
|
import random
|
||||||
|
|
||||||
from art import TileIter
|
from playscii.art import TileIter
|
||||||
from collision import (
|
from playscii.collision import (
|
||||||
CST_CIRCLE,
|
CST_CIRCLE,
|
||||||
CST_TILE,
|
CST_TILE,
|
||||||
CT_GENERIC_DYNAMIC,
|
CT_GENERIC_DYNAMIC,
|
||||||
CT_GENERIC_STATIC,
|
CT_GENERIC_STATIC,
|
||||||
CT_NONE,
|
CT_NONE,
|
||||||
)
|
)
|
||||||
from game_object import GameObject
|
from playscii.game_object import GameObject
|
||||||
from game_util_objects import Player, StaticTileBG
|
from playscii.game_util_objects import Player, StaticTileBG
|
||||||
|
|
||||||
|
|
||||||
class MazeBG(StaticTileBG):
|
class MazeBG(StaticTileBG):
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import math
|
import math
|
||||||
|
|
||||||
from game_util_objects import BlobShadow, Player
|
|
||||||
from games.maze.scripts.rooms import OutsideRoom
|
from games.maze.scripts.rooms import OutsideRoom
|
||||||
|
from playscii.game_util_objects import BlobShadow, Player
|
||||||
|
|
||||||
|
|
||||||
class PlayerBlobShadow(BlobShadow):
|
class PlayerBlobShadow(BlobShadow):
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from game_room import GameRoom
|
from playscii.game_room import GameRoom
|
||||||
|
|
||||||
|
|
||||||
class MazeRoom(GameRoom):
|
class MazeRoom(GameRoom):
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import math
|
import math
|
||||||
import random
|
import random
|
||||||
|
|
||||||
from game_util_objects import Character, Player, StaticTileBG, WarpTrigger
|
from playscii.game_util_objects import Character, Player, StaticTileBG, WarpTrigger
|
||||||
|
|
||||||
|
|
||||||
class PlatformWorld(StaticTileBG):
|
class PlatformWorld(StaticTileBG):
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,14 @@
|
||||||
import math
|
import math
|
||||||
import random
|
import random
|
||||||
|
|
||||||
from game_object import GameObject
|
from playscii.game_object import GameObject
|
||||||
from game_util_objects import Character, ObjectSpawner, Player, Projectile, StaticTileBG
|
from playscii.game_util_objects import (
|
||||||
|
Character,
|
||||||
|
ObjectSpawner,
|
||||||
|
Player,
|
||||||
|
Projectile,
|
||||||
|
StaticTileBG,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class ShmupPlayer(Player):
|
class ShmupPlayer(Player):
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
import random
|
import random
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from art import ART_DIR, UV_FLIPX, UV_FLIPY, UV_ROTATE180
|
|
||||||
from game_object import GameObject
|
|
||||||
from games.wildflowers.scripts.frond import Frond
|
from games.wildflowers.scripts.frond import Frond
|
||||||
from games.wildflowers.scripts.petal import Petal
|
from games.wildflowers.scripts.petal import Petal
|
||||||
from games.wildflowers.scripts.ramps import PALETTE_RAMPS
|
from games.wildflowers.scripts.ramps import PALETTE_RAMPS
|
||||||
from renderable import TileRenderable
|
from playscii.art import ART_DIR, UV_FLIPX, UV_FLIPY, UV_ROTATE180
|
||||||
|
from playscii.game_object import GameObject
|
||||||
|
from playscii.renderable import TileRenderable
|
||||||
|
|
||||||
# TODO: random size range?
|
# TODO: random size range?
|
||||||
# (should also change camera zoom, probably frond/petal counts)
|
# (should also change camera zoom, probably frond/petal counts)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
from game_util_objects import GameObject, WorldGlobalsObject
|
from playscii.game_util_objects import GameObject, WorldGlobalsObject
|
||||||
from image_export import export_still_image
|
from playscii.image_export import export_still_image
|
||||||
|
|
||||||
"""
|
"""
|
||||||
overall approach:
|
overall approach:
|
||||||
|
|
|
||||||
2
justfile
2
justfile
|
|
@ -11,4 +11,4 @@ test:
|
||||||
check: lint
|
check: lint
|
||||||
|
|
||||||
run:
|
run:
|
||||||
uv run python playscii.py
|
uv run python -m playscii
|
||||||
|
|
|
||||||
1
playscii/__init__.py
Normal file
1
playscii/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
# playscii package
|
||||||
9
playscii/__main__.py
Normal file
9
playscii/__main__.py
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from .app import get_app
|
||||||
|
|
||||||
|
app = get_app()
|
||||||
|
error = app.main_loop()
|
||||||
|
app.quit()
|
||||||
|
app.logger.close()
|
||||||
|
sys.exit(error)
|
||||||
|
|
@ -49,7 +49,7 @@ with contextlib.suppress(Exception):
|
||||||
pdoc_available = True
|
pdoc_available = True
|
||||||
|
|
||||||
# submodules - set here so cfg file can modify them all easily
|
# submodules - set here so cfg file can modify them all easily
|
||||||
from art import (
|
from .art import (
|
||||||
ART_DIR,
|
ART_DIR,
|
||||||
ART_FILE_EXTENSION,
|
ART_FILE_EXTENSION,
|
||||||
ART_SCRIPT_DIR,
|
ART_SCRIPT_DIR,
|
||||||
|
|
@ -61,25 +61,25 @@ from art import (
|
||||||
Art,
|
Art,
|
||||||
ArtFromDisk,
|
ArtFromDisk,
|
||||||
)
|
)
|
||||||
from art_export import ArtExporter
|
from .art_export import ArtExporter
|
||||||
from art_import import ArtImporter
|
from .art_import import ArtImporter
|
||||||
from audio import AudioLord
|
from .audio import AudioLord
|
||||||
from camera import Camera
|
from .camera import Camera
|
||||||
from charset import CHARSET_DIR, CharacterSet, CharacterSetLord
|
from .charset import CHARSET_DIR, CharacterSet, CharacterSetLord
|
||||||
from cursor import Cursor
|
from .cursor import Cursor
|
||||||
from framebuffer import Framebuffer
|
from .framebuffer import Framebuffer
|
||||||
from game_world import TOP_GAME_DIR, GameWorld
|
from .game_world import TOP_GAME_DIR, GameWorld
|
||||||
from grid import ArtGrid
|
from .grid import ArtGrid
|
||||||
from input_handler import InputLord
|
from .input_handler import InputLord
|
||||||
from palette import PALETTE_DIR, Palette, PaletteLord
|
from .palette import PALETTE_DIR, Palette, PaletteLord
|
||||||
from renderable import OnionTileRenderable, TileRenderable
|
from .renderable import OnionTileRenderable, TileRenderable
|
||||||
|
|
||||||
# some classes are imported only so the cfg file can modify their defaults
|
# some classes are imported only so the cfg file can modify their defaults
|
||||||
from renderable_line import DebugLineRenderable
|
from .renderable_line import DebugLineRenderable
|
||||||
from renderable_sprite import SpriteRenderable, UIBGTextureRenderable
|
from .renderable_sprite import SpriteRenderable, UIBGTextureRenderable
|
||||||
from shader import ShaderLord
|
from .shader import ShaderLord
|
||||||
from ui import OIS_WIDTH, UI
|
from .ui import OIS_WIDTH, UI
|
||||||
from ui_file_chooser_dialog import THUMBNAIL_CACHE_DIR
|
from .ui_file_chooser_dialog import THUMBNAIL_CACHE_DIR
|
||||||
|
|
||||||
APP_NAME = "Playscii"
|
APP_NAME = "Playscii"
|
||||||
VERSION_FILENAME = "version"
|
VERSION_FILENAME = "version"
|
||||||
|
|
@ -1145,7 +1145,8 @@ class Application:
|
||||||
return
|
return
|
||||||
for module_name in AUTOGEN_DOC_MODULES:
|
for module_name in AUTOGEN_DOC_MODULES:
|
||||||
# pdoc.pdoc takes module name as string, returns HTML doc string
|
# pdoc.pdoc takes module name as string, returns HTML doc string
|
||||||
html = pdoc.pdoc(module_name)
|
qualified_name = f"playscii.{module_name}"
|
||||||
|
html = pdoc.pdoc(qualified_name)
|
||||||
docfile = open(AUTOGEN_DOCS_PATH + module_name + ".html", "w")
|
docfile = open(AUTOGEN_DOCS_PATH + module_name + ".html", "w")
|
||||||
docfile.write(html)
|
docfile.write(html)
|
||||||
docfile.close()
|
docfile.close()
|
||||||
|
|
@ -1317,11 +1318,3 @@ def get_app():
|
||||||
autoplay_game,
|
autoplay_game,
|
||||||
)
|
)
|
||||||
return app
|
return app
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
app = get_app()
|
|
||||||
error = app.main_loop()
|
|
||||||
app.quit()
|
|
||||||
app.logger.close()
|
|
||||||
sys.exit(error)
|
|
||||||
|
|
@ -6,8 +6,8 @@ import traceback
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from edit_command import CommandStack, EntireArtCommand
|
from .edit_command import CommandStack, EntireArtCommand
|
||||||
from image_export import write_thumbnail
|
from .image_export import write_thumbnail
|
||||||
|
|
||||||
# X, Y, Z
|
# X, Y, Z
|
||||||
VERT_LENGTH = 3
|
VERT_LENGTH = 3
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from art import ART_DIR
|
from .art import ART_DIR
|
||||||
|
|
||||||
|
|
||||||
class ArtExporter:
|
class ArtExporter:
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import os
|
import os
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from art import ART_FILE_EXTENSION, DEFAULT_CHARSET, DEFAULT_PALETTE
|
from .art import ART_FILE_EXTENSION, DEFAULT_CHARSET, DEFAULT_PALETTE
|
||||||
from ui_file_chooser_dialog import GenericImportChooserDialog
|
from .ui_file_chooser_dialog import GenericImportChooserDialog
|
||||||
|
|
||||||
|
|
||||||
class ArtImporter:
|
class ArtImporter:
|
||||||
|
|
@ -2,7 +2,7 @@ import math
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
import vector
|
from . import vector
|
||||||
|
|
||||||
|
|
||||||
def clamp(val, lowest, highest):
|
def clamp(val, lowest, highest):
|
||||||
|
|
@ -4,7 +4,7 @@ import time
|
||||||
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
from texture import Texture
|
from .texture import Texture
|
||||||
|
|
||||||
CHARSET_DIR = "charsets/"
|
CHARSET_DIR = "charsets/"
|
||||||
CHARSET_FILE_EXTENSION = "char"
|
CHARSET_FILE_EXTENSION = "char"
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import math
|
import math
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
from renderable_line import (
|
from .renderable_line import (
|
||||||
BoxCollisionRenderable,
|
BoxCollisionRenderable,
|
||||||
CircleCollisionRenderable,
|
CircleCollisionRenderable,
|
||||||
TileBoxCollisionRenderable,
|
TileBoxCollisionRenderable,
|
||||||
|
|
@ -4,9 +4,9 @@ import math
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from OpenGL import GL
|
from OpenGL import GL
|
||||||
|
|
||||||
import vector
|
from . import vector
|
||||||
from edit_command import EditCommand
|
from .edit_command import EditCommand
|
||||||
from renderable_sprite import UISpriteRenderable
|
from .renderable_sprite import UISpriteRenderable
|
||||||
|
|
||||||
"""
|
"""
|
||||||
reference diagram:
|
reference diagram:
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
from art import Art
|
from .art import Art
|
||||||
from renderable import TileRenderable
|
from .renderable import TileRenderable
|
||||||
|
|
||||||
|
|
||||||
class GameHUDArt(Art):
|
class GameHUDArt(Art):
|
||||||
|
|
@ -2,9 +2,9 @@ import math
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
|
|
||||||
import vector
|
from . import vector
|
||||||
from art import ArtInstance
|
from .art import ArtInstance
|
||||||
from collision import (
|
from .collision import (
|
||||||
CST_AABB,
|
CST_AABB,
|
||||||
CST_CIRCLE,
|
CST_CIRCLE,
|
||||||
CST_NONE,
|
CST_NONE,
|
||||||
|
|
@ -15,8 +15,8 @@ from collision import (
|
||||||
Contact,
|
Contact,
|
||||||
point_in_box,
|
point_in_box,
|
||||||
)
|
)
|
||||||
from renderable import GameObjectRenderable
|
from .renderable import GameObjectRenderable
|
||||||
from renderable_line import BoundsIndicatorRenderable, OriginIndicatorRenderable
|
from .renderable_line import BoundsIndicatorRenderable, OriginIndicatorRenderable
|
||||||
|
|
||||||
# facings
|
# facings
|
||||||
GOF_LEFT = 0
|
GOF_LEFT = 0
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from game_object import GameObject
|
from .game_object import GameObject
|
||||||
|
|
||||||
|
|
||||||
class GameRoom:
|
class GameRoom:
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import os.path
|
import os.path
|
||||||
import random
|
import random
|
||||||
|
|
||||||
from collision import (
|
from .collision import (
|
||||||
CST_AABB,
|
CST_AABB,
|
||||||
CST_CIRCLE,
|
CST_CIRCLE,
|
||||||
CST_TILE,
|
CST_TILE,
|
||||||
|
|
@ -10,7 +10,7 @@ from collision import (
|
||||||
CT_NONE,
|
CT_NONE,
|
||||||
CT_PLAYER,
|
CT_PLAYER,
|
||||||
)
|
)
|
||||||
from game_object import FACING_DIRS, GameObject
|
from .game_object import FACING_DIRS, GameObject
|
||||||
|
|
||||||
|
|
||||||
class GameObjectAttachment(GameObject):
|
class GameObjectAttachment(GameObject):
|
||||||
|
|
@ -9,17 +9,12 @@ from collections import namedtuple
|
||||||
|
|
||||||
import sdl2
|
import sdl2
|
||||||
|
|
||||||
import collision
|
from . import collision, game_hud, game_object, game_room, game_util_objects, vector
|
||||||
import game_hud
|
from .art import ART_DIR
|
||||||
import game_object
|
from .camera import Camera
|
||||||
import game_room
|
from .charset import CHARSET_DIR
|
||||||
import game_util_objects
|
from .grid import GameGrid
|
||||||
import vector
|
from .palette import PALETTE_DIR
|
||||||
from art import ART_DIR
|
|
||||||
from camera import Camera
|
|
||||||
from charset import CHARSET_DIR
|
|
||||||
from grid import GameGrid
|
|
||||||
from palette import PALETTE_DIR
|
|
||||||
|
|
||||||
TOP_GAME_DIR = "games/"
|
TOP_GAME_DIR = "games/"
|
||||||
DEFAULT_STATE_FILENAME = "start"
|
DEFAULT_STATE_FILENAME = "start"
|
||||||
|
|
@ -29,8 +24,8 @@ SOUNDS_DIR = "sounds/"
|
||||||
|
|
||||||
# generic starter script with a GO and Player subclass
|
# generic starter script with a GO and Player subclass
|
||||||
STARTER_SCRIPT = """
|
STARTER_SCRIPT = """
|
||||||
from game_object import GameObject
|
from playscii.game_object import GameObject
|
||||||
from game_util_objects import Player
|
from playscii.game_util_objects import Player
|
||||||
|
|
||||||
|
|
||||||
class MyGamePlayer(Player):
|
class MyGamePlayer(Player):
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from renderable_line import LineRenderable
|
from .renderable_line import LineRenderable
|
||||||
|
|
||||||
# grid that displays as guide for Cursor
|
# grid that displays as guide for Cursor
|
||||||
|
|
||||||
|
|
@ -5,8 +5,8 @@ import time
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
from lab_color import lab_color_diff, rgb_to_lab
|
from .lab_color import lab_color_diff, rgb_to_lab
|
||||||
from renderable_sprite import SpriteRenderable
|
from .renderable_sprite import SpriteRenderable
|
||||||
|
|
||||||
"""
|
"""
|
||||||
notes / future research
|
notes / future research
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from OpenGL import GL
|
from OpenGL import GL
|
||||||
from PIL import GifImagePlugin, Image, ImageChops
|
from PIL import GifImagePlugin, Image, ImageChops
|
||||||
|
|
||||||
from framebuffer import ExportFramebuffer, ExportFramebufferNoCRT
|
from .framebuffer import ExportFramebuffer, ExportFramebufferNoCRT
|
||||||
|
|
||||||
|
|
||||||
def get_frame_image(app, art, frame, allow_crt=True, scale=1, bg_color=(0, 0, 0, 0)):
|
def get_frame_image(app, art, frame, allow_crt=True, scale=1, bg_color=(0, 0, 0, 0)):
|
||||||
|
|
@ -5,12 +5,12 @@ from sys import exit
|
||||||
|
|
||||||
import sdl2
|
import sdl2
|
||||||
|
|
||||||
from art import ART_DIR, ART_FILE_EXTENSION
|
from .art import ART_DIR, ART_FILE_EXTENSION
|
||||||
from collision import CT_NONE
|
from .collision import CT_NONE
|
||||||
from key_shifts import NUMLOCK_OFF_MAP, NUMLOCK_ON_MAP
|
from .key_shifts import NUMLOCK_OFF_MAP, NUMLOCK_ON_MAP
|
||||||
from renderable import LAYER_VIS_DIM, LAYER_VIS_FULL, LAYER_VIS_NONE
|
from .renderable import LAYER_VIS_DIM, LAYER_VIS_FULL, LAYER_VIS_NONE
|
||||||
from ui import OIS_FILL, OIS_HEIGHT, OIS_WIDTH, SCALE_INCREMENT
|
from .ui import OIS_FILL, OIS_HEIGHT, OIS_WIDTH, SCALE_INCREMENT
|
||||||
from ui_art_dialog import (
|
from .ui_art_dialog import (
|
||||||
AddFrameDialog,
|
AddFrameDialog,
|
||||||
AddLayerDialog,
|
AddLayerDialog,
|
||||||
CloseUnsavedChangesDialog,
|
CloseUnsavedChangesDialog,
|
||||||
|
|
@ -32,7 +32,7 @@ from ui_art_dialog import (
|
||||||
SetLayerNameDialog,
|
SetLayerNameDialog,
|
||||||
SetLayerZDialog,
|
SetLayerZDialog,
|
||||||
)
|
)
|
||||||
from ui_file_chooser_dialog import (
|
from .ui_file_chooser_dialog import (
|
||||||
ArtChooserDialog,
|
ArtChooserDialog,
|
||||||
CharSetChooserDialog,
|
CharSetChooserDialog,
|
||||||
OverlayImageFileChooserDialog,
|
OverlayImageFileChooserDialog,
|
||||||
|
|
@ -40,7 +40,7 @@ from ui_file_chooser_dialog import (
|
||||||
PaletteFromImageChooserDialog,
|
PaletteFromImageChooserDialog,
|
||||||
RunArtScriptDialog,
|
RunArtScriptDialog,
|
||||||
)
|
)
|
||||||
from ui_game_dialog import (
|
from .ui_game_dialog import (
|
||||||
AddRoomDialog,
|
AddRoomDialog,
|
||||||
NewGameDirDialog,
|
NewGameDirDialog,
|
||||||
RenameRoomDialog,
|
RenameRoomDialog,
|
||||||
|
|
@ -49,7 +49,7 @@ from ui_game_dialog import (
|
||||||
SetRoomCamDialog,
|
SetRoomCamDialog,
|
||||||
SetRoomEdgeWarpsDialog,
|
SetRoomEdgeWarpsDialog,
|
||||||
)
|
)
|
||||||
from ui_list_operations import (
|
from .ui_list_operations import (
|
||||||
LO_LOAD_STATE,
|
LO_LOAD_STATE,
|
||||||
LO_OPEN_GAME_DIR,
|
LO_OPEN_GAME_DIR,
|
||||||
LO_SELECT_OBJECTS,
|
LO_SELECT_OBJECTS,
|
||||||
|
|
@ -5,8 +5,8 @@ from random import randint
|
||||||
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
from lab_color import lab_color_diff, rgb_to_lab
|
from .lab_color import lab_color_diff, rgb_to_lab
|
||||||
from texture import Texture
|
from .texture import Texture
|
||||||
|
|
||||||
PALETTE_DIR = "palettes/"
|
PALETTE_DIR = "palettes/"
|
||||||
PALETTE_EXTENSIONS = ["png", "gif", "bmp"]
|
PALETTE_EXTENSIONS = ["png", "gif", "bmp"]
|
||||||
|
|
@ -4,8 +4,8 @@ import math
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from OpenGL import GL
|
from OpenGL import GL
|
||||||
|
|
||||||
from art import VERT_LENGTH
|
from .art import VERT_LENGTH
|
||||||
from palette import MAX_COLORS
|
from .palette import MAX_COLORS
|
||||||
|
|
||||||
# inactive layer alphas
|
# inactive layer alphas
|
||||||
LAYER_VIS_FULL = 1
|
LAYER_VIS_FULL = 1
|
||||||
|
|
@ -6,7 +6,7 @@ import time
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from OpenGL import GL
|
from OpenGL import GL
|
||||||
|
|
||||||
from renderable import TileRenderable
|
from .renderable import TileRenderable
|
||||||
|
|
||||||
|
|
||||||
class LineRenderable:
|
class LineRenderable:
|
||||||
|
|
@ -5,7 +5,7 @@ import numpy as np
|
||||||
from OpenGL import GL
|
from OpenGL import GL
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
from texture import Texture
|
from .texture import Texture
|
||||||
|
|
||||||
|
|
||||||
class SpriteRenderable:
|
class SpriteRenderable:
|
||||||
|
|
@ -2,7 +2,7 @@ import math
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from renderable_line import LineRenderable
|
from .renderable_line import LineRenderable
|
||||||
|
|
||||||
|
|
||||||
class SelectionRenderable(LineRenderable):
|
class SelectionRenderable(LineRenderable):
|
||||||
|
|
@ -3,17 +3,17 @@ import sdl2
|
||||||
from OpenGL import GL
|
from OpenGL import GL
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
from art import (
|
from .art import (
|
||||||
UV_FLIP270,
|
UV_FLIP270,
|
||||||
UV_NORMAL,
|
UV_NORMAL,
|
||||||
uv_names,
|
uv_names,
|
||||||
)
|
)
|
||||||
from edit_command import EditCommand, EditCommandTile, EntireArtCommand
|
from .edit_command import EditCommand, EditCommandTile, EntireArtCommand
|
||||||
from texture import Texture
|
from .texture import Texture
|
||||||
from ui_colors import UIColors
|
from .ui_colors import UIColors
|
||||||
from ui_console import ConsoleUI
|
from .ui_console import ConsoleUI
|
||||||
from ui_edit_panel import EditListPanel
|
from .ui_edit_panel import EditListPanel
|
||||||
from ui_element import (
|
from .ui_element import (
|
||||||
DebugTextUI,
|
DebugTextUI,
|
||||||
FPSCounterUI,
|
FPSCounterUI,
|
||||||
GameHoverLabel,
|
GameHoverLabel,
|
||||||
|
|
@ -22,12 +22,12 @@ from ui_element import (
|
||||||
ToolTip,
|
ToolTip,
|
||||||
UIArt,
|
UIArt,
|
||||||
)
|
)
|
||||||
from ui_menu_bar import ArtMenuBar, GameMenuBar
|
from .ui_menu_bar import ArtMenuBar, GameMenuBar
|
||||||
from ui_menu_pulldown import PulldownMenu
|
from .ui_menu_pulldown import PulldownMenu
|
||||||
from ui_object_panel import EditObjectPanel
|
from .ui_object_panel import EditObjectPanel
|
||||||
from ui_popup import ToolPopup
|
from .ui_popup import ToolPopup
|
||||||
from ui_status_bar import StatusBarUI
|
from .ui_status_bar import StatusBarUI
|
||||||
from ui_tool import (
|
from .ui_tool import (
|
||||||
EraseTool,
|
EraseTool,
|
||||||
FillTool,
|
FillTool,
|
||||||
GrabTool,
|
GrabTool,
|
||||||
|
|
@ -37,7 +37,7 @@ from ui_tool import (
|
||||||
SelectTool,
|
SelectTool,
|
||||||
TextTool,
|
TextTool,
|
||||||
)
|
)
|
||||||
from ui_toolbar import ArtToolBar
|
from .ui_toolbar import ArtToolBar
|
||||||
|
|
||||||
UI_ASSET_DIR = "ui/"
|
UI_ASSET_DIR = "ui/"
|
||||||
SCALE_INCREMENT = 0.25
|
SCALE_INCREMENT = 0.25
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
from art import (
|
from .art import (
|
||||||
ART_DIR,
|
ART_DIR,
|
||||||
ART_FILE_EXTENSION,
|
ART_FILE_EXTENSION,
|
||||||
DEFAULT_FRAME_DELAY,
|
DEFAULT_FRAME_DELAY,
|
||||||
|
|
@ -8,10 +8,10 @@ from art import (
|
||||||
DEFAULT_LAYER_Z_OFFSET,
|
DEFAULT_LAYER_Z_OFFSET,
|
||||||
DEFAULT_WIDTH,
|
DEFAULT_WIDTH,
|
||||||
)
|
)
|
||||||
from palette import PaletteFromFile
|
from .palette import PaletteFromFile
|
||||||
from ui_chooser_dialog import ChooserDialog, ChooserItem, ChooserItemButton
|
from .ui_chooser_dialog import ChooserDialog, ChooserItem, ChooserItemButton
|
||||||
from ui_console import SaveCommand
|
from .ui_console import SaveCommand
|
||||||
from ui_dialog import Field, UIDialog
|
from .ui_dialog import Field, UIDialog
|
||||||
|
|
||||||
|
|
||||||
class BaseFileDialog(UIDialog):
|
class BaseFileDialog(UIDialog):
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from ui_colors import UIColors
|
from .ui_colors import UIColors
|
||||||
|
|
||||||
TEXT_LEFT = 0
|
TEXT_LEFT = 0
|
||||||
TEXT_CENTER = 1
|
TEXT_CENTER = 1
|
||||||
|
|
@ -2,11 +2,11 @@ import os
|
||||||
|
|
||||||
import sdl2
|
import sdl2
|
||||||
|
|
||||||
from art import UV_FLIPY, UV_NORMAL
|
from .art import UV_FLIPY, UV_NORMAL
|
||||||
from renderable_sprite import UISpriteRenderable
|
from .renderable_sprite import UISpriteRenderable
|
||||||
from ui_button import UIButton
|
from .ui_button import UIButton
|
||||||
from ui_colors import UIColors
|
from .ui_colors import UIColors
|
||||||
from ui_dialog import Field, UIDialog
|
from .ui_dialog import Field, UIDialog
|
||||||
|
|
||||||
|
|
||||||
class ChooserItemButton(UIButton):
|
class ChooserItemButton(UIButton):
|
||||||
|
|
@ -4,12 +4,12 @@ from math import ceil
|
||||||
import sdl2
|
import sdl2
|
||||||
|
|
||||||
# imports for console execution namespace - be careful!
|
# imports for console execution namespace - be careful!
|
||||||
from art import UV_FLIPY
|
from .art import UV_FLIPY
|
||||||
from image_convert import ImageConverter
|
from .image_convert import ImageConverter
|
||||||
from image_export import export_animation, export_still_image
|
from .image_export import export_animation, export_still_image
|
||||||
from key_shifts import SHIFT_MAP
|
from .key_shifts import SHIFT_MAP
|
||||||
from palette import PaletteFromFile
|
from .palette import PaletteFromFile
|
||||||
from ui_element import UIElement
|
from .ui_element import UIElement
|
||||||
|
|
||||||
CONSOLE_HISTORY_FILENAME = "console_history"
|
CONSOLE_HISTORY_FILENAME = "console_history"
|
||||||
|
|
||||||
|
|
@ -3,10 +3,10 @@ from collections import namedtuple
|
||||||
|
|
||||||
import sdl2
|
import sdl2
|
||||||
|
|
||||||
from key_shifts import SHIFT_MAP
|
from .key_shifts import SHIFT_MAP
|
||||||
from ui_button import TEXT_CENTER, UIButton
|
from .ui_button import TEXT_CENTER, UIButton
|
||||||
from ui_colors import UIColors
|
from .ui_colors import UIColors
|
||||||
from ui_element import UIElement
|
from .ui_element import UIElement
|
||||||
|
|
||||||
Field = namedtuple(
|
Field = namedtuple(
|
||||||
"Field",
|
"Field",
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from game_world import STATE_FILE_EXTENSION, TOP_GAME_DIR
|
from .game_world import STATE_FILE_EXTENSION, TOP_GAME_DIR
|
||||||
from ui_button import UIButton
|
from .ui_button import UIButton
|
||||||
from ui_chooser_dialog import ScrollArrowButton
|
from .ui_chooser_dialog import ScrollArrowButton
|
||||||
from ui_colors import UIColors
|
from .ui_colors import UIColors
|
||||||
from ui_element import UIElement
|
from .ui_element import UIElement
|
||||||
from ui_list_operations import (
|
from .ui_list_operations import (
|
||||||
LO_LOAD_STATE,
|
LO_LOAD_STATE,
|
||||||
LO_NONE,
|
LO_NONE,
|
||||||
LO_OPEN_GAME_DIR,
|
LO_OPEN_GAME_DIR,
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import time
|
import time
|
||||||
from math import ceil
|
from math import ceil
|
||||||
|
|
||||||
import vector
|
from . import vector
|
||||||
from art import Art
|
from .art import Art
|
||||||
from renderable import TileRenderable
|
from .renderable import TileRenderable
|
||||||
|
|
||||||
|
|
||||||
class UIElement:
|
class UIElement:
|
||||||
|
|
@ -4,20 +4,20 @@ import time
|
||||||
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
from art import (
|
from .art import (
|
||||||
ART_DIR,
|
ART_DIR,
|
||||||
ART_FILE_EXTENSION,
|
ART_FILE_EXTENSION,
|
||||||
ART_SCRIPT_DIR,
|
ART_SCRIPT_DIR,
|
||||||
SCRIPT_FILE_EXTENSION,
|
SCRIPT_FILE_EXTENSION,
|
||||||
THUMBNAIL_CACHE_DIR,
|
THUMBNAIL_CACHE_DIR,
|
||||||
)
|
)
|
||||||
from charset import CHARSET_DIR, CHARSET_FILE_EXTENSION
|
from .charset import CHARSET_DIR, CHARSET_FILE_EXTENSION
|
||||||
from image_export import write_thumbnail
|
from .image_export import write_thumbnail
|
||||||
from palette import PALETTE_DIR, PALETTE_EXTENSIONS
|
from .palette import PALETTE_DIR, PALETTE_EXTENSIONS
|
||||||
from texture import Texture
|
from .texture import Texture
|
||||||
from ui_art_dialog import ImportOptionsDialog, PaletteFromFileDialog
|
from .ui_art_dialog import ImportOptionsDialog, PaletteFromFileDialog
|
||||||
from ui_chooser_dialog import ChooserDialog, ChooserItem
|
from .ui_chooser_dialog import ChooserDialog, ChooserItem
|
||||||
from ui_console import OpenCommand
|
from .ui_console import OpenCommand
|
||||||
|
|
||||||
|
|
||||||
class BaseFileChooserItem(ChooserItem):
|
class BaseFileChooserItem(ChooserItem):
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
from ui_console import LoadGameStateCommand, SaveGameStateCommand
|
from .ui_console import LoadGameStateCommand, SaveGameStateCommand
|
||||||
from ui_dialog import Field, UIDialog
|
from .ui_dialog import Field, UIDialog
|
||||||
from ui_list_operations import (
|
from .ui_list_operations import (
|
||||||
LO_NONE,
|
LO_NONE,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from ui_menu_pulldown_item import (
|
from .ui_menu_pulldown_item import (
|
||||||
FileQuitItem,
|
FileQuitItem,
|
||||||
PulldownMenuData,
|
PulldownMenuData,
|
||||||
PulldownMenuItem,
|
PulldownMenuItem,
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import sdl2
|
import sdl2
|
||||||
|
|
||||||
from ui_dialog import UIDialog
|
from .ui_dialog import UIDialog
|
||||||
from ui_element import UIElement
|
from .ui_element import UIElement
|
||||||
|
|
||||||
|
|
||||||
class PagedInfoDialog(UIDialog):
|
class PagedInfoDialog(UIDialog):
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
from math import ceil
|
from math import ceil
|
||||||
|
|
||||||
from renderable_sprite import UISpriteRenderable
|
from .renderable_sprite import UISpriteRenderable
|
||||||
from ui_button import TEXT_CENTER, UIButton
|
from .ui_button import TEXT_CENTER, UIButton
|
||||||
from ui_colors import UIColors
|
from .ui_colors import UIColors
|
||||||
from ui_element import UIElement
|
from .ui_element import UIElement
|
||||||
from ui_game_menu_pulldown_item import (
|
from .ui_game_menu_pulldown_item import (
|
||||||
GameMenuData,
|
GameMenuData,
|
||||||
GameObjectMenuData,
|
GameObjectMenuData,
|
||||||
GameRoomMenuData,
|
GameRoomMenuData,
|
||||||
|
|
@ -12,8 +12,8 @@ from ui_game_menu_pulldown_item import (
|
||||||
GameViewMenuData,
|
GameViewMenuData,
|
||||||
GameWorldMenuData,
|
GameWorldMenuData,
|
||||||
)
|
)
|
||||||
from ui_info_dialog import AboutDialog
|
from .ui_info_dialog import AboutDialog
|
||||||
from ui_menu_pulldown_item import (
|
from .ui_menu_pulldown_item import (
|
||||||
ArtMenuData,
|
ArtMenuData,
|
||||||
CharColorMenuData,
|
CharColorMenuData,
|
||||||
EditMenuData,
|
EditMenuData,
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
from art import UV_FLIPX, UV_FLIPY, UV_ROTATE180
|
from .art import UV_FLIPX, UV_FLIPY, UV_ROTATE180
|
||||||
from ui_button import UIButton
|
from .ui_button import UIButton
|
||||||
from ui_colors import UIColors
|
from .ui_colors import UIColors
|
||||||
from ui_element import UIElement
|
from .ui_element import UIElement
|
||||||
from ui_menu_pulldown_item import PulldownMenuData, PulldownMenuItem, SeparatorItem
|
from .ui_menu_pulldown_item import PulldownMenuData, PulldownMenuItem, SeparatorItem
|
||||||
|
|
||||||
|
|
||||||
class MenuItemButton(UIButton):
|
class MenuItemButton(UIButton):
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
from renderable import LAYER_VIS_DIM, LAYER_VIS_FULL, LAYER_VIS_NONE
|
from .renderable import LAYER_VIS_DIM, LAYER_VIS_FULL, LAYER_VIS_NONE
|
||||||
from ui_tool import (
|
from .ui_tool import (
|
||||||
EraseTool,
|
EraseTool,
|
||||||
FillTool,
|
FillTool,
|
||||||
GrabTool,
|
GrabTool,
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from ui_button import TEXT_RIGHT, UIButton
|
from .ui_button import TEXT_RIGHT, UIButton
|
||||||
from ui_colors import UIColors
|
from .ui_colors import UIColors
|
||||||
from ui_dialog import Field, UIDialog
|
from .ui_dialog import Field, UIDialog
|
||||||
from ui_edit_panel import GamePanel
|
from .ui_edit_panel import GamePanel
|
||||||
|
|
||||||
|
|
||||||
class ResetObjectButton(UIButton):
|
class ResetObjectButton(UIButton):
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
from art import UV_FLIPX, UV_FLIPY, UV_NORMAL, UV_ROTATE90, UV_ROTATE180, UV_ROTATE270
|
from .art import UV_FLIPX, UV_FLIPY, UV_NORMAL, UV_ROTATE90, UV_ROTATE180, UV_ROTATE270
|
||||||
from renderable_line import SwatchSelectionBoxRenderable
|
from .renderable_line import SwatchSelectionBoxRenderable
|
||||||
from ui_button import TEXT_CENTER, UIButton
|
from .ui_button import TEXT_CENTER, UIButton
|
||||||
from ui_colors import UIColors
|
from .ui_colors import UIColors
|
||||||
from ui_element import UIArt, UIElement
|
from .ui_element import UIArt, UIElement
|
||||||
from ui_file_chooser_dialog import CharSetChooserDialog, PaletteChooserDialog
|
from .ui_file_chooser_dialog import CharSetChooserDialog, PaletteChooserDialog
|
||||||
from ui_swatch import MIN_CHARSET_WIDTH, CharacterSetSwatch, PaletteSwatch
|
from .ui_swatch import MIN_CHARSET_WIDTH, CharacterSetSwatch, PaletteSwatch
|
||||||
from ui_tool import FILL_BOUND_BG_COLOR, FILL_BOUND_CHAR, FILL_BOUND_FG_COLOR, FillTool
|
from .ui_tool import FILL_BOUND_BG_COLOR, FILL_BOUND_CHAR, FILL_BOUND_FG_COLOR, FillTool
|
||||||
|
|
||||||
TOOL_PANE_WIDTH = 10
|
TOOL_PANE_WIDTH = 10
|
||||||
|
|
||||||
|
|
@ -2,11 +2,11 @@ import os.path
|
||||||
import time
|
import time
|
||||||
from math import ceil
|
from math import ceil
|
||||||
|
|
||||||
from art import uv_names
|
from .art import uv_names
|
||||||
from renderable_line import UIRenderableX
|
from .renderable_line import UIRenderableX
|
||||||
from ui_button import TEXT_CENTER, TEXT_RIGHT, UIButton
|
from .ui_button import TEXT_CENTER, TEXT_RIGHT, UIButton
|
||||||
from ui_colors import UIColors
|
from .ui_colors import UIColors
|
||||||
from ui_element import UIArt, UIElement, UIRenderable
|
from .ui_element import UIArt, UIElement, UIRenderable
|
||||||
|
|
||||||
# buttons to toggle "affects" status / cycle through choices, respectively
|
# buttons to toggle "affects" status / cycle through choices, respectively
|
||||||
|
|
||||||
|
|
@ -3,8 +3,8 @@ import time
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from renderable_line import LineRenderable, SwatchSelectionBoxRenderable, UIRenderableX
|
from .renderable_line import LineRenderable, SwatchSelectionBoxRenderable, UIRenderableX
|
||||||
from ui_element import UIArt, UIElement, UIRenderable
|
from .ui_element import UIArt, UIElement, UIRenderable
|
||||||
|
|
||||||
# min width for charset; if charset is tiny adjust to this
|
# min width for charset; if charset is tiny adjust to this
|
||||||
MIN_CHARSET_WIDTH = 16
|
MIN_CHARSET_WIDTH = 16
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import sdl2
|
import sdl2
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
from art import (
|
from .art import (
|
||||||
UV_FLIP90,
|
UV_FLIP90,
|
||||||
UV_FLIP270,
|
UV_FLIP270,
|
||||||
UV_FLIPX,
|
UV_FLIPX,
|
||||||
|
|
@ -11,10 +11,10 @@ from art import (
|
||||||
UV_ROTATE180,
|
UV_ROTATE180,
|
||||||
UV_ROTATE270,
|
UV_ROTATE270,
|
||||||
)
|
)
|
||||||
from edit_command import EditCommandTile
|
from .edit_command import EditCommandTile
|
||||||
from key_shifts import SHIFT_MAP
|
from .key_shifts import SHIFT_MAP
|
||||||
from selection import SelectionRenderable
|
from .selection import SelectionRenderable
|
||||||
from texture import Texture
|
from .texture import Texture
|
||||||
|
|
||||||
|
|
||||||
class UITool:
|
class UITool:
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from renderable_line import ToolSelectionBoxRenderable
|
from .renderable_line import ToolSelectionBoxRenderable
|
||||||
from renderable_sprite import UISpriteRenderable
|
from .renderable_sprite import UISpriteRenderable
|
||||||
from ui_button import UIButton
|
from .ui_button import UIButton
|
||||||
from ui_element import UIElement
|
from .ui_element import UIElement
|
||||||
|
|
||||||
|
|
||||||
class ToolBar(UIElement):
|
class ToolBar(UIElement):
|
||||||
|
|
@ -23,7 +23,7 @@ requires = ["hatchling"]
|
||||||
build-backend = "hatchling.build"
|
build-backend = "hatchling.build"
|
||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
src = ["."]
|
src = ["playscii"]
|
||||||
line-length = 88
|
line-length = 88
|
||||||
|
|
||||||
[tool.ruff.lint]
|
[tool.ruff.lint]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue