McRogueFace/src/scripts/game.py

55 lines
1.4 KiB
Python
Raw Normal View History

import mcrfpy
font = mcrfpy.Font("assets/JetbrainsMono.ttf")
Squashed commit of the following: [standardize_color_handling] closes #11 Check the abandoned feature branch for PyLinkedColor, a time-expensive but now abandoned feature to link a color value to a UIDrawable. There are some TODOs left in the PyColor class, but that can go under cleanup. I'm way over time on this, so I'm taking a small victory :) commit 572aa526058ae012f622393eae01c65cbc8dc05e Author: John McCardle <mccardle.john@gmail.com> Date: Sat Mar 30 21:18:26 2024 -0400 More color table updates commit 01706bd59d9b62fe1ea8f8dcce0929da738490dd Author: John McCardle <mccardle.john@gmail.com> Date: Sat Mar 30 21:13:31 2024 -0400 Color wrapup... Cutting PyLinkedColor to simplify my cursedly mortal, finite existence commit 3991ac13d6471e491cbccf2ddb8d36bad528b2f7 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Mar 28 23:50:50 2024 -0400 Still having segfaults with LinkedColor and captions (specifically outline color, but that might not be the actual cause). PyColor shaping back up in simplified form. commit 06e24a1b27c2f1ec520537f3a5b9b08d68d07829 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Mar 28 20:53:49 2024 -0400 LinkedColor now reflecting changes to the linked color value. Needs set method + RGBA / color properties commit 41509dfe9640a67f924c5f843fe6bceb0cdb8f78 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Mar 27 21:10:03 2024 -0400 Addressing issues with PyColor by splitting behavior off into PyLinkedColor commit 13a4ddf41b41dfc123a00468377b4f8fae0da845 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Mar 26 23:02:00 2024 -0400 Build runs again. PyColor objects are being instantiated, with bugs and no test of color changing commit 1601fc7faba53e8d0d5814688b80e5cbfec2a700 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Mar 25 20:48:08 2024 -0400 Still doesn't compile, but now the issue is in UI.h overcoupling. Progress! commit 13672c8fdbe7f3db385c93234331bb16267ef18b Author: John McCardle <mccardle.john@gmail.com> Date: Sun Mar 24 21:19:37 2024 -0400 Dabbling around this morning; still not building commit 79090b553f08af7dd03892c2153073d8457a566d Author: John McCardle <mccardle.john@gmail.com> Date: Sun Mar 24 08:36:06 2024 -0400 Unsaved changes from last night commit 2cac6f03c601de4591dbd8205418a1cbfe7e7e9f Author: John McCardle <mccardle.john@gmail.com> Date: Sat Mar 23 23:07:10 2024 -0400 untested PyColor base implementation commit 3728e5fcc8bd745ef0268312a808fab6c82d7d91 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Mar 23 23:06:36 2024 -0400 Color naming prototype
2024-03-30 21:20:40 -04:00
texture = mcrfpy.Texture("assets/kenney_tinydungeon.png", 16, 16)
print("[game.py] Default texture:")
print(mcrfpy.default_texture)
print(type(mcrfpy.default_texture))
Squashed commit of the following: [standardize_color_handling] closes #11 Check the abandoned feature branch for PyLinkedColor, a time-expensive but now abandoned feature to link a color value to a UIDrawable. There are some TODOs left in the PyColor class, but that can go under cleanup. I'm way over time on this, so I'm taking a small victory :) commit 572aa526058ae012f622393eae01c65cbc8dc05e Author: John McCardle <mccardle.john@gmail.com> Date: Sat Mar 30 21:18:26 2024 -0400 More color table updates commit 01706bd59d9b62fe1ea8f8dcce0929da738490dd Author: John McCardle <mccardle.john@gmail.com> Date: Sat Mar 30 21:13:31 2024 -0400 Color wrapup... Cutting PyLinkedColor to simplify my cursedly mortal, finite existence commit 3991ac13d6471e491cbccf2ddb8d36bad528b2f7 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Mar 28 23:50:50 2024 -0400 Still having segfaults with LinkedColor and captions (specifically outline color, but that might not be the actual cause). PyColor shaping back up in simplified form. commit 06e24a1b27c2f1ec520537f3a5b9b08d68d07829 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Mar 28 20:53:49 2024 -0400 LinkedColor now reflecting changes to the linked color value. Needs set method + RGBA / color properties commit 41509dfe9640a67f924c5f843fe6bceb0cdb8f78 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Mar 27 21:10:03 2024 -0400 Addressing issues with PyColor by splitting behavior off into PyLinkedColor commit 13a4ddf41b41dfc123a00468377b4f8fae0da845 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Mar 26 23:02:00 2024 -0400 Build runs again. PyColor objects are being instantiated, with bugs and no test of color changing commit 1601fc7faba53e8d0d5814688b80e5cbfec2a700 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Mar 25 20:48:08 2024 -0400 Still doesn't compile, but now the issue is in UI.h overcoupling. Progress! commit 13672c8fdbe7f3db385c93234331bb16267ef18b Author: John McCardle <mccardle.john@gmail.com> Date: Sun Mar 24 21:19:37 2024 -0400 Dabbling around this morning; still not building commit 79090b553f08af7dd03892c2153073d8457a566d Author: John McCardle <mccardle.john@gmail.com> Date: Sun Mar 24 08:36:06 2024 -0400 Unsaved changes from last night commit 2cac6f03c601de4591dbd8205418a1cbfe7e7e9f Author: John McCardle <mccardle.john@gmail.com> Date: Sat Mar 23 23:07:10 2024 -0400 untested PyColor base implementation commit 3728e5fcc8bd745ef0268312a808fab6c82d7d91 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Mar 23 23:06:36 2024 -0400 Color naming prototype
2024-03-30 21:20:40 -04:00
# build test widgets
mcrfpy.createScene("pytest")
mcrfpy.setScene("pytest")
ui = mcrfpy.sceneUI("pytest")
# Frame
f = mcrfpy.Frame(25, 19, 462, 346, fill_color=(255, 92, 92))
# fill (LinkedColor / Color): f.fill_color
# outline (LinkedColor / Color): f.outline_color
# pos (LinkedVector / Vector): f.pos
# size (LinkedVector / Vector): f.size
# Caption
c = mcrfpy.Caption(512+25, 19, "Hi.", font)
# fill (LinkedColor / Color): c.fill_color
#color_val = c.fill_color
print(c.fill_color)
print("Set a fill color")
c.fill_color = (255, 255, 255)
print("Lol, did it segfault?")
# outline (LinkedColor / Color): c.outline_color
# font (Font): c.font
# pos (LinkedVector / Vector): c.pos
# Sprite
s = mcrfpy.Sprite(25, 384+19, texture, 86, 9.0)
# pos (LinkedVector / Vector): s.pos
# texture (Texture): s.texture
# Grid
g = mcrfpy.Grid(10, 10, texture, 512+25, 384+19, 462, 346)
# texture (Texture): g.texture
# pos (LinkedVector / Vector): g.pos
# size (LinkedVector / Vector): g.size
for _x in range(10):
for _y in range(10):
g.at((_x, _y)).color = (255 - _x*25, 255 - _y*25, 255)
g.zoom = 2.0
[ui.append(d) for d in (f, c, s, g)]
print("built!")
# tests
2024-03-06 10:50:19 -05:00