libGumball 0.0.1
C23-Based, libGimbal-powered UI Library
Loading...
Searching...
No Matches
gumball_manager.h
Go to the documentation of this file.
1#ifndef GUM_MANAGER_H
2#define GUM_MANAGER_H
3
4// View this file's documentation online: https://libgumball.psyops.studio/gumball__manager_8h.html
5
6/*! \file
7 * \ingroup core
8 *
9 * GUM_Manager is a resource manager for libGumball.
10 * It is used to load resources, returning refcounted pointers to them.
11 *
12 * \todo
13 * - Add support for audio and fonts
14 * - Back resources with a GblArena
15 *
16 * \author 2025 Agustín Bellagamba
17 * \copyright MIT License
18*/
19
20#include <gimbal/gimbal_meta.h>
21#include <gumball/ifaces/gumball_iresource.h>
22
23
24#define GUM_MANAGER_TYPE (GBL_TYPEID(GUM_Manager)) //!< Returns the GUM_Manager Type UUID
25#define GBL_SELF_TYPE GUM_Manager
26
27GBL_DECLS_BEGIN
28GBL_FORWARD_DECLARE_STRUCT(GUM_Manager);
29
30/*! \struct GUM_ManagerClass
31 * \extends GblStaticClass
32 * \brief GUM_Manager structure
33 *
34 * GUM_ManagerClass derives from GblStaticClass,
35 * adding nothing new to it.
36 *
37*/
38//! \cond
39GBL_STATIC_CLASS_DERIVE_EMPTY(GUM_Manager)
40
41GblType GUM_Manager_type(void);
42//! \endcond
43
44//! Loads a resource from the given path, and stores it in the internal hashset. If the resource has already been loaded, returns a reference to the existing resource.
45GBL_EXPORT GUM_IResource *GUM_Manager_load(GblStringRef *path) GBL_NOEXCEPT;
46
47//! Unloads a resource from the manager, removing it from the internal hashset.
48GBL_EXPORT void GUM_Manager_unload(GUM_IResource *pResource) GBL_NOEXCEPT;
49
50GBL_DECLS_END
51#undef GBL_SELF_TYPE
52
53#endif // GUM_MANAGER_H
GBL_EXPORT void GUM_Manager_unload(GUM_IResource *pResource) GBL_NOEXCEPT
Unloads a resource from the manager, removing it from the internal hashset.