Public Member Functions | |
| __init__ (self, x, y, size) | |
| draw (self, screen, image, zoom_level, offset_x, offset_y) | |
| contains (self, x, y) | |
| get_borders (self, offset) | |
Public Attributes | |
| x | |
| y | |
| size | |
@class Block @brief Represents a block with a position and size. The Block class provides methods for rendering the block on the screen, determining if a point is within the block, and calculating its borders.
| view.block.Block.__init__ | ( | self, | |
| x, | |||
| y, | |||
| size | |||
| ) |
Initializes a Block object. @param x: The x-coordinate of the block. @param y: The y-coordinate of the block. @param size: The size of the block (width and height assumed equal).
| view.block.Block.contains | ( | self, | |
| x, | |||
| y | |||
| ) |
Checks if the given point is within the block. @param x: The x-coordinate of the point. @param y: The y-coordinate of the point. @return: True if the point is within the block, otherwise False.
| view.block.Block.draw | ( | self, | |
| screen, | |||
| image, | |||
| zoom_level, | |||
| offset_x, | |||
| offset_y | |||
| ) |
Draws the block on the screen using the specified image. @param screen: The pygame surface to draw on. @param image: The image to use for rendering the block. @param zoom_level: The current zoom level for scaling the block. @param offset_x: The horizontal offset for positioning the block. @param offset_y: The vertical offset for positioning the block.
| view.block.Block.get_borders | ( | self, | |
| offset | |||
| ) |
Calculates the borders of the block, adjusted by the given offset. @param offset: A tuple (offset_x, offset_y) to adjust the borders. @return: A tuple containing the top-left and bottom-right coordinates of the block.
| view.block.Block.size |
| view.block.Block.x |
| view.block.Block.y |