Brucey vor 3 Jahren
Ursprung
Commit
4a471c5bae

+ 4 - 0
sdlgamecontroller.mod/common.bmx

@@ -56,6 +56,10 @@ Extern
 	Function SDL_GameControllerRumbleTriggers:Int(handle:Byte Ptr, leftRumble:Short, rightRumble:Short, durationMs:UInt)
 	Function SDL_GameControllerHasLED:Int(handle:Byte Ptr)
 	Function SDL_GameControllerSetLED:Int(handle:Byte Ptr, red:Byte, green:Byte, blue:Byte)
+	Function SDL_GameControllerHasRumble:Int(handle:Byte Ptr)
+	Function SDL_GameControllerHasRumbleTriggers:Int(handle:Byte Ptr)
+	Function SDL_GameControllerGetPlayerIndex:Int(handle:Byte Ptr)
+	Function SDL_GameControllerSetPlayerIndex(handle:Byte Ptr, index:Int)
 	
 End Extern
 

+ 32 - 0
sdlgamecontroller.mod/sdlgamecontroller.bmx

@@ -229,6 +229,38 @@ Type TSDLGameController
 	Method SDL_GameControllerSetLED:Int(red:Byte, green:Byte, blue:Byte)
 		Return SDL_GameControllerSetLED(controllerPtr, red, green, blue)
 	End Method
+
+	Rem
+	bbdoc: Queries whether the game controller has rumble support.
+	returns: #True, or #False if this controller does not have rumble support.
+	End Rem
+	Method HasRumble:Int()
+		Return SDL_GameControllerHasRumble(controllerPtr)
+	End Method
+
+	Rem
+	bbdoc: Queries whether the game controller has rumble support on triggers.
+	returns: #True, or #False if this controller does not have trigger rumble support.
+	End Rem
+	Method HasRumbleTriggers:Int()
+		Return SDL_GameControllerHasRumbleTriggers(controllerPtr)
+	End Method
+
+	Rem
+	bbdoc: Gets the player index of an opened game controller.
+	returns: The player index for the controller, or -1 if it's not available.
+	about: For XInput controllers this returns the XInput user index.
+	End Rem
+	Method GetPlayerIndex:Int(handle:Byte Ptr)
+		Return SDL_GameControllerGetPlayerIndex(controllerPtr)
+	End Method
+
+	Rem
+	bbdoc: Sets the player index of an opened game controller.
+	End Rem
+	Method SetPlayerIndex(index:Int)
+		SDL_GameControllerSetPlayerIndex(controllerPtr, index)
+	End Method
 	
 	Rem
 	bbdoc: Adds support for controllers that SDL is unaware of or to cause an existing controller to have a different binding.

+ 5 - 0
sdljoystick.mod/common.bmx

@@ -38,6 +38,11 @@ Extern
 	Function SDL_JoystickSetLED:Int(handle:Byte Ptr, red:Byte, green:Byte, blue:Byte)
 	Function SDL_JoystickCurrentPowerLevel:Int(handle:Byte Ptr)
 	Function SDL_JoystickGetHat:Byte(handle:Byte Ptr, hat:Int)
+	Function SDL_JoystickHasRumble:Int(handle:Byte Ptr)
+	Function SDL_JoystickHasRumbleTriggers:Int(handle:Byte Ptr)
+	Function SDL_JoystickName:Byte Ptr(handle:Byte Ptr)
+	Function SDL_JoystickGetPlayerIndex:Int(handle:Byte Ptr)
+	Function SDL_JoystickSetPlayerIndex(handle:Byte Ptr, index:Int)
 	
 End Extern
 

+ 43 - 0
sdljoystick.mod/sdljoystick.bmx

@@ -245,6 +245,49 @@ Type TSDLJoystick
 	Method SetLED:Int(red:Byte, green:Byte, blue:Byte)
 		Return SDL_JoystickSetLED(joystickPtr, red, green, blue)
 	End Method
