From the examples I've seen, it appears that the normal MS mouse cursor is not available for use on screens, and people seem to use a Sprite. When I do this in the following code, the token cursor (large white square top left) doesn't show - except briefly when I exit the program.
Is there a solution?
Hope you can help, even if to say it can't be done.
Code: Select all
Enumeration
#IMAGE_SMALL
#SPRITE_MAIN = 1
EndEnumeration
Declare SetValveColours()
Declare ToggleValveColoursByKeyboard(Valve)
Global Started,Dim Colour(5),Dim x(5), Dim y(5)
;valve locations
x(1)=150 :y(1)=355
x(2)=450 :y(2)=445
x(3)=343 :y(3)=144
x(4)=572 :y(4)=335
x(5)=785 :y(5)=546
LoadImage(#IMAGE_SMALL, "c:\users\rex\pictures\ProcessPlant1.bmp")
LoadedImageWidth = ImageWidth(#IMAGE_SMALL)
LoadedImageHeight = ImageHeight(#IMAGE_SMALL)
InitSprite() :InitKeyboard() :InitMouse()
OpenScreen(1024,768,32,"")
CreateSprite(#SPRITE_MAIN, 64, 64)
StartDrawing(SpriteOutput(#SPRITE_MAIN))
Box(0, 0, 64, 64, RGB(255, 255, 255))
StopDrawing()
StartDrawing(ScreenOutput())
SetValveColours()
StopDrawing():FlipBuffers()
;======================================================================================================
;MAIN LOOP
;==========
Repeat
DisplaySprite(#SPRITE_MAIN,100,100)
Select ExamineKeyboard()
Case KeyboardReleased(#PB_Key_1 ) : ToggleValveColoursByKeyboard(1)
Case KeyboardReleased(#PB_Key_2 ) : ToggleValveColoursByKeyboard(2)
Case KeyboardReleased(#PB_Key_3 ) : ToggleValveColoursByKeyboard(3)
Case KeyboardReleased(#PB_Key_4 ) : ToggleValveColoursByKeyboard(4)
Case KeyboardReleased(#PB_Key_5 ) : ToggleValveColoursByKeyboard(5)
EndSelect
If KeyboardPushed(#PB_Key_Escape ) :Quit = 1 :EndIf
Until Quit = 1
End
Procedure SetValveColours()
;Set valve colours to those last displayed
;=============================
Box(0, 0,1024, 768, RGB(255, 255, 255))
DrawImage(ImageID(#IMAGE_SMALL), 0, 0)
For i = 1 To 5
Circle(x(i), y(i), 8 ,RGB(0,0,0))
If Started = 0
Circle(x(i), y(i), 5 ,$00FF00)
Else
Circle(x(i), y(i), 5 ,Colour(i))
EndIf
DrawText (x(i)+12,y(i)-8,"V"+Str(i))
Colour(i) = Point(x(i),y(i))
Next
Started = 1
EndProcedure
Procedure ToggleValveColoursByKeyboard(Valve)
StartDrawing(ScreenOutput())
Box(0, 0,1024, 768, RGB(255, 255, 255))
DrawImage(ImageID(#IMAGE_SMALL), 0, 0)
SetValveColours()
If Red(Colour(Valve)) = 255
Colour(Valve) = RGB(0,255,0)
Circle(x(Valve), y(Valve), 5 ,RGB(0,255,0))
Else
Colour(Valve) = RGB(255,0,0)
Circle(x(Valve), y(Valve), 5 ,RGB(255,0,0))
EndIf
StopDrawing() :FlipBuffers()
EndProcedure

