Contents

TwWindowSize (function)

int TwWindowSize(int width, int height)

Description

Call this function to inform AntTweakBar of the size of the application graphics window, or to restore AntTweakBar graphics resources (after a fullscreen switch for instance).

This function is time consuming because it restores graphics resources (such as textures needed by AntTweakBar to display text efficiently), so it must be called only when necessary: when the size of the application graphics window has changed, or when the graphics context has been restored (if graphics mode has changed for instance).

Note that if you are using SDL, GLUT, GLFW or Windows (DirectX), the library provides some helper functions to handle events like window resizing. See the section how to integrate for more details.

The size must be the actual client size of the graphics window, excluding system menu and other decorations. For instance on windows GetClientRect can be used:

RECT r;
GetClientRect(hWnd, &r);
TwWindowSize(r.right - r.left, r.bottom - r.top);

If you need to release the graphics resources allocated by AntTweakBar, call TwWindowSize(0,0); For instance this might be useful when Direct3D requires resources to be released before resizing its render target.

Parameters

width

Width of the graphics window.

height

Height of the graphics window.

Return value

See also

TwDraw, How to integrate