25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.py 1.4KB

3 달 전
3 달 전
3 달 전
3 달 전
3 달 전
3 달 전
3 달 전
3 달 전
3 달 전
3 달 전
3 달 전
3 달 전
3 달 전
3 달 전
3 달 전
3 달 전
3 달 전
3 달 전
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import os
  2. import sys
  3. if len(sys.argv) < 2:
  4. print("Usage: python3 /path/to/main.py /path/to/ht.config")
  5. sys.exit(1)
  6. CFG = os.path.realpath(sys.argv[1])
  7. SCRIPT_DIR = os.path.dirname(os.path.realpath(sys.argv[0]))
  8. sys.path.append(f"{SCRIPT_DIR}/../cross-language-dialect/ctx")
  9. sys.path.append(f"{SCRIPT_DIR}/../cross-language-dialect/lib")
  10. sys.path.append(f"{SCRIPT_DIR}/py")
  11. import arcade
  12. from cfg import *
  13. from cld import *
  14. from ctx import *
  15. from fs import *
  16. from desktop import *
  17. from desktop_Platform import *
  18. from desktop_Window import *
  19. from ht_Context import *
  20. ctrl = ctx_Controller(ht_createContext())
  21. ctrl.registerFunctions([
  22. cfg_parseConfigTree,
  23. fs_locateConfigDir,
  24. fs_readConfig,
  25. ])
  26. def printDbg(c):
  27. print(f"Dbg key/value: '{c.recentField}'/'{c.field(c.recentField)}'")
  28. ctrl.registerCallback(printDbg)
  29. p = desktop_Platform()
  30. p.ctrl = ctrl
  31. # Bind platform to context changes.
  32. def process(c):
  33. # Copy context to platform.
  34. p.c = c
  35. # Perform context dependent calls of desktop functions.
  36. # Similar to context functions, but no platform is returned.
  37. desktop_applyConfigInit(p)
  38. desktop_createConfigPlayerSprites(p)
  39. desktop_createConfigStaticSprites(p)
  40. desktop_loadConfigTextures(p)
  41. desktop_movePlayerInstantly(p)
  42. ctrl.registerCallback(process)
  43. ctrl.set("cfgPath", CFG)
  44. ctrl.set("scriptDir", SCRIPT_DIR)
  45. wnd = desktop_Window(p)
  46. ctrl.set("didLaunch", True)
  47. arcade.run()