Merge branch 'master' of https://github.com/raysan5/raylib
This commit is contained in:
commit
de6487b177
@ -5,7 +5,7 @@ Hello contributors! Welcome to raylib!
|
||||
Do you enjoy raylib and want to contribute? Nice! You can help with the following points:
|
||||
|
||||
- `C programming` - Can you write/review/test/improve the code?
|
||||
- `Documentation/Tutorials/Example` - Can you write some tutorial/example?
|
||||
- `Documentation/Tutorials/Example` - Can you write some tutorials/examples?
|
||||
- `Porting to other platforms` - Can you port/adapt/compile raylib on other systems?
|
||||
- `Web Development` - Can you help [with the website](https://github.com/raysan5/raylib.com)?
|
||||
- `Testing` - Can you find some bugs in raylib?
|
||||
|
@ -20,9 +20,9 @@
|
||||
#include "raylib.h"
|
||||
|
||||
// NOTE: Gamepad name ID depends on drivers and OS
|
||||
#define XBOX360_LEGACY_NAME_ID "Xbox Controller"
|
||||
#define XBOX360_NAME_ID "Xbox 360 Controller"
|
||||
#define PS3_NAME_ID "Sony PLAYSTATION(R)3 Controller"
|
||||
#define XBOX_ALIAS_1 "xbox"
|
||||
#define XBOX_ALIAS_2 "x-box"
|
||||
#define PS_ALIAS "playstation"
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
@ -41,6 +41,14 @@ int main(void)
|
||||
Texture2D texPs3Pad = LoadTexture("resources/ps3.png");
|
||||
Texture2D texXboxPad = LoadTexture("resources/xbox.png");
|
||||
|
||||
// Set axis deadzones
|
||||
const float leftStickDeadzoneX = 0.1f;
|
||||
const float leftStickDeadzoneY = 0.1f;
|
||||
const float rightStickDeadzoneX = 0.1f;
|
||||
const float rightStickDeadzoneY = 0.1f;
|
||||
const float leftTriggerDeadzone = -0.9f;
|
||||
const float rightTriggerDeadzone = -0.9f;
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
@ -67,7 +75,23 @@ int main(void)
|
||||
{
|
||||
DrawText(TextFormat("GP%d: %s", gamepad, GetGamepadName(gamepad)), 10, 10, 10, BLACK);
|
||||
|
||||
if (TextIsEqual(GetGamepadName(gamepad), XBOX360_LEGACY_NAME_ID) || TextIsEqual(GetGamepadName(gamepad), XBOX360_NAME_ID))
|
||||
// Get axis values
|
||||
float leftStickX = GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_LEFT_X);
|
||||
float leftStickY = GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_LEFT_Y);
|
||||
float rightStickX = GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_RIGHT_X);
|
||||
float rightStickY = GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_RIGHT_Y);
|
||||
float leftTrigger = GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_LEFT_TRIGGER);
|
||||
float rightTrigger = GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_RIGHT_TRIGGER);
|
||||
|
||||
// Calculate deadzones
|
||||
if (leftStickX > -leftStickDeadzoneX && leftStickX < leftStickDeadzoneX) leftStickX = 0.0f;
|
||||
if (leftStickY > -leftStickDeadzoneY && leftStickY < leftStickDeadzoneY) leftStickY = 0.0f;
|
||||
if (rightStickX > -rightStickDeadzoneX && rightStickX < rightStickDeadzoneX) rightStickX = 0.0f;
|
||||
if (rightStickY > -rightStickDeadzoneY && rightStickY < rightStickDeadzoneY) rightStickY = 0.0f;
|
||||
if (leftTrigger < leftTriggerDeadzone) leftTrigger = -1.0f;
|
||||
if (rightTrigger < rightTriggerDeadzone) rightTrigger = -1.0f;
|
||||
|
||||
if (TextFindIndex(TextToLower(GetGamepadName(gamepad)), XBOX_ALIAS_1) > -1 || TextFindIndex(TextToLower(GetGamepadName(gamepad)), XBOX_ALIAS_2) > -1)
|
||||
{
|
||||
DrawTexture(texXboxPad, 0, 0, DARKGRAY);
|
||||
|
||||
@ -95,32 +119,31 @@ int main(void)
|
||||
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_TRIGGER_1)) DrawCircle(536, 61, 20, RED);
|
||||
|
||||
// Draw axis: left joystick
|
||||
|
||||
Color leftGamepadColor = BLACK;
|
||||
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_THUMB)) leftGamepadColor = RED;
|
||||
DrawCircle(259, 152, 39, BLACK);
|
||||
DrawCircle(259, 152, 34, LIGHTGRAY);
|
||||
DrawCircle(259 + (int)(GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_LEFT_X)*20),
|
||||
152 + (int)(GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_LEFT_Y)*20), 25, leftGamepadColor);
|
||||
DrawCircle(259 + (int)(leftStickX*20),
|
||||
152 + (int)(leftStickY*20), 25, leftGamepadColor);
|
||||
|
||||
// Draw axis: right joystick
|
||||
Color rightGamepadColor = BLACK;
|
||||
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_THUMB)) rightGamepadColor = RED;
|
||||
DrawCircle(461, 237, 38, BLACK);
|
||||
DrawCircle(461, 237, 33, LIGHTGRAY);
|
||||
DrawCircle(461 + (int)(GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_RIGHT_X)*20),
|
||||
237 + (int)(GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_RIGHT_Y)*20), 25, rightGamepadColor);
|
||||
DrawCircle(461 + (int)(rightStickX*20),
|
||||
237 + (int)(rightStickY*20), 25, rightGamepadColor);
|
||||
|
||||
// Draw axis: left-right triggers
|
||||
DrawRectangle(170, 30, 15, 70, GRAY);
|
||||
DrawRectangle(604, 30, 15, 70, GRAY);
|
||||
DrawRectangle(170, 30, 15, (int)(((1 + GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_LEFT_TRIGGER))/2)*70), RED);
|
||||
DrawRectangle(604, 30, 15, (int)(((1 + GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_RIGHT_TRIGGER))/2)*70), RED);
|
||||
DrawRectangle(170, 30, 15, (int)(((1 + leftTrigger)/2)*70), RED);
|
||||
DrawRectangle(604, 30, 15, (int)(((1 + rightTrigger)/2)*70), RED);
|
||||
|
||||
//DrawText(TextFormat("Xbox axis LT: %02.02f", GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_LEFT_TRIGGER)), 10, 40, 10, BLACK);
|
||||
//DrawText(TextFormat("Xbox axis RT: %02.02f", GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_RIGHT_TRIGGER)), 10, 60, 10, BLACK);
|
||||
}
|
||||
else if (TextIsEqual(GetGamepadName(gamepad), PS3_NAME_ID))
|
||||
else if (TextFindIndex(TextToLower(GetGamepadName(gamepad)), PS_ALIAS) > -1)
|
||||
{
|
||||
DrawTexture(texPs3Pad, 0, 0, DARKGRAY);
|
||||
|
||||
@ -150,30 +173,85 @@ int main(void)
|
||||
// Draw axis: left joystick
|
||||
Color leftGamepadColor = BLACK;
|
||||
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_THUMB)) leftGamepadColor = RED;
|
||||
DrawCircle(319, 255, 35, leftGamepadColor);
|
||||
DrawCircle(319, 255, 35, BLACK);
|
||||
DrawCircle(319, 255, 31, LIGHTGRAY);
|
||||
DrawCircle(319 + (int)(GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_LEFT_X) * 20),
|
||||
255 + (int)(GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_LEFT_Y) * 20), 25, leftGamepadColor);
|
||||
DrawCircle(319 + (int)(leftStickX*20),
|
||||
255 + (int)(leftStickY*20), 25, leftGamepadColor);
|
||||
|
||||
// Draw axis: right joystick
|
||||
Color rightGamepadColor = BLACK;
|
||||
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_THUMB)) rightGamepadColor = RED;
|
||||
DrawCircle(475, 255, 35, BLACK);
|
||||
DrawCircle(475, 255, 31, LIGHTGRAY);
|
||||
DrawCircle(475 + (int)(GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_RIGHT_X) * 20),
|
||||
255 + (int)(GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_RIGHT_Y) * 20), 25, rightGamepadColor);
|
||||
DrawCircle(475 + (int)(rightStickX*20),
|
||||
255 + (int)(rightStickY*20), 25, rightGamepadColor);
|
||||
|
||||
// Draw axis: left-right triggers
|
||||
DrawRectangle(169, 48, 15, 70, GRAY);
|
||||
DrawRectangle(611, 48, 15, 70, GRAY);
|
||||
DrawRectangle(169, 48, 15, (int)(((1 - GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_LEFT_TRIGGER)) / 2) * 70), RED);
|
||||
DrawRectangle(611, 48, 15, (int)(((1 - GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_RIGHT_TRIGGER)) / 2) * 70), RED);
|
||||
DrawRectangle(169, 48, 15, (int)(((1 + leftTrigger)/2)*70), RED);
|
||||
DrawRectangle(611, 48, 15, (int)(((1 + rightTrigger)/2)*70), RED);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawText("- GENERIC GAMEPAD -", 280, 180, 20, GRAY);
|
||||
|
||||
// TODO: Draw generic gamepad
|
||||
// Draw background: generic
|
||||
DrawRectangleRounded((Rectangle){ 175, 110, 460, 220}, 0.3f, 0.0f, DARKGRAY);
|
||||
|
||||
// Draw buttons: basic
|
||||
DrawCircle(365, 170, 12, RAYWHITE);
|
||||
DrawCircle(405, 170, 12, RAYWHITE);
|
||||
DrawCircle(445, 170, 12, RAYWHITE);
|
||||
DrawCircle(516, 191, 17, RAYWHITE);
|
||||
DrawCircle(551, 227, 17, RAYWHITE);
|
||||
DrawCircle(587, 191, 17, RAYWHITE);
|
||||
DrawCircle(551, 155, 17, RAYWHITE);
|
||||
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_MIDDLE_LEFT)) DrawCircle(365, 170, 10, RED);
|
||||
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_MIDDLE)) DrawCircle(405, 170, 10, GREEN);
|
||||
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_MIDDLE_RIGHT)) DrawCircle(445, 170, 10, BLUE);
|
||||
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_FACE_LEFT)) DrawCircle(516, 191, 15, GOLD);
|
||||
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_FACE_DOWN)) DrawCircle(551, 227, 15, BLUE);
|
||||
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_FACE_RIGHT)) DrawCircle(587, 191, 15, GREEN);
|
||||
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_FACE_UP)) DrawCircle(551, 155, 15, RED);
|
||||
|
||||
// Draw buttons: d-pad
|
||||
DrawRectangle(245, 145, 28, 88, RAYWHITE);
|
||||
DrawRectangle(215, 174, 88, 29, RAYWHITE);
|
||||
DrawRectangle(247, 147, 24, 84, BLACK);
|
||||
DrawRectangle(217, 176, 84, 25, BLACK);
|
||||
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_FACE_UP)) DrawRectangle(247, 147, 24, 29, RED);
|
||||
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_FACE_DOWN)) DrawRectangle(247, 147 + 54, 24, 30, RED);
|
||||
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_FACE_LEFT)) DrawRectangle(217, 176, 30, 25, RED);
|
||||
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_FACE_RIGHT)) DrawRectangle(217 + 54, 176, 30, 25, RED);
|
||||
|
||||
// Draw buttons: left-right back
|
||||
DrawRectangleRounded((Rectangle){ 215, 98, 100, 10}, 0.5f, 0.0f, DARKGRAY);
|
||||
DrawRectangleRounded((Rectangle){ 495, 98, 100, 10}, 0.5f, 0.0f, DARKGRAY);
|
||||
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_TRIGGER_1)) DrawRectangleRounded((Rectangle){ 215, 98, 100, 10}, 0.5f, 0.0f, RED);
|
||||
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_TRIGGER_1)) DrawRectangleRounded((Rectangle){ 495, 98, 100, 10}, 0.5f, 0.0f, RED);
|
||||
|
||||
// Draw axis: left joystick
|
||||
Color leftGamepadColor = BLACK;
|
||||
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_THUMB)) leftGamepadColor = RED;
|
||||
DrawCircle(345, 260, 40, BLACK);
|
||||
DrawCircle(345, 260, 35, LIGHTGRAY);
|
||||
DrawCircle(345 + (int)(leftStickX*20),
|
||||
260 + (int)(leftStickY*20), 25, leftGamepadColor);
|
||||
|
||||
// Draw axis: right joystick
|
||||
Color rightGamepadColor = BLACK;
|
||||
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_THUMB)) rightGamepadColor = RED;
|
||||
DrawCircle(465, 260, 40, BLACK);
|
||||
DrawCircle(465, 260, 35, LIGHTGRAY);
|
||||
DrawCircle(465 + (int)(rightStickX*20),
|
||||
260 + (int)(rightStickY*20), 25, rightGamepadColor);
|
||||
|
||||
// Draw axis: left-right triggers
|
||||
DrawRectangle(151, 110, 15, 70, GRAY);
|
||||
DrawRectangle(644, 110, 15, 70, GRAY);
|
||||
DrawRectangle(151, 110, 15, (int)(((1 + leftTrigger)/2)*70), RED);
|
||||
DrawRectangle(644, 110, 15, (int)(((1 + rightTrigger)/2)*70), RED);
|
||||
|
||||
}
|
||||
|
||||
DrawText(TextFormat("DETECTED AXIS [%i]:", GetGamepadAxisCount(0)), 10, 50, 10, MAROON);
|
||||
|
@ -6662,6 +6662,29 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "CheckCollisionCircleLine",
|
||||
"description": "Check if circle collides with a line created betweeen two points [p1] and [p2]",
|
||||
"returnType": "bool",
|
||||
"params": [
|
||||
{
|
||||
"type": "Vector2",
|
||||
"name": "center"
|
||||
},
|
||||
{
|
||||
"type": "float",
|
||||
"name": "radius"
|
||||
},
|
||||
{
|
||||
"type": "Vector2",
|
||||
"name": "p1"
|
||||
},
|
||||
{
|
||||
"type": "Vector2",
|
||||
"name": "p2"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "CheckCollisionPointRec",
|
||||
"description": "Check if point is inside rectangle",
|
||||
@ -6719,6 +6742,29 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "CheckCollisionPointLine",
|
||||
"description": "Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]",
|
||||
"returnType": "bool",
|
||||
"params": [
|
||||
{
|
||||
"type": "Vector2",
|
||||
"name": "point"
|
||||
},
|
||||
{
|
||||
"type": "Vector2",
|
||||
"name": "p1"
|
||||
},
|
||||
{
|
||||
"type": "Vector2",
|
||||
"name": "p2"
|
||||
},
|
||||
{
|
||||
"type": "int",
|
||||
"name": "threshold"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "CheckCollisionPointPoly",
|
||||
"description": "Check if point is within a polygon described by array of vertices",
|
||||
@ -6765,52 +6811,6 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "CheckCollisionPointLine",
|
||||
"description": "Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]",
|
||||
"returnType": "bool",
|
||||
"params": [
|
||||
{
|
||||
"type": "Vector2",
|
||||
"name": "point"
|
||||
},
|
||||
{
|
||||
"type": "Vector2",
|
||||
"name": "p1"
|
||||
},
|
||||
{
|
||||
"type": "Vector2",
|
||||
"name": "p2"
|
||||
},
|
||||
{
|
||||
"type": "int",
|
||||
"name": "threshold"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "CheckCollisionCircleLine",
|
||||
"description": "Check if circle collides with a line created betweeen two points [p1] and [p2]",
|
||||
"returnType": "bool",
|
||||
"params": [
|
||||
{
|
||||
"type": "Vector2",
|
||||
"name": "center"
|
||||
},
|
||||
{
|
||||
"type": "float",
|
||||
"name": "radius"
|
||||
},
|
||||
{
|
||||
"type": "Vector2",
|
||||
"name": "p1"
|
||||
},
|
||||
{
|
||||
"type": "Vector2",
|
||||
"name": "p2"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "GetCollisionRec",
|
||||
"description": "Get collision rectangle for two rectangles collision",
|
||||
|
@ -5264,6 +5264,17 @@ return {
|
||||
{type = "Rectangle", name = "rec"}
|
||||
}
|
||||
},
|
||||
{
|
||||
name = "CheckCollisionCircleLine",
|
||||
description = "Check if circle collides with a line created betweeen two points [p1] and [p2]",
|
||||
returnType = "bool",
|
||||
params = {
|
||||
{type = "Vector2", name = "center"},
|
||||
{type = "float", name = "radius"},
|
||||
{type = "Vector2", name = "p1"},
|
||||
{type = "Vector2", name = "p2"}
|
||||
}
|
||||
},
|
||||
{
|
||||
name = "CheckCollisionPointRec",
|
||||
description = "Check if point is inside rectangle",
|
||||
@ -5294,6 +5305,17 @@ return {
|
||||
{type = "Vector2", name = "p3"}
|
||||
}
|
||||
},
|
||||
{
|
||||
name = "CheckCollisionPointLine",
|
||||
description = "Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]",
|
||||
returnType = "bool",
|
||||
params = {
|
||||
{type = "Vector2", name = "point"},
|
||||
{type = "Vector2", name = "p1"},
|
||||
{type = "Vector2", name = "p2"},
|
||||
{type = "int", name = "threshold"}
|
||||
}
|
||||
},
|
||||
{
|
||||
name = "CheckCollisionPointPoly",
|
||||
description = "Check if point is within a polygon described by array of vertices",
|
||||
@ -5316,28 +5338,6 @@ return {
|
||||
{type = "Vector2 *", name = "collisionPoint"}
|
||||
}
|
||||
},
|
||||
{
|
||||
name = "CheckCollisionPointLine",
|
||||
description = "Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]",
|
||||
returnType = "bool",
|
||||
params = {
|
||||
{type = "Vector2", name = "point"},
|
||||
{type = "Vector2", name = "p1"},
|
||||
{type = "Vector2", name = "p2"},
|
||||
{type = "int", name = "threshold"}
|
||||
}
|
||||
},
|
||||
{
|
||||
name = "CheckCollisionCircleLine",
|
||||
description = "Check if circle collides with a line created betweeen two points [p1] and [p2]",
|
||||
returnType = "bool",
|
||||
params = {
|
||||
{type = "Vector2", name = "center"},
|
||||
{type = "float", name = "radius"},
|
||||
{type = "Vector2", name = "p1"},
|
||||
{type = "Vector2", name = "p2"}
|
||||
}
|
||||
},
|
||||
{
|
||||
name = "GetCollisionRec",
|
||||
description = "Get collision rectangle for two rectangles collision",
|
||||
|
@ -2577,20 +2577,28 @@ Function 265: CheckCollisionCircleRec() (3 input parameters)
|
||||
Param[1]: center (type: Vector2)
|
||||
Param[2]: radius (type: float)
|
||||
Param[3]: rec (type: Rectangle)
|
||||
Function 266: CheckCollisionPointRec() (2 input parameters)
|
||||
Function 266: CheckCollisionCircleLine() (4 input parameters)
|
||||
Name: CheckCollisionCircleLine
|
||||
Return type: bool
|
||||
Description: Check if circle collides with a line created betweeen two points [p1] and [p2]
|
||||
Param[1]: center (type: Vector2)
|
||||
Param[2]: radius (type: float)
|
||||
Param[3]: p1 (type: Vector2)
|
||||
Param[4]: p2 (type: Vector2)
|
||||
Function 267: CheckCollisionPointRec() (2 input parameters)
|
||||
Name: CheckCollisionPointRec
|
||||
Return type: bool
|
||||
Description: Check if point is inside rectangle
|
||||
Param[1]: point (type: Vector2)
|
||||
Param[2]: rec (type: Rectangle)
|
||||
Function 267: CheckCollisionPointCircle() (3 input parameters)
|
||||
Function 268: CheckCollisionPointCircle() (3 input parameters)
|
||||
Name: CheckCollisionPointCircle
|
||||
Return type: bool
|
||||
Description: Check if point is inside circle
|
||||
Param[1]: point (type: Vector2)
|
||||
Param[2]: center (type: Vector2)
|
||||
Param[3]: radius (type: float)
|
||||
Function 268: CheckCollisionPointTriangle() (4 input parameters)
|
||||
Function 269: CheckCollisionPointTriangle() (4 input parameters)
|
||||
Name: CheckCollisionPointTriangle
|
||||
Return type: bool
|
||||
Description: Check if point is inside a triangle
|
||||
@ -2598,14 +2606,22 @@ Function 268: CheckCollisionPointTriangle() (4 input parameters)
|
||||
Param[2]: p1 (type: Vector2)
|
||||
Param[3]: p2 (type: Vector2)
|
||||
Param[4]: p3 (type: Vector2)
|
||||
Function 269: CheckCollisionPointPoly() (3 input parameters)
|
||||
Function 270: CheckCollisionPointLine() (4 input parameters)
|
||||
Name: CheckCollisionPointLine
|
||||
Return type: bool
|
||||
Description: Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]
|
||||
Param[1]: point (type: Vector2)
|
||||
Param[2]: p1 (type: Vector2)
|
||||
Param[3]: p2 (type: Vector2)
|
||||
Param[4]: threshold (type: int)
|
||||
Function 271: CheckCollisionPointPoly() (3 input parameters)
|
||||
Name: CheckCollisionPointPoly
|
||||
Return type: bool
|
||||
Description: Check if point is within a polygon described by array of vertices
|
||||
Param[1]: point (type: Vector2)
|
||||
Param[2]: points (type: const Vector2 *)
|
||||
Param[3]: pointCount (type: int)
|
||||
Function 270: CheckCollisionLines() (5 input parameters)
|
||||
Function 272: CheckCollisionLines() (5 input parameters)
|
||||
Name: CheckCollisionLines
|
||||
Return type: bool
|
||||
Description: Check the collision between two lines defined by two points each, returns collision point by reference
|
||||
@ -2614,22 +2630,6 @@ Function 270: CheckCollisionLines() (5 input parameters)
|
||||
Param[3]: startPos2 (type: Vector2)
|
||||
Param[4]: endPos2 (type: Vector2)
|
||||
Param[5]: collisionPoint (type: Vector2 *)
|
||||
Function 271: CheckCollisionPointLine() (4 input parameters)
|
||||
Name: CheckCollisionPointLine
|
||||
Return type: bool
|
||||
Description: Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]
|
||||
Param[1]: point (type: Vector2)
|
||||
Param[2]: p1 (type: Vector2)
|
||||
Param[3]: p2 (type: Vector2)
|
||||
Param[4]: threshold (type: int)
|
||||
Function 272: CheckCollisionCircleLine() (4 input parameters)
|
||||
Name: CheckCollisionCircleLine
|
||||
Return type: bool
|
||||
Description: Check if circle collides with a line created betweeen two points [p1] and [p2]
|
||||
Param[1]: center (type: Vector2)
|
||||
Param[2]: radius (type: float)
|
||||
Param[3]: p1 (type: Vector2)
|
||||
Param[4]: p2 (type: Vector2)
|
||||
Function 273: GetCollisionRec() (2 input parameters)
|
||||
Name: GetCollisionRec
|
||||
Return type: Rectangle
|
||||
|
@ -1659,6 +1659,12 @@
|
||||
<Param type="float" name="radius" desc="" />
|
||||
<Param type="Rectangle" name="rec" desc="" />
|
||||
</Function>
|
||||
<Function name="CheckCollisionCircleLine" retType="bool" paramCount="4" desc="Check if circle collides with a line created betweeen two points [p1] and [p2]">
|
||||
<Param type="Vector2" name="center" desc="" />
|
||||
<Param type="float" name="radius" desc="" />
|
||||
<Param type="Vector2" name="p1" desc="" />
|
||||
<Param type="Vector2" name="p2" desc="" />
|
||||
</Function>
|
||||
<Function name="CheckCollisionPointRec" retType="bool" paramCount="2" desc="Check if point is inside rectangle">
|
||||
<Param type="Vector2" name="point" desc="" />
|
||||
<Param type="Rectangle" name="rec" desc="" />
|
||||
@ -1674,6 +1680,12 @@
|
||||
<Param type="Vector2" name="p2" desc="" />
|
||||
<Param type="Vector2" name="p3" desc="" />
|
||||
</Function>
|
||||
<Function name="CheckCollisionPointLine" retType="bool" paramCount="4" desc="Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]">
|
||||
<Param type="Vector2" name="point" desc="" />
|
||||
<Param type="Vector2" name="p1" desc="" />
|
||||
<Param type="Vector2" name="p2" desc="" />
|
||||
<Param type="int" name="threshold" desc="" />
|
||||
</Function>
|
||||
<Function name="CheckCollisionPointPoly" retType="bool" paramCount="3" desc="Check if point is within a polygon described by array of vertices">
|
||||
<Param type="Vector2" name="point" desc="" />
|
||||
<Param type="const Vector2 *" name="points" desc="" />
|
||||
@ -1686,18 +1698,6 @@
|
||||
<Param type="Vector2" name="endPos2" desc="" />
|
||||
<Param type="Vector2 *" name="collisionPoint" desc="" />
|
||||
</Function>
|
||||
<Function name="CheckCollisionPointLine" retType="bool" paramCount="4" desc="Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]">
|
||||
<Param type="Vector2" name="point" desc="" />
|
||||
<Param type="Vector2" name="p1" desc="" />
|
||||
<Param type="Vector2" name="p2" desc="" />
|
||||
<Param type="int" name="threshold" desc="" />
|
||||
</Function>
|
||||
<Function name="CheckCollisionCircleLine" retType="bool" paramCount="4" desc="Check if circle collides with a line created betweeen two points [p1] and [p2]">
|
||||
<Param type="Vector2" name="center" desc="" />
|
||||
<Param type="float" name="radius" desc="" />
|
||||
<Param type="Vector2" name="p1" desc="" />
|
||||
<Param type="Vector2" name="p2" desc="" />
|
||||
</Function>
|
||||
<Function name="GetCollisionRec" retType="Rectangle" paramCount="2" desc="Get collision rectangle for two rectangles collision">
|
||||
<Param type="Rectangle" name="rec1" desc="" />
|
||||
<Param type="Rectangle" name="rec2" desc="" />
|
||||
|
@ -3295,8 +3295,7 @@ float GetGamepadAxisMovement(int gamepad, int axis)
|
||||
if ((gamepad < MAX_GAMEPADS) && CORE.Input.Gamepad.ready[gamepad] && (axis < MAX_GAMEPAD_AXIS)) {
|
||||
float movement = value < 0.0f ? CORE.Input.Gamepad.axisState[gamepad][axis] : fabsf(CORE.Input.Gamepad.axisState[gamepad][axis]);
|
||||
|
||||
// 0.1f = GAMEPAD_AXIS_MINIMUM_DRIFT/DELTA
|
||||
if (movement > value + 0.1f) value = CORE.Input.Gamepad.axisState[gamepad][axis];
|
||||
if (movement > value) value = CORE.Input.Gamepad.axisState[gamepad][axis];
|
||||
}
|
||||
|
||||
return value;
|
||||
|
@ -1650,7 +1650,7 @@ void DrawSplineLinear(const Vector2 *points, int pointCount, float thick, Color
|
||||
prevNormal = normal;
|
||||
}
|
||||
|
||||
#else // !SUPPORT_SPLINE_MITTERS
|
||||
#else // !SUPPORT_SPLINE_MITERS
|
||||
|
||||
Vector2 delta = { 0 };
|
||||
float length = 0.0f;
|
||||
|
Loading…
Reference in New Issue
Block a user