Squashed commit of the following: [standardize_texture_handling]
closes #18 commitb114ec3085Author: John McCardle <mccardle.john@gmail.com> Date: Thu Mar 21 22:22:35 2024 -0400 cleaning up for merge commitd7228172c4Author: John McCardle <mccardle.john@gmail.com> Date: Thu Mar 21 21:39:15 2024 -0400 Messy, but monumental: PyTexture::pyObject works this also coincidentally fixes a weird bug I encountered while (mis?)using tp_alloc: by using PyType_GenericAlloc, I avoid the segfault that tp_alloc sometimes causes. See the horrible UIDrawable retrieval macro that I use in UI.h for a workaround that can probably be replaced with this technique commit2cf8f94310Author: John McCardle <mccardle.john@gmail.com> Date: Wed Mar 20 21:16:52 2024 -0400 Radical new example pattern for exposing a C++ class to Python commit84a8886da2Author: John McCardle <mccardle.john@gmail.com> Date: Sun Mar 17 16:29:33 2024 -0400 Fixed render issue with UIGrid / PyTexture: wasn't positioning or scaling properly after fetching sprite commit20f80c4114Author: John McCardle <mccardle.john@gmail.com> Date: Sun Mar 17 16:23:52 2024 -0400 Fixed sprite indexing error in PyTexture; needs non-square sprite tests, but feeling confident! commitafd4ff1925Author: John McCardle <mccardle.john@gmail.com> Date: Sat Mar 16 21:53:24 2024 -0400 good progress, we're building again. Issue with Grid (tile sprite) textures and I think the sprite indexes are being calculated wrong (x and y transposed?) commitbfd33102d1Author: John McCardle <mccardle.john@gmail.com> Date: Sat Mar 16 14:52:35 2024 -0400 Squashed basically all the compile bugs in UISprite, but UIEntity and UIGrid use textures as well, so they need to be fixed too before the project will build again commit47d0e34a17Author: John McCardle <mccardle.john@gmail.com> Date: Sat Mar 16 11:31:39 2024 -0400 Initial PyTexture class no testing done. should enable rectangular (non-square) textures "sprite" method; let's just overwrite sprites with texture coords Hoping to replace awful code like: `self->data->sprite.sprite.setTextureRect(self->data->sprite.itex->spriteCoordinates(val));` with something like: `self->data->sprite = self->data->texture->sprite(val);`
This commit is contained in:
parent
cdaf309272
commit
4ffe438d1b
8 changed files with 295 additions and 164 deletions
|
|
@ -3,9 +3,9 @@ import mcrfpy
|
|||
import cos_play
|
||||
# Universal stuff
|
||||
font = mcrfpy.Font("assets/JetbrainsMono.ttf")
|
||||
texture = mcrfpy.Texture("assets/kenney_tinydungeon.png", 16, 12, 11)
|
||||
texture_cold = mcrfpy.Texture("assets/kenney_ice.png", 16, 12, 11)
|
||||
texture_hot = mcrfpy.Texture("assets/kenney_lava.png", 16, 12, 11)
|
||||
texture = mcrfpy.Texture("assets/kenney_tinydungeon.png", 16, 16) #12, 11)
|
||||
texture_cold = mcrfpy.Texture("assets/kenney_ice.png", 16, 16) #12, 11)
|
||||
texture_hot = mcrfpy.Texture("assets/kenney_lava.png", 16, 16) #12, 11)
|
||||
|
||||
# Test stuff
|
||||
mcrfpy.createScene("boom")
|
||||
|
|
@ -125,7 +125,7 @@ stress_test()
|
|||
mcrfpy.createScene("loading")
|
||||
ui = mcrfpy.sceneUI("loading")
|
||||
#mcrfpy.setScene("loading")
|
||||
logo_texture = mcrfpy.Texture("assets/temp_logo.png", 1024, 1, 1)
|
||||
logo_texture = mcrfpy.Texture("assets/temp_logo.png", 1024, 1024)#1, 1)
|
||||
logo_sprite = mcrfpy.Sprite(50, 50, logo_texture, 0, 0.5)
|
||||
ui.append(logo_sprite)
|
||||
logo_sprite.click = lambda *args: mcrfpy.setScene("menu")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue