From a53ae29467b5f2153ac8260674e9379b0f458d50 Mon Sep 17 00:00:00 2001 From: John McCardle Date: Sat, 4 Mar 2023 23:18:21 -0500 Subject: [PATCH] Python object models --- src/scripts/Grid.py | 30 ++++++++++++++++++++++++++++++ src/scripts/TestScene.py | 4 ++++ src/scripts/UIMenu.py | 12 +++++++++++- 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 src/scripts/Grid.py create mode 100644 src/scripts/TestScene.py diff --git a/src/scripts/Grid.py b/src/scripts/Grid.py new file mode 100644 index 0000000..aefea8e --- /dev/null +++ b/src/scripts/Grid.py @@ -0,0 +1,30 @@ +class GridPoint: + def __init__(self, color, walkable, tilesprite, transparent, visible, discovered, color_overlay, tile_overlay, uisprite): + self.color = color + self.walkable = walkable + self.tilesprite = tilesprite + self.transparent = transparent + self.visible = visible + self.discovered = discovered + self.color_overlay = color_overlay + self.tile_overlay = tile_overlay + self.uisprite = uisprite + + def __repr__(self): + return f"" + +class Grid: + def __init__(self, title, gx, gy, gs, x, y, w, h): + self.title = title + self.grid_x = gx + self.grid_y = gy + self.grid_size = gs + self.x = x + self.y = y + self.w = w + self.h = h + + self.points = [] + + def __repr__(self): + return f"" diff --git a/src/scripts/TestScene.py b/src/scripts/TestScene.py new file mode 100644 index 0000000..0884605 --- /dev/null +++ b/src/scripts/TestScene.py @@ -0,0 +1,4 @@ +print("TestScene imported") + +def start(): + print("TestScene.start called") diff --git a/src/scripts/UIMenu.py b/src/scripts/UIMenu.py index b02e0bb..9447f19 100644 --- a/src/scripts/UIMenu.py +++ b/src/scripts/UIMenu.py @@ -4,6 +4,9 @@ class Caption: self.textsize = textsize self.color = color + def __repr__(self): + return f"" + class Button: def __init__(self, x, y, w, h, bgcolor, textcolor, text, actioncode): self.x = x @@ -15,12 +18,19 @@ class Button: self.text = text self.actioncode = actioncode + def __repr__(self): + return f"