d
This commit is contained in:
9
main.py
9
main.py
@@ -18,6 +18,7 @@ from cfg import *
|
|||||||
from cld import *
|
from cld import *
|
||||||
from ctx import *
|
from ctx import *
|
||||||
from fs import *
|
from fs import *
|
||||||
|
from desktop import *
|
||||||
from desktop_Platform import *
|
from desktop_Platform import *
|
||||||
from desktop_Window import *
|
from desktop_Window import *
|
||||||
from ht_Context import *
|
from ht_Context import *
|
||||||
@@ -42,18 +43,12 @@ def process(c):
|
|||||||
p.c = c
|
p.c = c
|
||||||
# Perform context dependent calls of desktop functions.
|
# Perform context dependent calls of desktop functions.
|
||||||
# Similar to context functions, but no platform is returned.
|
# Similar to context functions, but no platform is returned.
|
||||||
### desktop_deselectMismatchedTiles(p)
|
desktop_applyConfigInit(p)
|
||||||
ctrl.registerCallback(process)
|
ctrl.registerCallback(process)
|
||||||
|
|
||||||
ctrl.set("cfgPath", CFG)
|
ctrl.set("cfgPath", CFG)
|
||||||
ctrl.set("scriptDir", SCRIPT_DIR)
|
ctrl.set("scriptDir", SCRIPT_DIR)
|
||||||
|
|
||||||
ctrl.set("windowWidth", 900)
|
|
||||||
ctrl.set("windowHeight", 600)
|
|
||||||
ctrl.set("windowAntialiasing", False)
|
|
||||||
ctrl.set("windowBackgroundColor", "#ffffff")
|
|
||||||
ctrl.set("windowTitle", "Прототип: Отель")
|
|
||||||
|
|
||||||
#desktop_loadTextures(p)
|
#desktop_loadTextures(p)
|
||||||
|
|
||||||
wnd = desktop_Window(p)
|
wnd = desktop_Window(p)
|
||||||
|
|||||||
30
py/desktop.py
Normal file
30
py/desktop.py
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
import arcade
|
||||||
|
from cld import *
|
||||||
|
from desktop_Platform import *
|
||||||
|
|
||||||
|
# Pass config init key-value pairs to context controller
|
||||||
|
#
|
||||||
|
# Conditions:
|
||||||
|
# 1. Config tree has just been parsed
|
||||||
|
def desktop_applyConfigInit(p):
|
||||||
|
if (
|
||||||
|
p.c.recentField == "cfgTree"
|
||||||
|
):
|
||||||
|
for key in p.c.cfgTree["init"]:
|
||||||
|
value = p.c.cfgTree["init"][key]
|
||||||
|
# Boolean.
|
||||||
|
if (
|
||||||
|
value == "false"
|
||||||
|
):
|
||||||
|
value = False
|
||||||
|
elif (
|
||||||
|
value == "true"
|
||||||
|
):
|
||||||
|
value = True
|
||||||
|
# Float.
|
||||||
|
elif (
|
||||||
|
cld_isdigit(value)
|
||||||
|
):
|
||||||
|
value = float(value)
|
||||||
|
|
||||||
|
p.ctrl.set(key, value)
|
||||||
@@ -4,6 +4,6 @@ class desktop_Platform:
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.c = None
|
self.c = None
|
||||||
self.ctrl = None
|
self.ctrl = None
|
||||||
self.mousePosition = []
|
self.staticSprites = arcade.SpriteList()
|
||||||
self.dbgSprites = arcade.SpriteList()
|
self.textureDescriptions = {}
|
||||||
self.dbgTextures = []
|
self.textures = {}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class desktop_Window(arcade.Window):
|
|||||||
|
|
||||||
def on_draw(self):
|
def on_draw(self):
|
||||||
arcade.start_render()
|
arcade.start_render()
|
||||||
self.p.dbgSprites.draw()
|
self.p.staticSprites.draw()
|
||||||
|
|
||||||
def on_mouse_press(self, x, y, button, key_modifiers):
|
def on_mouse_press(self, x, y, button, key_modifiers):
|
||||||
print("mouse press:", x, y)
|
print("mouse press:", x, y)
|
||||||
|
|||||||
@@ -6,10 +6,11 @@ class ht_Context:
|
|||||||
self.cfgTree = {}
|
self.cfgTree = {}
|
||||||
self.didLaunch = False
|
self.didLaunch = False
|
||||||
self.recentField = "none"
|
self.recentField = "none"
|
||||||
|
self.windowAntialiasing = False
|
||||||
self.windowBackgroundColor = "#000000"
|
self.windowBackgroundColor = "#000000"
|
||||||
self.windowHeight = 0
|
self.windowHeight: float = 0
|
||||||
self.windowTitle = ""
|
self.windowTitle = ""
|
||||||
self.windowWidth = 0
|
self.windowWidth: float = 0
|
||||||
|
|
||||||
def field(self, fieldName):
|
def field(self, fieldName):
|
||||||
return getattr(self, fieldName)
|
return getattr(self, fieldName)
|
||||||
|
|||||||
Reference in New Issue
Block a user