#include <SDL2/SDL.h>
Go to the source code of this file.
◆ anchore_point
typedef struct anchore_point anchore_point |
◆ anchore_to_rect()
SDL_Rect anchore_to_rect |
( |
SDL_Window * | window, |
|
|
anchore_point | anchore ) |
Converts an anchore_point to an SDL_Rect based on the window size.
This function takes an anchore_point structure and converts it into an SDL_Rect structure. The conversion is based on the size of the given SDL_Window. The resulting SDL_Rect will be positioned and sized according to the anchore_point's properties.
- Parameters
-
window | A pointer to the SDL_Window from which the size will be obtained. |
anchore | The anchore_point structure containing the anchoring information. |
- Returns
- SDL_Rect The resulting SDL_Rect structure after conversion.
◆ get_surface_full_rect()
SDL_Rect get_surface_full_rect |
( |
SDL_Surface * | surface | ) |
|
Gets the full rectangle of an SDL_Surface.
This function returns an SDL_Rect structure that represents the full area of the given SDL_Surface. The rectangle's position will be set to (0, 0) and its width and height will match the surface's width and height.
- Parameters
-
surface | A pointer to the SDL_Surface from which the rectangle will be obtained. |
- Returns
- SDL_Rect The resulting SDL_Rect structure representing the full area of the surface.
◆ pixel_to_pourcent_anchore()
Converts pixel-based anchore_point offsets to percentage-based offsets.
This function takes an anchore_point structure with pixel-based offsets and converts them to percentage-based offsets relative to the size of the given SDL_Window. The resulting anchore_point will have its offsets expressed as percentages of the window's width and height.
- Parameters
-
window | A pointer to the SDL_Window from which the size will be obtained. |
anch | The anchore_point structure containing the pixel-based offsets. |
- Returns
- anchore_point The resulting anchore_point structure with percentage-based offsets.
◆ rect_to_anchore()
Converts an SDL_Rect to an anchore_point.
This function takes an SDL_Rect structure and converts it into an anchore_point structure. The conversion is based on the position and size of the given SDL_Rect. The resulting anchore_point will have its offsets set according to the SDL_Rect's properties.
- Parameters
-
rect | The SDL_Rect structure containing the rectangle information. |
- Returns
- anchore_point The resulting anchore_point structure after conversion.
◆ render_full_anchored_image_file()
void render_full_anchored_image_file |
( |
const char * | file, |
|
|
SDL_Renderer * | renderer, |
|
|
SDL_Window * | window, |
|
|
anchore_point | anchore ) |
Renders an image file to the renderer using an anchore_point for positioning.
This function renders an image file to the specified SDL_Renderer. The image is positioned and sized according to the provided anchore_point structure, which is converted to an SDL_Rect based on the size of the given SDL_Window.
- Parameters
-
file | The path to the image file to be rendered. |
renderer | A pointer to the SDL_Renderer where the image will be rendered. |
window | A pointer to the SDL_Window from which the size will be obtained. |
anchore | The anchore_point structure containing the anchoring information. |
◆ to_positive_rect()
SDL_Rect to_positive_rect |
( |
SDL_Rect | rect | ) |
|
Converts an SDL_Rect to a positive SDL_Rect.
This function takes an SDL_Rect structure and ensures that its width and height are positive values. If the width or height is negative, it adjusts the x or y position accordingly and converts the width or height to a positive value.
- Parameters
-
rect | The SDL_Rect structure to be converted. |
- Returns
- SDL_Rect The resulting SDL_Rect structure with positive width and height.