This is an old revision of the document!
This is a simple library that implements the mouse cursor in ACS.
This library takes into account the player's mouse sensitivity and Y invert settings to make the cursor work the same regardless of the settings.
Serverside cursors are very laggy in mods that use them and can't take the player's settings into account, so we chose to not support serverside cursors.
“puke 1” to test.
// puke 1 to test script 1 (void) { // Do not let the player to rotate the camera while using your cursor. SetPlayerProperty(0, true, PROP_TOTALLYFROZEN); // You can reset cursor settings here. CenterCursor(); SetCursorSpeed(2.0); while (true) { // Get mouse input. UpdateCursor(); // Draw the cursor. HudSetPoint(CursorX(), CursorY()); HudDrawText(1, "*"); } }
The cursor's coordinates system matches that of HudMessages with SetHudSize.
void UpdateCursor()
Updates the cursor position using the input from ConsolePlayer (current computer).
fixed CursorX()
Returns the cursor's X position.
fixed CursorY()
Returns the cursor's Y position.
void CenterCursor()
Centers the cursor on the screen.
void SetCursorPosition(fixed x, fixed y)
Sets the cursor's position.
void SetCursorSpeed(fixed speed)
Sets the cursor's current speed multiplier.
Default is 1.0.
void SetCursorSpeedX(fixed speed)
Sets the cursor's current X speed multiplier.
Default is 1.0.
void SetCursorSpeedY(fixed speed)
Sets the cursor's current Y speed multiplier.
Default is 1.0.
void EnableCursorWrap(bool enable)
If enabled, the cursor when moved outside the screen, will teleport to the opposite edge of the screen.
void SetCursorArea(fixed width, fixed height)
Sets the coordinate system for the cursor. You can use any size from 1.0 to several thousands for any axis. When SetCursorArea
is called, the cursor is moved so that its relative position stays the same.
Default is 640×480.
fixed CursorDeltaX()
Returns the last change in cursor's X position.
fixed CursorDeltaY()
Returns the last change in cursor's Y position.
void SetCursorSpeed(fixed speed)
Sets the speed of cursor that multiplies change of cursor coordinates.
Default: 1.0
Also, there are functions only for X Y axis.
SetCursorSpeedX(int speed)
SetCursorSpeedY(int speed)
void CursorSetPosition(fixed x, fixed y)
Sets the position of cursor on the screen.
fixed CursorX()
fixed CursorY()
Gets the position of cursor on the screen.
void CursorUpdate()
Updates the position of acs cursor.