Impossible SDK

Reference

impossible/window.h

One window whose program paints every pixel.

Tier 1

im_canvas

The pixels of a window while it is painted.

impossible/window.h, line 6
typedef struct im_canvas {
    uint32_t *pixels; /* 0x00RRGGBB, top row first, width pixels per row */
    int width, height;
    float scale; /* 1.0 at 96 DPI */
} im_canvas;

im_event_kind

What the user did.

impossible/window.h, line 13
typedef enum im_event_kind { IM_POINTER_MOVE, IM_POINTER_DOWN, IM_POINTER_UP, IM_KEY_DOWN } im_event_kind;

im_event

One thing the user did, where, or with which key.

impossible/window.h, line 16
typedef struct im_event {
    im_event_kind kind;
    int x, y; /* pixels */
    int key;  /* Windows virtual key, for IM_KEY_DOWN */
} im_event;

im_window

Fill in from title to event; the rest belongs to the kit and starts as zero.

impossible/window.h, line 23
typedef struct im_window {
    const wchar_t *title;
    int width, height; /* client size at 96 DPI, 1 to 32767 */
    void *user;
    void (*paint)(struct im_window *window, im_canvas *canvas);
    bool (*event)(struct im_window *window, const im_event *event); /* true repaints; may be NULL */
    void *native;
    uint32_t *buffer;
    size_t capacity;
    bool painted; /* a frame has reached the screen */
    bool failed;
} im_window;

im_window_run

Opens the window and runs it until it closes. False when it could not be opened or drawn. With one_frame it closes itself after the first frame.

impossible/window.h, line 38
bool im_window_run(im_window *window, bool one_frame);
GeneratedMade from include/impossible/window.hPublished from b1dc570