From 72ccd9f37bfa9ff1eee324e8d0f2aa73c862d451 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B8=D1=85=D0=B0=D0=B8=D0=BB=20=D0=9A=D0=B0=D0=BF?= =?UTF-8?q?=D0=B5=D0=BB=D1=8C=D0=BA=D0=BE?= Date: Tue, 25 Jun 2024 22:33:55 +0300 Subject: [PATCH] d --- v5/desktop.py | 17 ++++++++++++++++- v5/desktop_Platform.py | 2 ++ v5/main-gui.py | 9 ++++++++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/v5/desktop.py b/v5/desktop.py index 9c1dfea..5e1ddc2 100644 --- a/v5/desktop.py +++ b/v5/desktop.py @@ -1,6 +1,6 @@ +import arcade from desktop_Platform import * -# Configure window parameters def desktop_configureFixedWindow(p): p.cell = 25 p.windowAntialiasing = False @@ -8,3 +8,18 @@ def desktop_configureFixedWindow(p): p.windowTitle = "OGS Memory" p.windowWidth = 900 #} + +def desktop_loadTextures(p): + texs = [] + for (id, td) in enumerate(p.c.textureDescriptions): + tex = arcade.load_texture( + td.fileName, + x = td.x, + y = td.y, + width = td.width, + height = td.height + ) + texs.append(tex) + #} + p.textures = texs +#} diff --git a/v5/desktop_Platform.py b/v5/desktop_Platform.py index cb134ad..9940411 100644 --- a/v5/desktop_Platform.py +++ b/v5/desktop_Platform.py @@ -2,8 +2,10 @@ import arcade class desktop_Platform: def __init__(self): + self.c = None self.cell = 0 self.sprites = arcade.SpriteList() + self.textures = [] self.title = "" self.windowBackgroundColor = arcade.color.WHITE self.windowHeight = 0 diff --git a/v5/main-gui.py b/v5/main-gui.py index 9ecdbbb..5682de9 100644 --- a/v5/main-gui.py +++ b/v5/main-gui.py @@ -76,6 +76,13 @@ def printOutput(c): ctrl.registerCallback(printOutput) ctrl.registerFieldCallback("exit", lambda c: sys.exit(0)) +p = desktop_Platform() + +# Copy context to platform. +def copyContext(c): + p.c = c +ctrl.registerCallback(copyContext) + ctrl.set("didLaunch", True) ctrl.set("playfieldSize", 2) ctrl.set("tileImage", "res/tiles.png") @@ -83,8 +90,8 @@ ctrl.set("tileImageCount", 3) ctrl.set("tileImageHeight", 100) ctrl.set("tileImageWidth", 75) -p = desktop_Platform() desktop_configureFixedWindow(p) +desktop_loadTextures(p) wnd = desktop_Window(p) arcade.run()