18int main(
int,
char **);
30 __attribute__((export_name(
"gama_run")))
54void gm_logo(
double x,
double y,
double s) {
55 double top_thickness = 0.15 * s;
56 double left_thickness = 0.1 * s;
78static inline int gm_runs() {
return gapi_runs(); }
102static inline int gm_yield() {
103 static const double alpha = 2.0 / 3.0;
104 static double _fps = 0;
105 static double dt = 1;
106 static double _display_fps = 0;
107 double current_dt = gm_dt();
109 double fps = 1 / current_dt;
115 _fps = (_fps * alpha) + (fps * (1 - alpha));
122 char fps_text[20] = {0};
123 snprintf(fps_text,
sizeof(fps_text),
"fps: %.2f", _display_fps);
135 static int last_mouse_down = 0;
145static inline void gm_quit() {
return gapi_quit(); }
171void gm_init(
int width,
int height,
const char *title) {
172 int code =
gapi_init(width, height, title);
176 snprintf(msg,
sizeof(msg),
177 "Error starting gama, initialization exited with non zero code %d",
199void gm_sleep(
int milliseconds) { Sleep(milliseconds); }
202void gm_sleep(
int milliseconds) { usleep(milliseconds * 1000); }
#define GM_GAMA
The official Gama brand color.
Definition color.h:167
#define GM_BLACK
Black color.
Definition color.h:207
#define GM_WHITE
White color.
Definition color.h:892
uint32_t gmColor
Type definition for color values, stored as a 32-bit unsigned integer. The color components are packe...
Definition color.h:13
Functions for drawing shapes, text, and images.
int32_t gm_draw_text(double x, double y, const char *text, const char *font, double font_size, gmColor c)
Draws text centered at a point.
Definition draw.h:140
int32_t gm_draw_rectangle(double x, double y, double w, double h, gmColor c)
Draws a rectangle centered at a point.
Definition draw.h:57
Defines the theme and functionality for a frame widget.
int gmw_frame(double x, double y, double width, double height)
Creates and renders a frame widget (a bordered panel).
Definition frame.h:80
void gm_log(const char *txt)
Logs a message to the platform's console.
Definition gama.h:70
void gm_show_fps(int show)
Definition gama.h:85
int __gm_show_fps
Enables or disables the built-in FPS counter display.
Definition gama.h:84
void gm_resize(int width, int height)
Resizes the application window.
Definition gama.h:159
void gm_logo(double x, double y, double s)
Draws the Gama logo.
Definition gama.h:54
void gm_sleep(int milliseconds)
Pauses execution for a specified duration.
Definition gama.h:202
void gm_fullscreen(int fullscreen)
Puts the window in fullscreen.
Definition gama.h:45
void gm_background(gmColor c)
Sets the background color of the window.
Definition gama.h:151
int32_t gama_run()
Definition gama.h:32
void gm_init(int width, int height, const char *title)
Initializes the Gama engine and opens a window.
Definition gama.h:171
Graphics API (GAPI) abstraction layer for Gama.
int32_t gapi_mouse_down()
Checks if the mouse button is currently pressed.
double _gm_dt
Definition gapi.h:20
void gapi_fullscreen(const int32_t fullscreen)
Toggles fullscreen mode for the application window.
double _gm_t
Definition gapi.h:26
int32_t gapi_init(const int32_t width, const int32_t height, const char *title)
Initializes the Graphics API and the application window.
void gapi_resize(const int32_t width, const int32_t height)
Resizes the application window.
void gapi_log(const char *message)
Logs a message to the platform's console.
void gapi_quit()
Requests the application to quit.
int32_t gapi_yield(double *dt)
Yields control to the platform, processes events, and updates timing.
int32_t gapi_runs()
Checks if the application is still running.
int32_t gapi_mouse_get(double *x, double *y)
Retrieves the current mouse cursor position.
void gapi_set_background_color(const gmColor background)
Sets the background color of the application window.
struct _gmMouse gm_mouse
Definition mouse.h:32