My mouse has gone?
Posted: Sat Aug 16, 2003 10:41 pm
				
				Hi im making a windowed game and just doing some tests to get used to the new commands (Blitzbasic user), I've set up a window and inside the window ive setup a screen to draw on, the problem is that my mouse is invisable, it still works just cant see it. 
 
Heres the code no external media is required just copy'n'paste and hit F5.
			Heres the code no external media is required just copy'n'paste and hit F5.
Code: Select all
InitKeyboard()
InitSprite()
InitMouse()
Global x
; #####################################################################################################
OpenWindow(0,640,480,640,480,#PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar | #PB_Window_ScreenCentered , Title$)
  CreateMenu(0, WindowID())
     MenuTitle("Project") 
        MenuItem(1, "Open") 
        MenuBar()
        MenuItem(4, "Close") 
OpenWindowedScreen(WindowID(),5,5,300,200,0,1,1)
; #####################################################################################################
Procedure Quit()
  ExamineKeyboard()
  If KeyboardPushed(#PB_Key_Escape)
    End
  EndIf
  
  Event = WindowEvent()
  If Event = #PB_EventCloseWindow
    End
  EndIf
EndProcedure
; #####################################################################################################
Structure test
  x.w
  y.w
EndStructure
NewList test.test()
; #####################################################################################################
Procedure add()
    AddElement(test())
    test()\x=MouseX()
    test()\y=MouseY()
EndProcedure
Procedure delete()
    If test()\x=MouseX() And test()\y=MouseY()
    DeleteElement(test())
    EndIf
EndProcedure
 AddElement(test())
    test()\x=100
    test()\y=100
; #####################################################################################################
Procedure DrawScreen()
  ClearScreen(0,0,0)
  StartDrawing(ScreenOutput())
    
    ResetList(test())
      ExamineKeyboard()
        If KeyboardPushed(#PB_Key_Right)
          x=x+1
        EndIf
        If KeyboardPushed(#PB_Key_Left)
          x=x-1
        EndIf
       While NextElement(test()) 
           Box(test()\x+x,test()\y+y,32,32,$2141DE)
       Wend 
  FlipBuffers()
  StopDrawing()  
EndProcedure
; #####################################################################################################
; #####################################################################################################
; #####################################################################################################
Repeat
  Quit()
  DrawScreen() 
  
  ExamineMouse()
  If MouseButton(1)
    add()
  EndIf
  If MouseButton(2)
    delete()
  EndIf
forever
; #####################################################################################################
; #####################################################################################################
; #####################################################################################################
