Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- REM ***** BASIC *****
- global oDoc as Object
- global Control as Object
- global oPresentation as Object
- global keyHandler as Object
- global playerX as Integer
- global Offset as Integer
- Type Pos
- x as Integer
- y as Integer
- End Type
- global PlayerPos as Pos
- Sub Main
- Dim oSlide as Object
- Dim RectangleShape As Object
- Dim Size As New com.sun.star.awt.Size
- oDoc = ThisComponent
- oPresentation = oDoc.getPresentation()
- oPresentation.isEndless = True
- oPresentation.isAutomatic = False
- oPresentation.Pause = 0
- oPresentation.Start()
- keyHandler = CreateUnoListener("KeyHandler_", "com.sun.star.awt.XKeyHandler")
- ThisComponent.CurrentController.AddKeyHandler(keyHandler)
- Wait 1000
- MsgBox "Yeah boi"
- playerX = 100
- PlayerPos.x = 100
- PlayerPos.y = 100
- Offset = 0
- Control = oPresentation.getController()
- Control.gotoSlideIndex(2)
- End Sub
- Sub DrawNextFrame
- Dim Page As Object
- Dim RectangleShape As Object
- Dim Size As New com.sun.star.awt.Size
- Dim Point As New com.sun.star.awt.Point
- Point.x = playerX * 100
- Point.y = 500
- Size.Width = 500
- Size.Height = 500
- Page = oDoc.Drawpages.insertNewByIndex(Offset)
- Page.Name = "Frame" + Offset
- RectangleShape = oDoc.createInstance("com.sun.star.drawing.RectangleShape")
- RectangleShape.Size = Size
- RectangleShape.Position = Point
- Offset = Offset + 1
- Page.add(RectangleShape)
- End Sub
- function KeyHandler_KeyPressed(oEvent) as boolean
- KeyHandler_KeyPressed = False
- Dim ValidChange as Boolean
- ValidChange = False
- If oEvent.KeyCode = 512 Then
- playerX = playerX - 10
- ValidChange = True
- ElseIf oEvent.KeyCode = 515 Then
- playerX = playerX + 10
- ValidChange = True
- End If
- If ValidChange Then
- DrawNextFrame()
- End If
- End function
- function KeyHandler_KeyReleased(oEvent) as boolean
- KeyHandler_KeyReleased = False
- End function
- Sub Test
- MsgBox "HOLAAA"
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement