This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
functions:cursor [2016/08/08 16:37] – korshun | functions: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' | ||
- | |||
- | <note important> | ||
- | |||
- | Serverside cursors are very laggy in mods that use them and can't take the player' | ||
- | |||
- | <note important> | ||
- | |||
- | ====== Example code ====== | ||
- | |||
- | "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, | ||
- | | ||
- | // You can reset cursor settings here. | ||
- | CenterCursor(); | ||
- | SetCursorSpeed(2.0); | ||
- | | ||
- | while (true) | ||
- | { | ||
- | // Get mouse input. | ||
- | UpdateCursor(); | ||
- | | ||
- | // Draw the cursor. | ||
- | HudSetPoint(CursorX(), | ||
- | HudDrawText(1, | ||
- | } | ||
- | } | ||
- | </ | ||
- | |||
- | ====== Coordinate system ====== | ||
- | |||
- | The cursor' | ||
- | |||
- | ===== Functions ===== | ||
- | |||
- | ==== UpdateCursor ==== | ||
- | '' | ||
- | |||
- | Updates the cursor position using the input from ConsolePlayer (current computer). | ||
- | |||
- | ==== CursorX ==== | ||
- | '' | ||
- | |||
- | Returns the cursor' | ||
- | |||
- | ==== CursorY ==== | ||
- | '' | ||
- | |||
- | Returns the cursor' | ||
- | |||
- | ==== CenterCursor ==== | ||
- | '' | ||
- | |||
- | Centers the cursor on the screen. | ||
- | |||
- | ==== SetCursorPosition ==== | ||
- | '' | ||
- | |||
- | Sets the cursor' | ||
- | |||
- | ==== SetCursorSpeed ==== | ||
- | '' | ||
- | |||
- | Sets the cursor' | ||
- | |||
- | Default is 1.0. | ||
- | |||
- | ==== SetCursorSpeedX ==== | ||
- | '' | ||
- | |||
- | Sets the cursor' | ||
- | |||
- | Default is 1.0. | ||
- | |||
- | ==== SetCursorSpeedY ==== | ||
- | '' | ||
- | |||
- | Sets the cursor' | ||
- | |||
- | Default is 1.0. | ||
- | |||
- | ==== EnableCursorWrap ==== | ||
- | '' | ||
- | |||
- | If enabled, the cursor when moved outside the screen, will teleport to the opposite edge of the screen. | ||
- | |||
- | ==== SetCursorArea ==== | ||
- | '' | ||
- | |||
- | Sets the coordinate system for the cursor. You can use any size from 1.0 to several thousands for any axis. When '' | ||
- | |||
- | Default is 640x480. | ||
- | |||
- | <note tip>This function does not change the cursor' | ||
- | |||
- | ==== CursorDeltaX ==== | ||
- | '' | ||
- | |||
- | Returns the last **change** in cursor' | ||
- | |||
- | ==== CursorDeltaY ==== | ||
- | '' | ||
- | |||
- | Returns the last **change** in cursor' | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | ==== SetCursorSpeed ==== | ||
- | '' | ||
- | |||
- | Sets the speed of cursor that multiplies change of cursor coordinates. | ||
- | |||
- | Default: 1.0 | ||
- | |||
- | Also, there are functions only for X Y axis. | ||
- | |||
- | '' | ||
- | |||
- | '' | ||
- | |||
- | ==== SetCursorPosition ==== | ||
- | '' | ||
- | |||
- | Sets the position of cursor on the screen. | ||
- | |||
- | ==== CursorX/ | ||
- | '' | ||
- | |||
- | '' | ||
- | |||
- | Gets the position of cursor on the screen. | ||
- | |||
- | ==== UpdateCursor ==== | ||
- | '' | ||
- | |||
- | Updates the position of acs cursor. | ||
- | |||