Yup sure is. I whipped up an demo for you.
setVirtualResolution(640,480)
#CONSTANT MAX_TOOLTIPS = 10
Global _Tooltip_Count = 0
Type Tooltip
textId as integer
x1 as integer
y1 as integer
x2 as integer
y2 as integer
spr as integer
EndType
dim tooltips[MAX_TOOLTIPS] as Tooltip
createTooltip("Red Box", 100,100,200,180)
// for demo purposes, shows a hotspot area
dummy = createSprite(0)
setSpriteSize(dummy, 100, 80)
setSpritePosition(dummy, 100, 100)
do
tooltipHandler()
Sync()
loop
function tooltipHandler()
// Get mouse coordinates
x = getRawMouseX()
y = getRawMouseY()
// Loop through all tooltips
for i = 1 to _Tooltip_Count
// If mouse is within tooltip hotspot
if x > tooltips[i].x1 and x < tooltips[i].x2 and y > tooltips[i].y1 and y < tooltips[i].y2
// position and show the tooltip text and background sprite
setTextPosition(tooltips[i].textId, x, y+18)
setSpritePosition(tooltips[i].spr, x, y+18)
setTextVisible( tooltips[i].textId, 1)
setSpriteVisible(tooltips[i].spr, 1)
// Draw a border around the background sprite
drawBox(x,y+18,x+getSpriteWidth(tooltips[i].spr),y+18+getSpriteHeight(tooltips[i].spr))
else
// No tooltip hotspot, hide it
setTextVisible( tooltips[i].textId, 0)
setSpriteVisible(tooltips[i].spr, 0)
endif
next i
endfunction
// Draws a box outline
function drawBox(x1, y1, x2, y2)
drawLine(x1, y1, x2, y1, 0,0,0)
drawLine(x1, y2, x2, y2, 0,0,0)
drawLine(x1, y1, x1, y2, 0,0,0)
drawLine(x2, y1, x2, y2, 0,0,0)
endfunction
// Create a new tooltip
// s$ = tooltip text
// coordinates of hotspot to trigger tooltip
function createTooltip(s$, x1, y1, x2, y2)
// Bounds check for array
if _Tooltip_Count >= MAX_TOOLTIPS then exitfunction 0
inc _Tooltip_Count
// create new tooltip text object and configure settings
tooltips[_Tooltip_Count].textId = createText(s$)
setTextColor(tooltips[_Tooltip_Count].textId,0,0,0,255)
setTextSize(tooltips[_Tooltip_Count].textId, 18)
// Change depth so text appears above tooltip background sprite
setTextDepth(tooltips[_Tooltip_Count].textId, 8)
// Define hotspot
tooltips[_Tooltip_Count].x1 = x1
tooltips[_Tooltip_Count].y1 = y1
tooltips[_Tooltip_Count].x2 = x2
tooltips[_Tooltip_Count].y2 = y2
// Background of tooltip (if desired)
tooltips[_Tooltip_Count].spr = createSprite(0)
setSpriteSize(tooltips[_Tooltip_Count].spr, getTextTotalWidth(tooltips[_Tooltip_Count].textId)+4, 18)
setSpriteColor(tooltips[_Tooltip_Count].spr, 255,242,193,255)
// Default sprite depth is 10, make tooltip lower so it shows above sprites by default
setSpriteDepth(tooltips[_Tooltip_Count].spr, 9)
endfunction _Tooltip_Count
"I like offending people, because I think people who get offended should be offended." - Linus Torvalds