diff --git a/README.md b/README.md index 061465b..818e4fe 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,12 @@ system. Requires the DJGPP cross-compiler (`i586-pc-msdosdjgpp-gcc`). +The GUI is built as a static library (`lib/libdvx.a`). The demo links +against it. + ``` -make # builds bin/demo.exe +cd dvxdemo +make # builds lib/libdvx.a then bin/demo.exe make clean # removes obj/ and bin/ ``` @@ -43,7 +47,9 @@ Supporting files: | `dvxCursor.h` | Mouse cursor bitmask data (5 shapes) | | `dvxPalette.h` | Default VGA palette for 8-bit mode | | `dvxIcon.c` | stb_image implementation unit (BMP/PNG/JPEG/GIF) | +| `dvxImageWrite.c` | stb_image_write implementation unit (PNG export) | | `thirdparty/stb_image.h` | Third-party single-header image loader | +| `thirdparty/stb_image_write.h` | Third-party single-header image writer | ## Quick start @@ -151,6 +157,14 @@ Enter the main event loop. Handles mouse movement, button clicks, keyboard input, window management, dirty-rectangle compositing, and LFB flush. Returns when `dvxQuit()` is called or ESC is pressed. +```c +bool dvxUpdate(AppContextT *ctx); +``` +Process one iteration of the event loop: poll input, dispatch events, +composite dirty regions, and flush. Returns `true` if the GUI is still +running, `false` when exit has been requested. Use this instead of +`dvxRun()` when embedding the GUI inside an existing main loop. + ```c void dvxShutdown(AppContextT *ctx); ``` @@ -451,6 +465,25 @@ WidgetT *wgtTextArea(WidgetT *parent, int32_t maxLen); ``` Multi-line text area (basic). +### Canvas + +```c +WidgetT *wgtCanvas(WidgetT *parent, int32_t w, int32_t h); +``` +Drawable bitmap canvas with a sunken bevel border. Supports freehand +drawing with Bresenham-interpolated strokes. + +```c +void wgtCanvasClear(WidgetT *w, uint32_t color); +void wgtCanvasSetPenColor(WidgetT *w, uint32_t color); +void wgtCanvasSetPenSize(WidgetT *w, int32_t size); +int32_t wgtCanvasSave(WidgetT *w, const char *path); +int32_t wgtCanvasLoad(WidgetT *w, const char *path); +``` +`wgtCanvasSave` writes the canvas to a PNG file (converting from display +pixel format to RGB). `wgtCanvasLoad` reads any image format supported by +stb_image and converts it to display pixel format. + ### Spacing and dividers ```c @@ -522,6 +555,13 @@ void wgtDestroy(WidgetT *w); ``` Remove a widget and all its children from the tree and free memory. +```c +void wgtSetDebugLayout(bool enabled); +``` +When enabled, draws 1px neon-colored borders around all layout containers +so their bounds are visible. Each container gets a distinct color derived +from its pointer. + ### List box operations ```c @@ -605,8 +645,10 @@ Windows use a Motif/GEOS-style frame: Minimized windows appear as 64x64 beveled icons along the bottom of the screen. If a window has an icon image set via `dvxSetWindowIcon()`, that -image is shown; otherwise a nearest-neighbor-scaled snapshot of the window -content is used. Double-click an icon to restore. +image is shown; otherwise a nearest-neighbor-scaled thumbnail of the +window's content buffer is used. Thumbnails are refreshed automatically +when the window's content changes, with updates staggered across frames +so only one icon redraws per interval. Double-click an icon to restore. ---