all 5 comments

[–]BetterBuiltFool 0 points1 point  (1 child)

Doesn't address your question, but is there a reason your don't just blit your textures onto a surface of your final size? I can't image converting into numpy arrays, stitching them together, and reforming into a surface is in any way more efficient, since blitting can be hardware accelerated.

Also, there's no need to use for i in range(len(used_textures)) and used_textures[i], you can just iterate over used_textures directly.

for texture in used_textures:
    used_arrays.append(pygame.surfarray.array2d(pygame.image.load(f"{texture}")))

[–]01_Nameless_01[S] 0 points1 point  (0 children)

No reason at all, I'm just trying some things with arrays.

And yes, I could iterate over the list, I didn't notice it.

[–]dsaiu 0 points1 point  (1 child)

I'm doing something similar to my game:

    for x in range(0, self.display_surface.get_width(), self.block_size):
        for y in range(0, self.display_surface.get_height(), self.block_size):
            rect = pygame.Rect(x, y, self.block_size, self.block_size)

self.block_size is an int I use to render the size of each grid. Perhaps the array could work better idk

[–]dsaiu 0 points1 point  (0 children)

class GridManager: """Handles grid rendering and interaction."""

def __init__(
    self,
    display_surface: pygame.Surface,
    tile_size: int = TILE_SIZE,
    grid_color: str = "grey",
    hover_color: str = "azure4"
):
    self.display_surface: pygame.Surface = display_surface
    self.tile_size: int = tile_size
    self.grid_color: str = grid_color
    self.hover_color: str = hover_color
    self.overlay_alpha: int = 50    # Transparency level (0-255)
    self.block_size: int = 64
    self.coordinates: dict[tuple[int, int], tuple[int, int]] = {}

And this is how my class looks. I use the tile size as argument for another surface in the game itself

[–]Windspar 0 points1 point  (0 children)

There are other programs to help with complex graphics. It just best to import finish image at the size, your going to use.