driver.bmx 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. SuperStrict
  2. Type TSystemDriver
  3. Method Name:String() Abstract
  4. Method Poll() Abstract
  5. Method Wait() Abstract
  6. Method MoveMouse( x:Int,y:Int ) Abstract
  7. Method SetMouseVisible( visible:Int ) Abstract
  8. Method Notify( text:String,serious:Int ) Abstract
  9. Method Confirm:Int( text:String,serious:Int ) Abstract
  10. Method Proceed:Int( text:String,serious:Int ) Abstract
  11. Method RequestFile:String( text:String,exts:String,save:Int,file:String ) Abstract
  12. Method RequestDir:String( text:String,path:String ) Abstract
  13. Method OpenURL:Int( url:String ) Abstract
  14. Method DesktopWidth:Int(display:Int) Abstract
  15. Method DesktopHeight:Int(display:Int) Abstract
  16. Method DesktopDepth:Int(display:Int) Abstract
  17. Method DesktopHertz:Int(display:Int) Abstract
  18. Method ToString:String() Override
  19. Return Name()
  20. End Method
  21. End Type
  22. Interface IWrappedSystemDriver
  23. Method SetDriver(driver:TSystemDriver)
  24. Method GetDriver:TSystemDriver()
  25. End Interface
  26. Private
  27. Global _Driver:TSystemDriver
  28. Public
  29. Rem
  30. bbdoc: Initialises the BlitzMax system driver.
  31. about: There can only be one system driver initialised. A second call to this function will result in an exception.
  32. End Rem
  33. Function InitSystemDriver(driver:TSystemDriver)
  34. If _Driver Then
  35. If IWrappedSystemDriver(driver) Then
  36. IWrappedSystemDriver(driver).SetDriver(_Driver)
  37. Else
  38. Throw "Cannot initialise " + driver.ToString() + ". System driver already configured as " + _Driver.ToString()
  39. End If
  40. End If
  41. _Driver = driver
  42. End Function
  43. Rem
  44. bbdoc: Returns the BlitzMax system driver, or throws an exception if #InitSystemDriver() hasn't been called with one.
  45. End Rem
  46. Function SystemDriver:TSystemDriver()
  47. If Not _Driver Then
  48. Throw "No System Driver installed. Maybe Import BRL.SystemDefault ?"
  49. End If
  50. Return _Driver
  51. End Function