@@ -1,6 +1,6 @@ | |||||
import arcade | |||||
from desktop_Platform import * | from desktop_Platform import * | ||||
# Configure window parameters | |||||
def desktop_configureFixedWindow(p): | def desktop_configureFixedWindow(p): | ||||
p.cell = 25 | p.cell = 25 | ||||
p.windowAntialiasing = False | p.windowAntialiasing = False | ||||
@@ -8,3 +8,18 @@ def desktop_configureFixedWindow(p): | |||||
p.windowTitle = "OGS Memory" | p.windowTitle = "OGS Memory" | ||||
p.windowWidth = 900 | 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 | |||||
#} |
@@ -2,8 +2,10 @@ import arcade | |||||
class desktop_Platform: | class desktop_Platform: | ||||
def __init__(self): | def __init__(self): | ||||
self.c = None | |||||
self.cell = 0 | self.cell = 0 | ||||
self.sprites = arcade.SpriteList() | self.sprites = arcade.SpriteList() | ||||
self.textures = [] | |||||
self.title = "" | self.title = "" | ||||
self.windowBackgroundColor = arcade.color.WHITE | self.windowBackgroundColor = arcade.color.WHITE | ||||
self.windowHeight = 0 | self.windowHeight = 0 | ||||
@@ -76,6 +76,13 @@ def printOutput(c): | |||||
ctrl.registerCallback(printOutput) | ctrl.registerCallback(printOutput) | ||||
ctrl.registerFieldCallback("exit", lambda c: sys.exit(0)) | 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("didLaunch", True) | ||||
ctrl.set("playfieldSize", 2) | ctrl.set("playfieldSize", 2) | ||||
ctrl.set("tileImage", "res/tiles.png") | ctrl.set("tileImage", "res/tiles.png") | ||||
@@ -83,8 +90,8 @@ ctrl.set("tileImageCount", 3) | |||||
ctrl.set("tileImageHeight", 100) | ctrl.set("tileImageHeight", 100) | ||||
ctrl.set("tileImageWidth", 75) | ctrl.set("tileImageWidth", 75) | ||||
p = desktop_Platform() | |||||
desktop_configureFixedWindow(p) | desktop_configureFixedWindow(p) | ||||
desktop_loadTextures(p) | |||||
wnd = desktop_Window(p) | wnd = desktop_Window(p) | ||||
arcade.run() | arcade.run() |