### fenster_pixel Source: https://github.com/zserge/fenster/blob/main/README.md Sets or gets a pixel color in the framebuffer. Can be used as an lvalue to set a pixel, or as an rvalue to get a pixel. ```APIDOC ## fenster_pixel ### Description Sets or gets a pixel color in the framebuffer. Can be used as an lvalue to set a pixel, or as an rvalue to get a pixel. ### Method C macro/function ### Signature `fenster_pixel(f, x, y)` ### Parameters - **f** (struct fenster*) - Required - Pointer to the fenster structure. - **x** (int) - Required - X coordinate of the pixel. - **y** (int) - Required - Y coordinate of the pixel. ### Return Value - **uint32_t** - The pixel color in 24-bit RGB format (0xRRGGBB). ``` -------------------------------- ### fenster_open Source: https://github.com/zserge/fenster/blob/main/README.md Opens a new application window with the specified title, dimensions, and framebuffer. Returns an integer status code. ```APIDOC ## fenster_open ### Description Opens a new application window with the specified title, dimensions, and framebuffer. Returns an integer status code. ### Method C function ### Signature `int fenster_open(struct fenster *f)` ### Parameters - **f** (struct fenster*) - Required - Pointer to the fenster structure containing window configuration (title, width, height, buffer). ### Return Value - **int** - Status code (0 on success, non-zero on failure). ``` -------------------------------- ### Draw white noise with Fenster Source: https://github.com/zserge/fenster/blob/main/README.md Creates a 320x240 window and fills it with random pixels in a polling loop. Compile with the platform-specific linker flags shown below. ```c // main.c #include "fenster.h" #define W 320 #define H 240 int main() { uint32_t buf[W * H]; struct fenster f = { .title = "hello", .width = W, .height = H, .buf = buf }; fenster_open(&f); while (fenster_loop(&f) == 0) { for (int i = 0; i < W; i++) { for (int j = 0; j < H; j++) { fenster_pixel(&f, i, j) = rand(); } } } fenster_close(&f); return 0; } ``` ```bash # Linux cc main.c -lX11 -lasound -o main && ./main # macOS cc main.c -framework Cocoa -framework AudioToolbox -o main && ./main # windows cc main.c -lgdi32 -lwinmm -o main.exe && main.exe ``` -------------------------------- ### Fenster struct definition Source: https://github.com/zserge/fenster/blob/main/README.md Defines the main window structure with framebuffer, input state, and mouse data. Keys are mostly ASCII with arrows mapped to 17..20; mod is a 4-bit mask (ctrl=1, shift=2, alt=4, meta=8). ```c struct fenster { const char *title; /* window title */ const int width; /* window width */ const int height; /* window height */ uint32_t *buf; /* window pixels, 24-bit RGB, row by row, pixel by pixel */ int keys[256]; /* keys are mostly ASCII, but arrows are 17..20 */ int mod; /* mod is 4 bits mask, ctrl=1, shift=2, alt=4, meta=8 */ int x; /* mouse X coordinate */ int y; /* mouse Y coordinate */ int mouse; /* 0 = no buttons pressed, 1 = left button pressed */ }; ``` -------------------------------- ### fenster_close Source: https://github.com/zserge/fenster/blob/main/README.md Closes the window and exits the graphical application. ```APIDOC ## fenster_close ### Description Closes the window and exits the graphical application. ### Method C function ### Signature `void fenster_close(struct fenster *f)` ### Parameters - **f** (struct fenster*) - Required - Pointer to the fenster structure. ### Return Value None. ``` -------------------------------- ### fenster_loop Source: https://github.com/zserge/fenster/blob/main/README.md Handles system events and refreshes the canvas. Returns a negative value when the application window is closed. ```APIDOC ## fenster_loop ### Description Handles system events and refreshes the canvas. Returns a negative value when the application window is closed. ### Method C function ### Signature `int fenster_loop(struct fenster *f)` ### Parameters - **f** (struct fenster*) - Required - Pointer to the fenster structure. ### Return Value - **int** - 0 if the loop should continue, negative if the window is closed. ``` -------------------------------- ### fenster_time Source: https://github.com/zserge/fenster/blob/main/README.md Returns the current time in milliseconds. ```APIDOC ## fenster_time ### Description Returns the current time in milliseconds. ### Method C function ### Signature `int64_t fenster_time()` ### Parameters None. ### Return Value - **int64_t** - Current time in milliseconds. ``` -------------------------------- ### fenster_sleep Source: https://github.com/zserge/fenster/blob/main/README.md Pauses execution for a specified number of milliseconds. ```APIDOC ## fenster_sleep ### Description Pauses execution for a specified number of milliseconds. ### Method C function ### Signature `void fenster_sleep(int ms)` ### Parameters - **ms** (int) - Required - Number of milliseconds to pause. ### Return Value None. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.