Double buffering

This is an example, how to do and use double buffering (offscreen window) to create smooth animations

WinHandle displayWindow;
WinHandle offscreenWindow;

void CreateOffScreen() {
    Err err;
    offscreenWindow = WinCreateOffscreenWindow(160,160, screenFormat, &err);
}

void PaintOffScreen() {
    WinSetDrawWindow(offscreenWindow);
    // draw there
}

void Show() {
    RectangleType bounds;

    WinSetDrawWindow(displayWindow);
    WinGetBounds(displayWindow, &bounds);
    WinCopyRectangle (offscreenWindow, 0, &bounds, 0, 0, 0);
}