From c1eaa5695b4cc0d3c6efa64eee111cb563a49cdd 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: Fri, 12 Jul 2024 22:38:19 +0300 Subject: [PATCH] d --- main.py | 47 ++++++++++++++++++ .../desktop_Platform.cpython-312.pyc | Bin 0 -> 686 bytes py/__pycache__/desktop_Window.cpython-312.pyc | Bin 0 -> 1801 bytes py/__pycache__/ht_Context.cpython-312.pyc | Bin 0 -> 1150 bytes py/desktop_Platform.py | 9 ++++ py/desktop_Window.py | 23 +++++++++ py/ht_Context.py | 17 +++++++ run | 2 + 8 files changed, 98 insertions(+) create mode 100644 main.py create mode 100644 py/__pycache__/desktop_Platform.cpython-312.pyc create mode 100644 py/__pycache__/desktop_Window.cpython-312.pyc create mode 100644 py/__pycache__/ht_Context.cpython-312.pyc create mode 100644 py/desktop_Platform.py create mode 100644 py/desktop_Window.py create mode 100644 py/ht_Context.py create mode 100755 run diff --git a/main.py b/main.py new file mode 100644 index 0000000..3f6831a --- /dev/null +++ b/main.py @@ -0,0 +1,47 @@ +import os +import sys + +SCRIPT_DIR = os.path.dirname(os.path.realpath(sys.argv[0])) + +sys.path.append(f"{SCRIPT_DIR}/../cross-language-dialect/ctx") +sys.path.append(f"{SCRIPT_DIR}/../cross-language-dialect/lib") +sys.path.append(f"{SCRIPT_DIR}/py") + +import arcade +from cld import * +from ctx import * +from desktop_Platform import * +from desktop_Window import * +from ht_Context import * + +ctrl = ctx_Controller(ht_createContext()) +ctrl.registerFunctions([ +]) + +def printDbg(c): + print(f"Dbg key/value: '{c.recentField}'/'{c.field(c.recentField)}'") +ctrl.registerCallback(printDbg) + +p = desktop_Platform() +p.ctrl = ctrl + +# Bind platform to context changes. +def process(c): + # Copy context to platform. + p.c = c + # Perform context dependent calls of desktop functions. + # Similar to context functions, but no platform is returned. + ### desktop_deselectMismatchedTiles(p) +ctrl.registerCallback(process) + +ctrl.set("windowWidth", 900) +ctrl.set("windowHeight", 600) +ctrl.set("windowAntialiasing", False) +ctrl.set("windowBackgroundColor", "#ffffff") +ctrl.set("windowTitle", "Прототип: Отель") + +#desktop_loadTextures(p) + +wnd = desktop_Window(p) +ctrl.set("didLaunch", True) +arcade.run() diff --git a/py/__pycache__/desktop_Platform.cpython-312.pyc b/py/__pycache__/desktop_Platform.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c01b20f80fe98cff22387769703b09d9f80c8db2 GIT binary patch literal 686 zcmZWnv5wO~5S_Jsxezb}6pV6ETz7K88G1w&KuC}~2}I#$WxSiiV8>>6En!5F!aqQD z-+=Bn=%^4Nq6N`V(IH$QUBylu9}}>?5nK2uVeJ=LaU!xIJn;Strc}0}g>hNEn0`BQ=C}W%;%qGA^H~ zyrBDOq-MFu;!cB7e7|j;W^No#@Cv9wt*x??>I3A~^8l#LuIg#OLx1DZ8XCn$ce>K| zx~u}9O#MwwV(r9Aq}t8$Qu6&=CMwD2x)+H!Vq6a%6e3alULutqu*U~&D)niDAMzKf z6kPg5JCdg}iL-7WUk@JTX_;{u+~2zu6hR?!m0x|5E1m{L75ux8-J;TcN|Sk_D1ABp zkM1bEEP2hi1uWh3i%ETZIUJdAcR9Yin0$1+uill<-p+e(=Y!{)^S$Mz@nZ7H88!IL zQ{TZZ^C;t#>H(!$&dL<=8A_j*QQ9)%oT+^SVrYUmiw@ha9A1;et=G_48}?RPgS2mn pQ(cu9Av%#C_iwa~ZiY}TbY{J4Z`|EL(xgpPCt6fKw1;BU0|%6%f`#BhA{3NJuBy>ycbu%V-Ze98 zCAMkC!yx466U*T7gr0b$kxQ9NBMRfHOaak zdeM%X`GYqgW_bVPHb&?he1u})Ca0(Dp?gxkhwEy_8{PH%2+yz!H1$kAx-Za7YCF;b zEUON_C=TOAeW3ObDP-JuD#Pm288*5vh+}4?kzvQOK5(S(ODP7Gk<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4-Y;+sKXSpno*Hlg3O&=tZ*2f z;I8E9KPbuoz)E8r3v@eD{IGOnUDY`?n6NGtLE_?3r@5u1?|WhnqPmeQp!_i@rT>gP PUHD62>CIAF(ue&Af4TUN literal 0 HcmV?d00001 diff --git a/py/desktop_Platform.py b/py/desktop_Platform.py new file mode 100644 index 0000000..5631822 --- /dev/null +++ b/py/desktop_Platform.py @@ -0,0 +1,9 @@ +import arcade + +class desktop_Platform: + def __init__(self): + self.c = None + self.ctrl = None + self.mousePosition = [] + self.dbgSprites = arcade.SpriteList() + self.dbgTextures = [] diff --git a/py/desktop_Window.py b/py/desktop_Window.py new file mode 100644 index 0000000..264a0ab --- /dev/null +++ b/py/desktop_Window.py @@ -0,0 +1,23 @@ +import arcade + +class desktop_Window(arcade.Window): + def __init__(self, p): + super().__init__( + p.c.windowWidth, + p.c.windowHeight, + p.c.windowTitle, + ) + self.antialiasing = p.c.windowAntialiasing + self.background_color = arcade.color_from_hex_string(p.c.windowBackgroundColor) + self.p = p + + def on_draw(self): + arcade.start_render() + self.p.dbgSprites.draw() + + def on_mouse_press(self, x, y, button, key_modifiers): + print("mouse press:", x, y) + pass + + def on_update(self, delta): + pass diff --git a/py/ht_Context.py b/py/ht_Context.py new file mode 100644 index 0000000..f523e41 --- /dev/null +++ b/py/ht_Context.py @@ -0,0 +1,17 @@ +class ht_Context: + def __init__(self): + self.didLaunch = False + self.recentField = "none" + self.windowBackgroundColor = "#000000" + self.windowHeight = 0 + self.windowTitle = "" + self.windowWidth = 0 + + def field(self, fieldName): + return getattr(self, fieldName) + + def setField(self, fieldName, value): + setattr(self, fieldName, value) + +def ht_createContext(): + return ht_Context() diff --git a/run b/run new file mode 100755 index 0000000..e697db6 --- /dev/null +++ b/run @@ -0,0 +1,2 @@ +#!/bin/bash +/Users/mk/py3.12venv/bin/python3.12 main.py