Please give code with examples, especially if it's using the spring commands (never learned that

Moderator: Moderators
Code: Select all
Spring.SetMouseCursor
( string cursorName [, number scale ] ) -> nil
Code: Select all
Spring.AssignMouseCursor changes/creates the cursor of a single CursorCmd
( string "cmdName", string "iconFileName"
[, boolean overwrite = true [, boolean hotSpotTopLeft = false] ] ) -> nil | boolean
Code: Select all
Spring.SetCustomCommandDrawData(CMD_CLEARMINES, "Clear Mines", {1,0.5,0,.8}, false)
Code: Select all
CMD_RESIZE_X = 30521
local myCustomDesc = {
name = "resize-x",
action = "resize-x",
id = CMD_RESIZE_X,
type = CMDTYPE.ICON_MAP, -- or whatever is suitable
tooltip = "resizes x",
cursor = "resize-x",
}
function gadget:Initialize()
gadgetHandler:RegisterCMDID(CMD_RESIZE_X)
Spring.AssignMouseCursor("resize-x", "cursor-x", true, true)
Spring.SetCustomCommandDrawData(CMD_RESIZE_X, "resize-x", {1,1,1,0.5}, false)
end
Code: Select all
Spring.SetMouseCursor("resize-x")