Cursor Class

 

About Cursor Class

 

Cursor class is mainly used for loading and managing cursors.

 

Cursor Class Methods

 

Cursor.Add( string FileName ) Adds a .CUR file. If the function succeeds, the return value is the handle of the newly loaded resource. If the function fails, the return value is 0.

string FileName: the name of the file.

 

Cursor.Delete( long CursorHandle ) Deletes a cursor and frees any memory the cursor occupied. If the function succeeds, the return value is true. If the function fails, the return value is false.

long CursorHandle: cursor handle.

 

Cursor.SetPosition( long X, long Y ) sets the position of the mouse cursor, in screen coordinates.

long X: x position in screen coordinates.
long Y: y position in screen coordinates.

 

Cursor.GetX() retrieves the x position of the mouse cursor, in screen coordinates.

 

Cursor.GetY() retrieves the y position of the mouse cursor, in screen coordinates.

 

Code Example

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Giavapps.Windows.API;

public class CodeExample : MonoBehaviour
{

private long WindowHandle = 0;
private long CursorHandle = 0;

void Start()
{
Plugin.Initialize();//Initializes Giavapps Windows API
CursorHandle = Giavapps.Windows.API.Cursor.Add("cursor.cur");//adds a new cursor
WindowHandle = Window.Create(0, 100, 100, 400, 400, Constant.WS_VISIBLE | Constant.WS_SYSMENU | Constant.WS_MINIMIZEBOX | Constant.WS_MAXIMIZEBOX | Constant.WS_SIZEBOX, Constant.WS_EX_TOPMOST);//Creates a new window
Control.SetText(WindowHandle, "Giavapps Windows API");//Sets a new title for the specified window
StaticHandle = Static.Create(WindowHandle, 10, 10, 150, 150, Constant.WS_VISIBLE | Constant.WS_CHILD | Constant.SS_ICON, 0);//creates a new static control
Static.SetCursor(StaticHandle, CursorHandle);//Sets the previously added cursor to the specified static control
}

void Update()
{

//Checks if the specified window has been closed
if(Window.GetClosed(WindowHandle))
{
Control.Destroy(WindowHandle);//Destroys the specified window
}

}

void OnApplicationQuit()
{
Giavapps.Windows.API.Cursor.Delete(CursorHandle);//deletes the previously added cursor
Plugin.Deinitialize();//Deinitializes Giavapps Windows API
}

}

 

I am Luigi Piscopo, also known as DJ GiDeejay / Producer / Remixer in the music world. I am a Producer with a lot of experience in photo editing, video editing, audio editing, graphic design, web design, programming and promotion.

Comments are closed.