dtk_close(3) Create and destroy a window

Other Alias

dtk_create_window

SYNOPSIS

#include <drawtk.h>

dtk_hwnd dtk_create_window(unsigned int width, unsigned int height,
unsigned int x, unsigned int y,
unsigned int bpp, const char *caption);
void dtk_close(const dtk_hwnd wnd);

DESCRIPTION

dtk_create_window() creates a window of size (width,height) to be used later as the target of next drawings. If width or height is zero, then the created window will be full screen. Arguments x and y have currently no effect. bpp specifies the number of "bits per pixel" the underlying OpenGL framebuffer should support. caption specifies the name of the window that the window manager should display.

The inner frame size for drawings depends on the aspect ratio of the window. The origin (0,0) of the frame is always the the center of the window. The smallest dimension of the window is equal to 2 in the drawing coordinates, so that a draw made in the box between (-1,-1) and (1,1) always fits in the window.

dtk_close() destroys an unused window.

RETURN VALUE

dtk_create_window() returns an handle to the created window. On error, this function returns NULL.

dtk_close() returns no value.

LIMITATIONS

For the moment only one window can be created. Any subsequent call to dtk_create_window() will fail. This is due to the underlying SDL version used which supports only one window.