libGumball 0.0.1
C23-Based, libGimbal-powered UI Library
Loading...
Searching...
No Matches
gumball_backend.h
Go to the documentation of this file.
1#ifndef GUM_BACKEND_H
2#define GUM_BACKEND_H
3
4// View this file's documentation online: https://libgumball.psyops.studio/gumball__backend_8h.html
5
6/*! \file
7 * \brief Abstract backend functions
8 * \ingroup core
9 *
10 * \todo
11 * - Add support for audio and fonts
12 * - Texture rotation
13 *
14 * \author 2025 Agustín Bellagamba
15 * \copyright MIT License
16*/
17
18#include <gimbal/gimbal_strings.h>
19#include <gumball/elements/gumball_controller.h>
20#include <gumball/gumball_types.h>
21
22GBL_DECLS_BEGIN
23
24//! Polls input
25GBL_RESULT GUM_Backend_pollInput (GUM_Controller *pController);
26//! Draws a rectangle, can optionally be rounded
27GBL_RESULT GUM_Backend_rectangleDraw (GUM_Renderer *pRenderer, GUM_Rectangle rectangle, float roundness, GUM_Color color);
28//! Draws a rectangle outline, can optionally be rounded
29GBL_RESULT GUM_Backend_rectangleLinesDraw (GUM_Renderer *pRenderer, GUM_Rectangle rectangle, float roundness, float border_width, GUM_Color color);
30//! Overrides the library's logger with libGumball's logger
32
33//! Loads a texture
34GBL_RESULT GUM_Backend_Texture_load (GUM_IResource *pResource, GblStringRef *pPath);
35//! Unloads a texture
36GBL_RESULT GUM_Backend_Texture_unload (GUM_IResource *pResource);
37//! Draws a texture
38GBL_RESULT GUM_Backend_Texture_draw (GUM_Renderer *pRenderer, GUM_Texture *pTexture, GUM_Rectangle rectangle, GUM_Color color);
39
40//! Loads a font
41GBL_RESULT GUM_Backend_Font_load (GUM_IResource *pResource, GblStringRef *pPath);
42//! Unloads a font
43GBL_RESULT GUM_Backend_Font_unload (GUM_IResource *pResource);
44//! Draws text
45GBL_RESULT GUM_Backend_Font_draw (GUM_Renderer *pRenderer, GUM_Font *pFont, GblStringRef *pText, GUM_Vector2 position, GUM_Color color, int fontSize, float spacing);
46//! Measures text size given a font, text and font size
47GBL_RESULT GUM_Backend_Font_measureText (GUM_Font *pFont, GblStringRef *pText, uint8_t fontSize);
48//! Returns a pointer to the default font
50
51
52GBL_DECLS_END
53
54#endif // GUM_BACKEND_H
GBL_RESULT GUM_Backend_Font_measureText(GUM_Font *pFont, GblStringRef *pText, uint8_t fontSize)
Measures text size given a font, text and font size.
GBL_RESULT GUM_Backend_Font_load(GUM_IResource *pResource, GblStringRef *pPath)
Loads a font.
GUM_Font * GUM_Backend_Font_default(void)
Returns a pointer to the default font.
GBL_RESULT GUM_Backend_rectangleDraw(GUM_Renderer *pRenderer, GUM_Rectangle rectangle, float roundness, GUM_Color color)
Draws a rectangle, can optionally be rounded.
GBL_RESULT GUM_Backend_Texture_load(GUM_IResource *pResource, GblStringRef *pPath)
Loads a texture.
GBL_RESULT GUM_Backend_Texture_unload(GUM_IResource *pResource)
Unloads a texture.
GBL_RESULT GUM_Backend_Font_unload(GUM_IResource *pResource)
Unloads a font.
void GUM_Backend_setLogger(void)
Overrides the library's logger with libGumball's logger.
GBL_RESULT GUM_Backend_Font_draw(GUM_Renderer *pRenderer, GUM_Font *pFont, GblStringRef *pText, GUM_Vector2 position, GUM_Color color, int fontSize, float spacing)
Draws text.
GBL_RESULT GUM_Backend_rectangleLinesDraw(GUM_Renderer *pRenderer, GUM_Rectangle rectangle, float roundness, float border_width, GUM_Color color)
Draws a rectangle outline, can optionally be rounded.
GBL_RESULT GUM_Backend_Texture_draw(GUM_Renderer *pRenderer, GUM_Texture *pTexture, GUM_Rectangle rectangle, GUM_Color color)
Draws a texture.