libGumball 0.0.2
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
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//! Resets the library's logger back to the default
34//! Begins scissor mode
35GBL_RESULT GUM_Backend_beginScissor(GUM_Renderer *pRenderer, GUM_Rectangle clipRect);
36//! Ends scissor mode
37GBL_RESULT GUM_Backend_endScissor(GUM_Renderer *pRenderer);
38
39//! Loads a texture
40GBL_RESULT GUM_Backend_Texture_load (GUM_IResource *pResource, GblStringRef *pPath);
41//! Unloads a texture
42GBL_RESULT GUM_Backend_Texture_unload (GUM_IResource *pResource);
43//! Draws a texture
44GBL_RESULT GUM_Backend_Texture_draw (GUM_Renderer *pRenderer, GUM_Texture *pTexture, GUM_Rectangle rectangle, GUM_Color color);
45
46//! Loads a font
47GBL_RESULT GUM_Backend_Font_load (GUM_IResource *pResource, GblStringRef *pPath);
48//! Unloads a font
49GBL_RESULT GUM_Backend_Font_unload (GUM_IResource *pResource);
50//! Draws text
51GBL_RESULT GUM_Backend_Font_draw (GUM_Renderer *pRenderer, GUM_Font *pFont, GblStringRef *pText, GUM_Vector2 position, GUM_Color color, int fontSize, float spacing);
52//! Measures text size given a font, text and font size
53GBL_RESULT GUM_Backend_Font_measureText (GUM_Font *pFont, GblStringRef *pText, uint8_t fontSize);
54//! Returns a pointer to the default font
56
57//! Returns the current timestamp in miliseconds since the program started
59
60GBL_DECLS_END
61
62#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.
void GUM_Backend_resetLogger(void)
Resets the library's logger back to the default.
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_beginScissor(GUM_Renderer *pRenderer, GUM_Rectangle clipRect)
Begins scissor mode.
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_endScissor(GUM_Renderer *pRenderer)
Ends scissor mode.
GBL_RESULT GUM_Backend_Texture_draw(GUM_Renderer *pRenderer, GUM_Texture *pTexture, GUM_Rectangle rectangle, GUM_Color color)
Draws a texture.
uint32_t GUM_Backend_timestamp(void)
Returns the current timestamp in miliseconds since the program started.