Михаил Капелько 4 달 전
부모
커밋
03578f5b6d
6개의 변경된 파일81개의 추가작업 그리고 1개의 파일을 삭제
  1. +28
    -0
      v5/desktop.py
  2. +3
    -0
      v5/desktop_Platform.py
  3. +1
    -0
      v5/desktop_Window.py
  4. +33
    -0
      v5/gui.py
  5. +10
    -1
      v5/main-gui.py
  6. +6
    -0
      v5/memory_Context.py

+ 28
- 0
v5/desktop.py 파일 보기

@@ -2,6 +2,18 @@ import arcade
from gui_aux import *
from desktop_Platform import *

def desktop_createDesc(p):
p.desc = arcade.Sprite()
p.descSprites.append(p.desc)
p.desc.texture = p.descTextures[0]
# Position.
pos = gui_aux_cellScreenPosition(p.c, p.c.descPosition)
p.desc.left = pos[0]
p.desc.top = pos[1]
# Invisible by default.
p.desc.visible = False
#}

def desktop_createDeselectedTiles(p):
for (id, pos) in enumerate(p.c.tilePositions):
tile = arcade.AnimatedTimeBasedSprite()
@@ -124,6 +136,22 @@ def desktop_hideTitle(p):
#}
#}

# Load description textures
def desktop_loadDescTextures(p):
texs = []
for (id, td) in enumerate(p.c.descTextureDescriptions):
tex = arcade.load_texture(
td.fileName,
x = td.x,
y = td.y,
width = td.width,
height = td.height
)
texs.append(tex)
#}
p.descTextures = texs
#}

# Load tile textures
def desktop_loadTextures(p):
texs = []


+ 3
- 0
v5/desktop_Platform.py 파일 보기

@@ -4,6 +4,9 @@ class desktop_Platform:
def __init__(self):
self.c = None
self.ctrl = None
self.desc = None
self.descSprites = arcade.SpriteList()
self.descTextures = []
self.deselectedSprites = arcade.SpriteList()
self.deselectedTiles = []
self.mousePosition = []


+ 1
- 0
v5/desktop_Window.py 파일 보기

@@ -14,6 +14,7 @@ class desktop_Window(arcade.Window):

def on_draw(self):
arcade.start_render()
self.p.descSprites.draw()
self.p.deselectedSprites.draw()
self.p.selectedSprites.draw()
self.p.titleSprites.draw()


+ 33
- 0
v5/gui.py 파일 보기

@@ -3,6 +3,39 @@ from gui_TextureDescription import *
from llm import *
from memory_Context import *

# Generate texture descriptions for harm description
#
# Conditions:
# 1.descImage, descImageCount, descImageHeight, or descImageWidth has just changed
@llm_by_value
def gui_generateDescTextureDescriptions(
c: memory_Context
) -> memory_Context:
if (
c.recentField == "descImage" or
c.recentField == "descImageCount" or
c.recentField == "descImageHeight" or
c.recentField == "descImageWidth"
):
tds: list[gui_TextureDescription] = []
for id in range(0, c.descImageCount):
td = gui_createTextureDescription()
td.fileName = c.descImage
td.height = c.descImageHeight
td.width = c.descImageWidth
td.x = id * c.descImageWidth
td.y = 0
tds.append(td)
#}
c.descTextureDescriptions = tds
c.recentField = "descTextureDescriptions"
return c
#}

c.recentField = "none"
return c
#}

# Generate texture descriptions for tiles
#
# Conditions:


+ 10
- 1
v5/main-gui.py 파일 보기

@@ -67,6 +67,7 @@ ctrl.registerFunctions([
# cli_reportVictory,
# cli_selectItem,
# cli_showHelp,
gui_generateDescTextureDescriptions,
gui_generateTextureDescriptions,
gui_generateTilePositions,
gui_generateTitleTextureDescriptions,
@@ -79,7 +80,7 @@ ctrl.registerFunctions([

def printDbg(c):
print(f"Dbg key/value: '{c.recentField}'/'{c.field(c.recentField)}'")
ctrl.registerCallback(printDbg)
#ctrl.registerCallback(printDbg)
ctrl.registerFieldCallback("exit", lambda c: sys.exit(0))

p = desktop_Platform()
@@ -108,6 +109,11 @@ ctrl.set("playfieldSize", 6)
ctrl.set("cellPositions", gui_aux_cellHarmPositions())
ctrl.set("cellSize", 25)
ctrl.set("deselectMismatchedTilesDelay", 500)
ctrl.set("descImage", "res/harm.png")
ctrl.set("descImageCount", 6)
ctrl.set("descImageHeight", 250)
ctrl.set("descImageWidth", 375)
ctrl.set("descPosition", [19, 12])
ctrl.set("hideMatchingTilesDelay", 500)
ctrl.set("tileImage", "res/harmful-tiles.png")
ctrl.set("tileImageCount", 8)
@@ -131,5 +137,8 @@ desktop_createSelectedTiles(p)
desktop_loadTitleTextures(p)
desktop_createTitle(p)

desktop_loadDescTextures(p)
desktop_createDesc(p)

wnd = desktop_Window(p)
arcade.run()

+ 6
- 0
v5/memory_Context.py 파일 보기

@@ -2,6 +2,12 @@ class memory_Context:
def __init__(self):
self.cellPositions = []
self.cellSize = 0
self.descImage = ""
self.descImageCount = 0
self.descImageHeight = 0
self.descImageWidth = 0
self.descPosition = []
self.descTextureDescriptions = []
self.deselectMismatchedTiles = False
self.deselectMismatchedTilesDelay = 0
self.didLaunch = False


불러오는 중...
취소
저장