Advertisement
Guest User

Untitled

a guest
Jan 25th, 2019
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. REM  *****  BASIC  *****
  2.  
  3. global oDoc as Object
  4. global Control as Object
  5. global oPresentation as Object
  6. global keyHandler as Object
  7.  
  8. global playerX as Integer
  9. global Offset as Integer
  10.  
  11. Type Pos
  12.     x as Integer
  13.     y as Integer
  14. End Type
  15.  
  16. global PlayerPos as Pos
  17.  
  18.  
  19. Sub Main
  20.     Dim oSlide as Object
  21.    
  22.     Dim RectangleShape As Object
  23.     Dim Size As New com.sun.star.awt.Size
  24.    
  25.     oDoc = ThisComponent
  26.     oPresentation = oDoc.getPresentation()
  27.     oPresentation.isEndless = True
  28.     oPresentation.isAutomatic = False
  29.     oPresentation.Pause = 0
  30.     oPresentation.Start()
  31.    
  32.     keyHandler = CreateUnoListener("KeyHandler_", "com.sun.star.awt.XKeyHandler")
  33.     ThisComponent.CurrentController.AddKeyHandler(keyHandler)
  34.    
  35.     Wait 1000
  36.    
  37.     MsgBox "Yeah boi"
  38.    
  39.     playerX = 100
  40.     PlayerPos.x = 100
  41.     PlayerPos.y = 100
  42.     Offset = 0
  43.    
  44.     Control = oPresentation.getController()
  45.     Control.gotoSlideIndex(2)
  46. End Sub
  47.  
  48. Sub DrawNextFrame
  49.     Dim Page As Object
  50.     Dim RectangleShape As Object
  51.     Dim Size As New com.sun.star.awt.Size
  52.     Dim Point As New com.sun.star.awt.Point
  53.    
  54.     Point.x = playerX * 100
  55.     Point.y = 500
  56.    
  57.     Size.Width = 500
  58.     Size.Height = 500
  59.    
  60.     Page = oDoc.Drawpages.insertNewByIndex(Offset)
  61.     Page.Name = "Frame" + Offset
  62.     RectangleShape = oDoc.createInstance("com.sun.star.drawing.RectangleShape")
  63.     RectangleShape.Size = Size
  64.     RectangleShape.Position = Point
  65.    
  66.     Offset = Offset + 1
  67.    
  68.     Page.add(RectangleShape)
  69. End Sub
  70.  
  71. function KeyHandler_KeyPressed(oEvent) as boolean
  72.     KeyHandler_KeyPressed = False
  73.     Dim ValidChange as Boolean
  74.     ValidChange = False
  75.    
  76.     If oEvent.KeyCode = 512 Then
  77.         playerX = playerX - 10
  78.         ValidChange = True
  79.     ElseIf oEvent.KeyCode = 515 Then
  80.         playerX = playerX + 10
  81.         ValidChange = True
  82.     End If
  83.    
  84.     If ValidChange Then
  85.         DrawNextFrame()
  86.     End If
  87. End function
  88.  
  89. function KeyHandler_KeyReleased(oEvent) as boolean
  90.     KeyHandler_KeyReleased = False
  91. End function
  92.  
  93. Sub Test
  94.     MsgBox "HOLAAA"
  95. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement