ACSUtils Wiki

An ACS library for ZDoom-based ports

User Tools

Site Tools


functions:cursor

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
functions:cursor [2016/08/08 18:03] – [Coordinate system] korshunfunctions:cursor [2017/06/12 15:39] (current) – removed korshun
Line 1: Line 1:
-====== Cursor ====== 
- 
-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. 
- 
-<note important>You should use these functions //only in clientside// scripts. Serverside usage is **not supported**.  
- 
-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.</note> 
- 
-<note important>Widescreen cursors are **not supported** yet.</note> 
- 
-===== Example ===== 
- 
-<code> 
-while (true) 
-{ 
-    // Get mouse input. 
-    UpdateCursor(); 
-         
-    // Draw the cursor at CursorX(), CursorY(). 
-    HudSetPoint(CursorX(), CursorY()); 
-    HudDrawText(1, "*"); 
-     
-    // Wait for next frame. 
-    Delay(1); 
-}        
-</code> 
- 
-===== Coordinate system ===== 
- 
-The cursor's coordinates system matches that of HudMessages with SetHudSize. 
- 
-<note warning>All coordinates are fixed-point. When drawing the cursor using [[zdoom>HudMessage|HudMessage]], don't forget to round the coordinates, or else you'll get very jerky motion.</note> 
-===== Functions ===== 
- 
-==== UpdateCursor ==== 
-''void UpdateCursor()'' 
- 
-Updates the cursor position using the input from ConsolePlayer (current computer). 
- 
-==== CursorX ==== 
-''fixed CursorX()'' 
- 
-Returns the cursor's X position. 
- 
-==== CursorY ==== 
-''fixed CursorY()'' 
- 
-Returns the cursor's Y position. 
- 
-==== CenterCursor ==== 
-''void CenterCursor()'' 
- 
-Centers the cursor on the screen. 
- 
-==== SetCursorPosition ==== 
-''void SetCursorPosition(fixed x, fixed y)'' 
- 
-Sets the cursor's position. 
- 
-==== SetCursorSpeed ==== 
-''void SetCursorSpeed(fixed speed)'' 
- 
-Sets the cursor's current speed multiplier. 
- 
-Default is 1.0. 
- 
-==== SetCursorSpeedX ==== 
-''void SetCursorSpeedX(fixed speed)'' 
- 
-Sets the cursor's current X speed multiplier. 
- 
-Default is 1.0. 
- 
-==== SetCursorSpeedY ==== 
-''void SetCursorSpeedY(fixed speed)'' 
- 
-Sets the cursor's current Y speed multiplier. 
- 
-Default is 1.0. 
- 
-==== EnableCursorWrap ==== 
-''void EnableCursorWrap(bool enable)'' 
- 
-If enabled, the cursor when moved outside the screen, will teleport to the opposite edge of the screen. 
- 
-==== SetCursorArea ==== 
-''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 640x480. 
- 
-<note tip>This function does not change the cursor's perceived speed. Use ''SetCursorSpeed()'' to change the cursor's speed.</note> 
- 
-==== CursorDeltaX ==== 
-''fixed CursorDeltaX()'' 
- 
-Returns the last **change** in cursor's X position. 
- 
-==== CursorDeltaY ==== 
-''fixed CursorDeltaY()'' 
- 
-Returns the last **change** in cursor's Y position. 
- 
  
functions/cursor.1470679418.txt.gz · Last modified: 2016/08/08 18:03 by korshun