Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. Import Bah.FreeImage
  2. SuperStrict
  3.  
  4.  
  5. Type TState Abstract
  6. Method Update() Abstract
  7. Method Render() Abstract
  8. Method Create() Abstract
  9. Method Remove() Abstract
  10. Field EndState:Byte = False
  11. Method Run()
  12. Create()
  13. Local timer:ttimer = CreateTimer(40)
  14. Repeat
  15.  
  16.  
  17.  
  18. Update()
  19. Render()
  20.  
  21. Flip 0
  22. Cls
  23. WaitTimer timer
  24. Until AppTerminate() Or EndState
  25. Remove()
  26. EndMethod
  27. EndType
  28. Type TGameState Extends TState
  29. Field Objs:TList
  30.  
  31. Method Update()
  32.  
  33. EndMethod
  34. Method Render()
  35.  
  36. EndMethod
  37.  
  38. Method Create()
  39. Objs = New TList
  40. EndMethod
  41. Method Remove()
  42. For Local Obj:TObject= EachIn Objs
  43. Obj.Remove
  44. Next
  45. Objs = Null
  46. EndMethod
  47. EndType
  48.  
  49. Type TVector
  50. Field X:Float, Y:Float
  51.  
  52. EndType
  53.  
  54. Type TObject 'Ein Objekt
  55. Field Position:TVector 'Die Position des Objektes
  56. Field Move:TVector 'Der Bewegungsvektor des Objektes
  57.  
  58. Method New()
  59. Create
  60. EndMethod
  61.  
  62. Method Update() Abstract
  63. Method render() Abstract
  64.  
  65. Method Create()
  66. EndMethod
  67. Method Remove()
  68. EndMethod
  69. EndType
  70.  
  71. Type TGravityObject Extends TObject 'Ein Objekt welches Schwerkraft ausübt
  72. Field Radius:Float 'Der Radius des Objektes
  73.  
  74. EndType
  75.  
  76. Type TSolidObject Extends TObject 'Ein Objekt welches Schwerkraft Entgegennimmt
  77.  
  78. EndType
  79.  
  80. Type TCamera
  81. Field Width:Int, height:Int
  82. Field Position:TVector
  83. Field Objs:TList
  84.  
  85. Method Render()
  86. SetViewport Width,Height
  87. SetOrigin Position.X, Position.Y
  88.  
  89. For Local Obj:TObject= EachIn Objs
  90. Obj.Render
  91. Next
  92.  
  93. SetOrigin 0,0
  94. SetViewport 0,0
  95. EndMethod
  96. Method Create:TCamera(Width:Int, Height:Int Position:TVector)
  97. Self.width = width
  98. Self.height = height
  99. Self.position = position
  100. Self.Objs = New TList
  101. EndMethod
  102. Method AddRenderObject(Obj:TObject)
  103. Objs.addLast Obj
  104. EndMethod
  105. EndType
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126. Function LoadMyIMage:TImage(p:String)
  127. Return LoadImage(CopyPixmap(LoadFreeImage(p).pixmap))
  128. EndFunction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement