Updated UIMenu to a map on the C++ side, Python gets the title property so changes can be properly, jankily, looked up

This commit is contained in:
John McCardle 2023-03-02 06:35:13 -05:00
commit c8124e84dc
3 changed files with 68 additions and 22 deletions

38
src/scripts/UIMenu.py Normal file
View file

@ -0,0 +1,38 @@
class Caption:
def __init__(self, text, textsize, color):
self.text = text
self.textsize = textsize
self.color = color
class Button:
def __init__(self, x, y, w, h, bgcolor, textcolor, text, actioncode):
self.x = x
self.y = y
self.w = w
self.h = h
self.bgcolor = bgcolor
self.textcolor = textcolor
self.text = text
self.actioncode = actioncode
class Sprite:
def __init__(self, tex_index, x, y):
self.tex_index = tex_index
self.x = x
self.y = y
class UIMenu:
def __init__(self, title, x, y, w, h, bgcolor, visible=False):
self.title = title
self.x = x
self.y = y
self.w = w
self.h = h
self.bgcolor = bgcolor
self.visible = visible
self.captions = []
self.buttons = []
self.sprites = []
def __repr__(self):
return f"<UIMenu title={repr(self.title)}, x={self.x}, y={self.y}, w={self.w}, h={self.h}, bgcolor={self.bgcolor}, visible={self.visible}, {len(self.captions)} captions, {len(self.buttons)} buttons, {len(self.sprites)} sprites>"