hWndParent
hWndTarget
pRectTarget
Through these variables a parent window, a target window, and the pointer to a target RECT can be set.
LC
Range:
NULL - engine renders onto its own window (default).
Nonzero - engine renders onto the given target window, using the area given by
the RECT pointer,
and using the given parent window.
If pRectTarget is NULL, the engine renders onto the whole client
area of the target window.
Type:
HWND
RECT*
Remarks:
- d3d_lockable must be redefined at 1 in order to render into a
target window.
-
When rendering into a target window, the engine's own window (hWnd variable) still determines the render resolution. A7.20 When this is not desired, the engine window can be minimized or destroyed. In the latter case the hWnd pointer must then also be set to the target window. All functions affecting the engine window (such as video_set) are then redirected to the target window. Additionally, the engine message loop (on_message) should be called by the target window's message loop for catching keyboard input.
-
The window area outside pRectTarget is not overwritten and keeps its original content. Windows GDI or GDI+ functions can write into it. This way, DirectX and GDI functions can use the same window.
-
The parent window is only set at the next video_window call. For setting it immediately, use the SetParent function of the Windows API.
Example (lite-C):
// render into a 200x200 rectangle of the engine window
function main()
{
d3d_lockable = 1;
camera.size_x = 200;
camera.size_y = 200;
static RECT rect; // must be static for preserving the content
pRectTarget = ▭
rect.left = 100;
rect.right = rect.left + camera.size_x;
rect.top = 100;
rect.bottom = rect.top + camera.size_y;
...
See also:
d3d_lockable, on_message, hWnd
► latest
version online