This problem only occurs with the opengl subsystem
Code: Select all
Global Quit = 0
#SCREENWIDTH = 640
#SCREENHEIGHT = 480
InitSprite()
InitKeyboard()
InitMouse()
InitSprite3D()
Global screen
FullScreen = 0
If FullScreen
screen = OpenScreen(#SCREENWIDTH, #SCREENHEIGHT, 32, "Game")
Else
win = OpenWindow(#PB_Any,0,0, #SCREENWIDTH, #SCREENHEIGHT, "Game",#PB_Window_ScreenCentered | #PB_Window_SizeGadget)
screen = OpenWindowedScreen(WindowID(win),0,0,#SCREENWIDTH,#SCREENHEIGHT,0,0,0)
EndIf
If screen
cursor = LoadSprite(#PB_Any, "cursor.bmp")
cursor_texture = LoadSprite(#PB_Any, "cursor.bmp", #PB_Sprite_Texture)
cursor = CreateSprite3d(#PB_Any, cursor_texture)
Repeat
ExamineMouse()
ExamineKeyboard()
ClearScreen(0)
If KeyboardPushed(#PB_Key_Escape)
Quit = 1 ;exits the loop
EndIf
If KeyboardReleased(#PB_Key_A)
ReleaseMouse(1) ;release access of the mouse
CloseScreen() ;close the screen
If IsWindow(win) : CloseWindow(win) : EndIf ; Close the containing window (if not fullscreen) - I figure I might have to do this.
Delay(1000)
If FullScreen
screen = OpenScreen(#SCREENWIDTH, #SCREENHEIGHT, 32, "Game")
Else
win = OpenWindow(#PB_Any,0,0, #SCREENWIDTH, #SCREENHEIGHT, "Game",#PB_Window_ScreenCentered | #PB_Window_SizeGadget)
screen = OpenWindowedScreen(WindowID(win),0,0,#SCREENWIDTH,#SCREENHEIGHT,0,0,0)
EndIf
If screen
;reload graphics
cursor = LoadSprite(#PB_Any, "cursor.bmp")
cursor_texture = LoadSprite(#PB_Any, "cursor.bmp", #PB_Sprite_Texture)
cursor = CreateSprite3d(#PB_Any, cursor_texture)
;try to capture mouse again
ReleaseMouse(0)
Else
End
EndIf
EndIf
Start3D()
DisplaySprite3D(cursor, MouseX(), MouseY())
Stop3D()
;DisplaySprite(cursor, MouseX(), MouseY())
FlipBuffers()
Delay(10)
Until Quit = 1
CloseScreen()
EndIf
This code gives me that error. Comment out ReleaseMouse(0) around line 57 and there's no error, but The mouse doesn't work.