---
name: "dtk_create_window"
section: "3"
platform: "linux"
package: "libdrawtk-dev"
version: "2.0-2.1"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/dtk_create_window"
---

# dtk\_create\_window(3)

Create and destroy a window

## NAME

dtk\_create\_window, dtk\_close - Create and destroy a 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.

## SEE ALSO

[**dtk\_make\_current\_window**(3)](/dtk_make_current_window/3.md), [**dtk\_update\_screen**(3)](/dtk_update_screen/3.md), [**dtk\_process\_events**(3)](/dtk_process_events/3.md)