+
+	Rem
+	bbdoc: Queries whether the joystick has rumble support.
+	returns: #True if the joystick has rumble, #False otherwise.
+	End Rem
+	Method HasRumble:Int()
+		Return SDL_JoystickHasRumble(joystickPtr)
+	End Method
+
+	Rem
+	bbdoc: Queries whether the joystick has rumble support on triggers.
+	returns: #True if the joystick has trigger rumble, #False otherwise.
+	End Rem
+	Method HasRumbleTriggers:Int()
+		Return SDL_JoystickHasRumbleTriggers(joystickPtr)
+	End Method
+
+	Rem
+	bbdoc: Gets the implementation dependent name of a joystick.
+	returns: The name of the joystick. If no name can be found, this method returns #Null - call SDLGetError() for more information.
+	End Rem
+	Method Name:String()
+		Local n:Byte Ptr = SDL_JoystickName(joystickPtr)
+		If n Then
+			Return String.FromUTF8String(n)
+		End If
+	End Method
+
+	Rem
+	bbdoc: Gets the player index for the joystick.
+	returns: The player index, or -1 if it's not available.
+	about: For XInput controllers this returns the XInput user index. Many joysticks will not be able to supply this information.
+	End Rem
+	Method GetPlayerIndex:Int()
+		Return SDL_JoystickGetPlayerIndex(joystickPtr)
+	End Method
+
+	Rem
+	bbdoc: Sets the player index of the joystick.
+	End Rem
+	Method SetPlayerIndex(index:Int)
+		SDL_JoystickSetPlayerIndex(joystickPtr, index)
+	End Method
 	
 	Method Delete()
 		If joystickPtr Then

+ 3 - 0
sdlrender.mod/common.bmx

@@ -93,6 +93,9 @@ Extern
 	Function SDL_RenderGeometry:Int(handle:Byte Ptr, texture:Byte Ptr, vertices:SDLVertex Ptr, numVertices:Int, indices:Int Ptr, numIndices:Int)
 	Function SDL_GetRendererInfo(handle:Byte Ptr, info:SDLRendererInfo Var)
 	Function SDL_GetRenderDriverInfo:Int(index:Int, info:SDLRendererInfo Var)
+	Function SDL_RenderWindowToLogical(handle:Byte Ptr, windowX:Int, windowY:Int, logicalX:Float Var, logicalY:Float Var)
+	Function SDL_RenderLogicalToWindow(handle:Byte Ptr, logicalX:Float, logicalY:Float, windowX:Int Var, windowY:Int Var)
+	Function SDL_RenderSetVSync:Int(handle:Byte Ptr, vsync:Int)
 
 	Function SDL_GetTextureAlphaMod:Int(handle:Byte Ptr, alpha:Byte Ptr)
 	Function SDL_GetTextureBlendMode:Int(handle:Byte Ptr, blendMode:Int Ptr)

+ 26 - 1
sdlrender.mod/sdlrender.bmx

@@ -358,7 +358,32 @@ Type TSDLRenderer
 			Return SDL_SetRenderTarget(rendererPtr, Null)
 		End If
 	End Method
-	
+
+	Rem
+	bbdoc: Gets logical coordinates of a point in the renderer when given real coordinates of point in the window.
+	about: Logical coordinates will differ from real coordinates when render is scaled and logical renderer size set.
+	End Rem
+	Method WindowToLogical(windowX:Int, windowY:Int, logicalX:Float Var, logicalY:Float Var)
+		SDL_RenderWindowToLogical(rendererPtr, windowX, windowY, logicalX, logicalY)
+	End Method
+
+	Rem
+	bbdoc: Gets real coordinates of a point in the window when given logical coordinates of point in the renderer.
+	about: Logical coordinates will differ from real coordinates when render is scaled and logical renderer size set.
+	End Rem
+	Method LogicalToWindow(logicalX:Float, logicalY:Float, windowX:Int Var, windowY:Int Var)
+		SDL_RenderLogicalToWindow(rendererPtr, logicalX, logicalY, windowX, windowY)
+	End Method
+
+	Rem
+	bbdoc: Toggles VSync of the renderer.
+	returns: 0 on success, or non-zero on failure.
+	about: @vsync is 1 for on, 0 for off. All other values are reserved.
+	End Rem
+	Method SetVSync:Int(vsync:Int)
+		Return SDL_RenderSetVSync(rendererPtr, vsync)
+	End Method
+
 	Rem
 	bbdoc: Destroys the rendering context for a window and free associated textures.
 	End Rem