SBgl 0.1.0
A graphics framework in C99
Loading...
Searching...
No Matches
hello_window.c
Go to the documentation of this file.
1#include <sbgl.h>
2
3int main(void) {
4 sbgl_InitResult res = sbgl_Init(800, 600, "SBgl Hello Window");
5 if (res.error != SBGL_SUCCESS) return 1;
6 sbgl_Context* ctx = res.ctx;
7
8 while (!sbgl_WindowShouldClose(ctx)) {
9 if (sbgl_GetInputState(ctx)->keysDown[SBGL_KEY_ESCAPE]) break;
10
11 sbgl_Clear(ctx, 0.1f, 0.2f, 0.3f, 1.0f);
13 sbgl_EndDrawing(ctx);
14 }
15
16 sbgl_Shutdown(ctx);
17 return 0;
18}
int main(void)
Definition hello_window.c:3
API for the SiputBiru Graphics Library (SBgl).
sbgl_InitResult sbgl_Init(int w, int h, const char *title)
Initializes the engine and opens a window.
Definition sbgl_core.c:193
bool sbgl_WindowShouldClose(sbgl_Context *ctx)
Checks if the user or OS has requested to close the window.
Definition sbgl_core.c:238
const sbgl_InputState * sbgl_GetInputState(sbgl_Context *ctx)
Retrieves the input state for the current frame.
Definition sbgl_core.c:413
void sbgl_EndDrawing(sbgl_Context *ctx)
Finalizes the current frame and presents it to the screen.
Definition sbgl_core.c:315
#define SBGL_KEY_ESCAPE
Definition sbgl.h:84
#define sbgl_Clear
Backward compatibility alias for sbgl_SetClearColor.
Definition sbgl.h:229
void sbgl_Shutdown(sbgl_Context *ctx)
Gracefully shuts down the engine and releases all resources.
Definition sbgl_core.c:204
void sbgl_BeginDrawing(sbgl_Context *ctx)
Prepares the engine for a new frame of drawing.
Definition sbgl_core.c:262
@ SBGL_SUCCESS
Definition sbgl_types.h:215
Engine context.
Definition sbgl_types.h:268
Result structure for initialization.
Definition sbgl_types.h:339
sbgl_Context * ctx
Definition sbgl_types.h:340
sbgl_Result error
Definition sbgl_types.h:341