ACSUtils Wiki

An ACS library for ZDoom-based ports

User Tools

Site Tools


functions:setcursorarea

Table of Contents

SetCursorArea

void SetCursorArea(fixed width, fixed height)

Description

Sets the size of the cursor coordinate system. The coordinate system used by the cursor matches the HUD coordinate system.

Cursor position is fully fixed-point, even SetCursorArea(1.0, 1.0) will work correctly.

When this function is called, cursor position is changed so that the cursor remains in the same place on screen after coordinate system change.

The default size is 640×480 (SetCursorArea(640.0, 480.0)).

Use the same coordinate system for both the cursor and the hud, like this:
SetCursorArea(640.0, 480.0);
SetHudSize(640, 480, 0);

Or, using HUD Library:

SetCursorArea(640.0, 480.0);
HudSetVirtualSize(640.0, 480.0);

Examples

// The cursor is in the center of the screen.
SetCursorArea(640.0, 480.0);
CursorX() -> 320.0
SetCursorArea(320.0, 240.0);
CursorX() -> 160.0
SetCursorArea(1.0, 1.0);
CursorX() -> 0.5
functions/setcursorarea.txt · Last modified: 2017/06/15 15:20 by korshun