common.bmx 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. ' Copyright (c) 2014-2022 Bruce A Henderson
  2. '
  3. ' This software is provided 'as-is', without any express or implied
  4. ' warranty. In no event will the authors be held liable for any damages
  5. ' arising from the use of this software.
  6. '
  7. ' Permission is granted to anyone to use this software for any purpose,
  8. ' including commercial applications, and to alter it and redistribute it
  9. ' freely, subject to the following restrictions:
  10. '
  11. ' 1. The origin of this software must not be misrepresented; you must not
  12. ' claim that you wrote the original software. If you use this software
  13. ' in a product, an acknowledgment in the product documentation would be
  14. ' appreciated but is not required.
  15. '
  16. ' 2. Altered source versions must be plainly marked as such, and must not be
  17. ' misrepresented as being the original software.
  18. '
  19. ' 3. This notice may not be removed or altered from any source
  20. ' distribution.
  21. '
  22. SuperStrict
  23. ?win32x86
  24. Import "../../sdl.mod/sdl.mod/include/win32x86/*.h"
  25. ?win32x64
  26. Import "../../sdl.mod/sdl.mod/include/win32x64/*.h"
  27. ?osx
  28. Import "../../sdl.mod/sdl.mod/include/macos/*.h"
  29. ?linuxx86
  30. Import "../../sdl.mod/sdl.mod/include/linuxx86/*.h"
  31. ?linuxx64
  32. Import "../../sdl.mod/sdl.mod/include/linuxx64/*.h"
  33. ?raspberrypi
  34. Import "../../sdl.mod/sdl.mod/include/raspberrypi/*.h"
  35. ?android
  36. Import "../../sdl.mod/sdl.mod/include/android/*.h"
  37. ?
  38. ?emscripten
  39. Import "../../sdl.mod/sdl.mod/include/emscripten/*.h"
  40. ?ios
  41. Import "../../sdl.mod/sdl.mod/include/ios/*.h"
  42. ?haikux64
  43. Import "../../sdl.mod/sdl.mod/include/haikux64/*.h"
  44. ?
  45. Import "../../sdl.mod/sdl.mod/SDL/include/*.h"
  46. Import "glue.c"
  47. Extern
  48. Function SDL_CreateRenderer:Byte Ptr(window:Byte Ptr, index:Int, flags:UInt)
  49. Function SDL_CreateSoftwareRenderer:Byte Ptr(surface:Byte Ptr)
  50. Function SDL_DestroyRenderer(handle:Byte Ptr)
  51. Function SDL_CreateTexture:Byte Ptr(handle:Byte Ptr, format:UInt, access:Int, width:Int, height:Int)
  52. Function SDL_CreateTextureFromSurface:Byte Ptr(handle:Byte Ptr, surface:Byte Ptr)
  53. Function SDL_RenderClear:Int(handle:Byte Ptr)
  54. Function SDL_RenderDrawLine:Int(handle:Byte Ptr, x1:Int, y1:Int, x2:Int, y2:Int)
  55. Function SDL_RenderDrawLines:Int(handle:Byte Ptr, points:Int Ptr, count:Int)
  56. Function SDL_RenderDrawPoint:Int(handle:Byte Ptr, x:Int, y:Int)
  57. Function SDL_RenderDrawPoints:Int(handle:Byte Ptr, points:Int Ptr, count:Int)
  58. Function SDL_RenderDrawRects:Int(handle:Byte Ptr, rects:Int Ptr, count:Int)
  59. Function SDL_RenderFillRects:Int(handle:Byte Ptr, rects:Int Ptr, count:Int)
  60. Function SDL_RenderGetIntegerScale:Int(handle:Byte Ptr)
  61. Function SDL_RenderGetLogicalSize(handle:Byte Ptr, w:Int Ptr, h:Int Ptr)
  62. Function SDL_RenderGetScale(handle:Byte Ptr, x:Float Ptr, y:Float Ptr)
  63. Function SDL_RenderIsClipEnabled:Int(handle:Byte Ptr)
  64. Function SDL_RenderPresent(handle:Byte Ptr)
  65. Function SDL_GetRenderDrawBlendMode:Int(handle:Byte Ptr, blendMode:Int Ptr)
  66. Function SDL_GetRenderDrawColor:Int(handle:Byte Ptr, r:Byte Ptr, g:Byte Ptr, b:Byte Ptr, a:Byte Ptr)
  67. Function SDL_GetRenderTarget:Byte Ptr(handle:Byte Ptr)
  68. Function SDL_GetRendererOutputSize:Int(handle:Byte Ptr, w:Int Ptr, h:Int Ptr)
  69. Function SDL_RenderSetIntegerScale:Int(handle:Byte Ptr, enable:Int)
  70. Function SDL_RenderSetLogicalSize:Int(handle:Byte Ptr, w:Int, h:Int)
  71. Function SDL_RenderSetScale:Int(handle:Byte Ptr, scaleX:Float, scaleY:Float)
  72. Function SDL_RenderTargetSupported:Int(handle:Byte Ptr)
  73. Function SDL_SetRenderDrawBlendMode:Int(handle:Byte Ptr, blendMode:Int)
  74. Function SDL_SetRenderDrawColor:Int(handle:Byte Ptr, r:Byte, g:Byte, b:Byte, a:Byte)
  75. Function SDL_SetRenderTarget:Int(handle:Byte Ptr, texture:Byte Ptr)
  76. Function SDL_GetRenderer:Byte Ptr(window:Byte Ptr)
  77. Function SDL_RenderGeometry:Int(handle:Byte Ptr, texture:Byte Ptr, vertices:SDLVertex Ptr, numVertices:Int, indices:Int Ptr, numIndices:Int)
  78. Function SDL_GetRendererInfo(handle:Byte Ptr, info:SDLRendererInfo Var)
  79. Function SDL_GetRenderDriverInfo:Int(index:Int, info:SDLRendererInfo Var)
  80. Function SDL_RenderWindowToLogical(handle:Byte Ptr, windowX:Int, windowY:Int, logicalX:Float Var, logicalY:Float Var)
  81. Function SDL_RenderLogicalToWindow(handle:Byte Ptr, logicalX:Float, logicalY:Float, windowX:Int Var, windowY:Int Var)
  82. Function SDL_RenderSetVSync:Int(handle:Byte Ptr, vsync:Int)
  83. Function SDL_GetTextureAlphaMod:Int(handle:Byte Ptr, alpha:Byte Ptr)
  84. Function SDL_GetTextureBlendMode:Int(handle:Byte Ptr, blendMode:Int Ptr)
  85. Function SDL_GetTextureColorMod:Int(handle:Byte Ptr, r:Byte Ptr, g:Byte Ptr, b:Byte Ptr)
  86. Function SDL_QueryTexture:Int(handle:Byte Ptr, format:UInt Ptr, access:Int Ptr, w:Int Ptr, h:Int Ptr)
  87. Function SDL_SetTextureAlphaMod:Int(handle:Byte Ptr, alpha:Byte)
  88. Function SDL_SetTextureBlendMode:Int(handle:Byte Ptr, blendMode:Int)
  89. Function SDL_SetTextureColorMod:Int(handle:Byte Ptr, r:Byte, g:Byte, b:Byte)
  90. Function SDL_UnlockTexture(handle:Byte Ptr)
  91. Function SDL_DestroyTexture(handle:Byte Ptr)
  92. Function SDL_GetNumRenderDrivers:Int()
  93. Function bmx_SDL_RenderCopy:Int(handle:Byte Ptr, texture:Byte Ptr, sx:Int, sy:Int, sw:Int, sh:Int, dx:Int, dy:Int, dw:Int, dh:Int)
  94. Function bmx_SDL_RenderDrawRect:Int(handle:Byte Ptr, x:Int, y:Int, w:Int, h:Int)
  95. Function bmx_SDL_RenderFillRect:Int(handle:Byte Ptr, x:Int, y:Int, w:Int, h:Int)
  96. Function bmx_SDL_RenderGetClipRect(handle:Byte Ptr, x:Int Ptr, y:Int Ptr, w:Int Ptr, h:Int Ptr)
  97. Function bmx_SDL_RenderGetViewport(handle:Byte Ptr, x:Int Ptr, y:Int Ptr, w:Int Ptr, h:Int Ptr)
  98. Function bmx_SDL_RenderReadPixels:Int(handle:Byte Ptr, format:UInt, pixels:Byte Ptr, pitch:Int, x:Int, y:Int, w:Int, h:Int)
  99. Function bmx_SDL_RenderSetClipRect:Int(handle:Byte Ptr, x:Int, y:Int, w:Int, h:Int)
  100. Function bmx_SDL_RenderSetViewport:Int(handle:Byte Ptr, x:Int, y:Int, w:Int, h:Int)
  101. Function bmx_SDL_RenderCopyEx:Int(handle:Byte Ptr, texture:Byte Ptr, sx:Int, sy:Int, sw:Int, sh:Int, dx:Int, dy:Int, dw:Int, dh:Int, angle:Double, cx:Int, cy:Int, flipMode:Int)
  102. Function bmx_SDL_LockTexture:Int(handle:Byte Ptr, pixels:Byte Ptr Ptr, pitch:Int Ptr, x:Int, y:Int, w:Int, h:Int)
  103. Function bmx_SDL_UpdateTexture:Int(handle:Byte Ptr, pixels:Byte Ptr, pitch:Int, x:Int, y:Int, w:Int, h:Int)
  104. Function bmx_SDL_UpdateYUVTexture:Int(handle:Byte Ptr, yPlane:Byte Ptr, yPitch:Int, uPlane:Byte Ptr, uPitch:Int, vPlane:Byte Ptr, vPitch:Int, x:Int, y:Int, w:Int, h:Int)
  105. Function bmx_SDL_bptr_to_SDLVertexPtr:SDLVertex Ptr(b:Byte Ptr)
  106. End Extern
  107. Rem
  108. bbdoc: Changes rarely, not lockable
  109. End Rem
  110. Const SDL_TEXTUREACCESS_STATIC:UInt = 0
  111. Rem
  112. bbdoc: Changes frequently, lockable
  113. End Rem
  114. Const SDL_TEXTUREACCESS_STREAMING:UInt = 1
  115. Rem
  116. bbdoc: Can be used as a render target
  117. End Rem
  118. Const SDL_TEXTUREACCESS_TARGET:UInt = 2
  119. Rem
  120. bbdoc: Do not flip
  121. End Rem
  122. Const SDL_FLIP_NONE:Int = 0
  123. Rem
  124. bbdoc: Flip horizontally
  125. End Rem
  126. Const SDL_FLIP_HORIZONTAL:Int = 1
  127. Rem
  128. bbdoc: Flip vertically
  129. End Rem
  130. Const SDL_FLIP_VERTICAL:Int = 2
  131. Rem
  132. bbdoc: The renderer is a software fallback
  133. End Rem
  134. Const SDL_RENDERER_SOFTWARE:Int = $01
  135. Rem
  136. bbdoc: The renderer uses hardware acceleration
  137. End Rem
  138. Const SDL_RENDERER_ACCELERATED:Int = $02
  139. Rem
  140. bbdoc: Present is synchronized with the refresh rate
  141. End Rem
  142. Const SDL_RENDERER_PRESENTVSYNC:Int = $04
  143. Rem
  144. bbdoc: The renderer supports rendering to texture
  145. End Rem
  146. Const SDL_RENDERER_TARGETTEXTURE:Int = $08
  147. Struct SDLFPoint
  148. Field x:Float
  149. Field y:Float
  150. End Struct
  151. Struct SDLColor
  152. Field r:Byte
  153. Field g:Byte
  154. Field b:Byte
  155. Field a:Byte
  156. Method New(r:Byte, g:Byte, b:Byte, a:Byte)
  157. self.r = r
  158. self.g = g
  159. self.b = b
  160. self.a = a
  161. End Method
  162. End Struct
  163. Struct SDLVertex
  164. Field position:SDLFPoint
  165. Field color:SDLColor
  166. Field texCoord:SDLFPoint
  167. End Struct
  168. Rem
  169. bbdoc: A structure that contains information on the capabilities of a render driver or the current render context.
  170. End Rem
  171. Struct SDLRendererInfo
  172. Field name:Byte Ptr
  173. Rem
  174. bbdoc: A mask of supported renderer flags
  175. End Rem
  176. Field flags:UInt
  177. Rem
  178. bbdoc: The number of available texture formats
  179. End Rem
  180. Field numTextureFormats:UInt
  181. Rem
  182. bbdoc: The available texture formats
  183. End Rem
  184. Field StaticArray textureFormats:UInt[16]
  185. Rem
  186. bbdoc: The maximum texture width
  187. End Rem
  188. Field maxTextureWidth:Int
  189. Rem
  190. bbdoc: The maximum texture height
  191. End Rem
  192. Field maxTextureHeight:Int
  193. Rem
  194. bbdoc: Returns the name of the renderer.
  195. End Rem
  196. Method GetName:String()
  197. Return String.FromUTF8String(name)
  198. End Method
  199. End Struct