|
OldSchool Library 1.6.0
|
Functions | |
| static void | oslSetImageFrameSize (OSL_IMAGE *img, u16 width, u16 height) |
| void | oslSetImageFrame (OSL_IMAGE *img, int frame) |
A basic system allowing you to cut your images just as if they were sprites. Frames are drawn with oslDrawImage, which wraps past texel 511: keep sprite sheets within 512x512.
|
inlinestatic |
Defines the size of a frame in an image, preparing it for use as a sprite sheet.
A sprite sheet is an image where multiple sprites (small images) are arranged in a grid. Each sprite in the sheet has the same dimensions, and the grid is typically filled from left to right and top to bottom.
| img | Pointer to the image to be used as a sprite sheet. |
| width | The width of each sprite frame in pixels. |
| height | The height of each sprite frame in pixels. |
For example, if you have a 64x64 image containing 32x32 sprites, the image will be divided into four sprites as follows:
Important: Frames are drawn with oslDrawImage, which samples at most 512 texels per axis (column 512 shows column 0 again), so keep the sprite sheet within 512x512.
|
extern |
Sets the current frame of an image for sprite-based rendering.
This function prepares the image to display a specific frame from a sprite sheet. A sprite sheet is an image where multiple sprites (small images) are arranged in a grid. This function is used to select the sprite frame that you want to draw.
| img | Pointer to the image to set the frame for. |
| frame | The index of the frame to be displayed. Frames are indexed starting from 0. |
Example: