Utility functions for tile-based environment. More...
Functions | |
| void | Tile_FromPixelPoint (Vec2 pixelPoint, Vec2 *chunkIndex, Vec2 *tileIndex) |
| [Utility] Converts a pixel position to tile and chunk indices | |
| bool | Tile_IsValid (Vec2 tileIndex) |
| [Utility] Checks if a tile index is valid within a chunk | |
| Vec2 | Tile_GetPositionFromPixel (Vec2 pixelPoint) |
| [Utility] Converts a pixel point to a tile position | |
| SDL_Rect | Tile_GetRectFromPixel (Vec2 pixelPoint) |
| [Utility] Gets the rectangle for a tile from a pixel point | |
| Vec2 | Tile_GetRandomPixelInRect (SDL_Rect rect) |
| [Utility] Gets a random pixel coordinate within a rectangle | |
| Vec2 | Tile_TileIndexToPixel (Vec2 tileIndex, Vec2 chunkIndex) |
| [Utility] Converts tile and chunk indices to a world pixel position | |
Utility functions for tile-based environment.
Provides coordinate conversion, validation, and helper functions for the tile-based environment system.
[Utility] Converts a pixel position to tile and chunk indices
Convert a pixel coordinate to tile and chunk indices.
Takes a world-space pixel coordinate and determines which tile and chunk it belongs to.
| pixelPoint | The world position in pixels |
| chunkIndex | Output parameter for the chunk index |
| tileIndex | Output parameter for the tile index within the chunk |
[Utility] Converts a pixel point to a tile position
Convert a pixel coordinate to a tile position.
| pixelPoint | The pixel coordinates to convert |
| Vec2 Tile_GetRandomPixelInRect | ( | SDL_Rect | rect | ) |
[Utility] Gets a random pixel coordinate within a rectangle
Get a random pixel coordinate within a rectangle.
| rect | The rectangle to get a random point within |
| SDL_Rect Tile_GetRectFromPixel | ( | Vec2 | pixelPoint | ) |
[Utility] Gets the rectangle for a tile from a pixel point
Get the rectangle of a tile from a pixel coordinate.
| pixelPoint | The pixel coordinates within the tile |
| bool Tile_IsValid | ( | Vec2 | tileIndex | ) |
[Utility] Checks if a tile index is valid within a chunk
Check if a tile index is valid.
| tileIndex | The tile index to check |