DgsSetCustomCursorImage: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{Client function}} This function applys an image to a specific type. If leaving the parameters empty, DGS will apply the images from current style settings. ==Syn...")
 
No edit summary
Line 42: Line 42:


local arrowTexture = dxCreateTexture("myArrow.png")
local arrowTexture = dxCreateTexture("myArrow.png")
DGS:dgsSetCursorImage("arrow",arrowTexture) --Apply default cursor image
DGS:dgsSetCustomCursorImage("arrow",arrowTexture) --Apply default cursor image
DGS:dgsSetCustomCursorEnabled(true)  --Enable custom cursor
DGS:dgsSetCustomCursorEnabled(true)  --Enable custom cursor
</syntaxhighlight>
</syntaxhighlight>

Revision as of 17:23, 13 February 2021

This function applys an image to a specific type. If leaving the parameters empty, DGS will apply the images from current style settings.

Syntax

bool dgsSetCustomCursorImage( [ string cursorType = nil, material image = nil, float rotation = 0.0, table rotationCenter = { 0, 0 }, table offset = { 0, 0 }, float scale = 0.0 ] )

Optional Arguments

  • cursorType: A string of the cursor type. Available values are as follows:
    • arrow
    • sizing_ns
    • sizing_ew
    • sizing_nwse
    • sizing_nesw
    • text
    • move
    • pointer
  • image: A material element that is going to be applied to the cursor in a specific type.
  • rotation : A float of the rotation of the image.
  • rotationCenter : A table of the rotation center of the image, which contains rotationCenterX and rotationCenterY (relative).
  • offset: A table of the offset of the image, which contains offsetX and offsetY (relative).
  • scale: A float of the scale of the image.

Returns

Returns true if successful, false otherwise

Example

This example shows the empty parameters.

DGS = exports.dgs

DGS:dgsSetCursorImage() --Apply default cursor image
DGS:dgsSetCustomCursorEnabled(true)  --Enable custom cursor

Example

This example shows how to apply your own image.

DGS = exports.dgs

local arrowTexture = dxCreateTexture("myArrow.png")
DGS:dgsSetCustomCursorImage("arrow",arrowTexture) --Apply default cursor image
DGS:dgsSetCustomCursorEnabled(true)  --Enable custom cursor

See Also

Custom Cursor Functions

Multi Language Supports

Animation

3D Element

3D Interface

3D Line

3D Image

3D Text

Browser

Button

Check Box

Combo Box

Custom Renderer

Edit

Detect Area

Drag'N Drop

Grid List

Image

Memo

Menu

Label

Layout

Line

Progress Bar

Radio Button

Scale Pane

Scroll Bar

Scroll Pane

Selector

Style

Switch Button

Tab Panel

Window

Basic Shape Plugins

Circle

Quadrilateral

Rounded Rectangle

Other Plugins

Blur Box

Canvas

Chart

Color Picker

Effect 3D

Gradient

Mask

Media Browser

Nine Slice

Object Preview Supports

Paste Handler

QRCode

Remote Image

Screen Source

SVG

Tooltips