Code archives/Miscellaneous/Sprite Candy Cursor
This code has been declared by its author to be Public Domain code.
Download source code
| Ive had SC now for about 5 minutes . Did not see right away a quick and easy function for a mouse cursor in fullscreen mode, using the gui addon for sc. So i made this real quick. Hopefully I dont see a built in function for this in the next 10 minutes :) I didnt see any user forums for this library , or I would have posted this there. Just call Gui_LoadCursor(Filename$,gamecamera,texture flag) then Gui_UpdateCursor() Once per game loop |
;--------------------------------------------------- ;Cursor function added by rifraf ( jeff frazier ) ;--------------------------------------------------- Function Gui_LoadCursor(CurFile$,Cam,flag=4) If CursorHud<>0 Then HUD_FreeImageResources(Cursorimage) HUD_ClearLayer(CursorLayer) HUD_RemoveLayer(CursorLayer) HUD_Remove(CursorHud) cursorimage%=0 CursorHud%=0 EndIf If FileType(curfile$)<>1 Then RuntimeError "Gui_LoadCursor : File "+curfile$+" not found." TempImage=LoadImage(curfile$) CursorWidth=ImageWidth(Tempimage)-ImageWidth(Tempimage)/2 CursorHeight=ImageHeight(Tempimage)-ImageHeight(Tempimage)/2 FreeImage tempimage CursorHud% = HUD_Create (Cam) CursorResource% = HUD_LoadImageResource (curfile$,flag) CursorLayer% = HUD_CreateLayer(cursorhud,cursorresource) CursorImage% = HUD_CreateImage (CursorLayer, 0,0) HUD_SetObjectOrder (cursorimage, 2500) HUD_SetObjectOrigin (cursorimage, -1,-1) End Function ;--------------------------------------------------- ;Cursor function added by rifraf ( jeff frazier ) ;--------------------------------------------------- Function Gui_UpdateCursor() If CursorImage=0 Then RuntimeError "Gui_UpdateCursor : Null Cursor Image" HUD_PositionObject Cursorimage,MouseX(),MouseY() End Function |