4 {
5 printf("Initializing SBgl Mouse Input Test...\n");
6 printf("Controls: Move Mouse to change color, ESC=Exit\n");
7
8 int width = 800;
9 int height = 600;
12 printf(
"Failed to init: %d\n", res.
error);
13 return 1;
14 }
15
17
19
21
22
24
25
26
27
28 float r = (float)input->
mouseX / (
float)width;
29 float g = (float)input->
mouseY / (
float)height;
30 float b = 0.5f;
31
32
33 if (r < 0.0f) {
34 r = 0.0f;
35 }
36 if (r > 1.0f) {
37 r = 1.0f;
38 }
39 if (g < 0.0f) {
40 g = 0.0f;
41 }
42 if (g > 1.0f) {
43 g = 1.0f;
44 }
45
46
48
50
52
54 break;
55 }
56 }
57
60 return 0;
61}
sbgl_InitResult sbgl_Init(int w, int h, const char *title)
Initializes the engine and opens a window.
void sbgl_GetWindowSize(sbgl_Context *ctx, int *w, int *h)
Retrieves the current window dimensions.
bool sbgl_WindowShouldClose(sbgl_Context *ctx)
Checks if the user or OS has requested to close the window.
const sbgl_InputState * sbgl_GetInputState(sbgl_Context *ctx)
Retrieves the input state for the current frame.
void sbgl_EndDrawing(sbgl_Context *ctx)
Finalizes the current frame and presents it to the screen.
#define sbgl_Clear
Backward compatibility alias for sbgl_SetClearColor.
void sbgl_DeviceWaitIdle(sbgl_Context *ctx)
Synchronizes the CPU with the GPU, waiting for all commands to complete.
void sbgl_Shutdown(sbgl_Context *ctx)
Gracefully shuts down the engine and releases all resources.
void sbgl_BeginDrawing(sbgl_Context *ctx)
Prepares the engine for a new frame of drawing.
Result structure for initialization.