raylib 5.5.0.3rc1__pp311-pypy311_pp73-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of raylib might be problematic. Click here for more details.

@@ -0,0 +1,171 @@
1
+ /**********************************************************************************************
2
+ *
3
+ * Physac v1.1 - 2D Physics library for videogames
4
+ *
5
+ * DESCRIPTION:
6
+ *
7
+ * Physac is a small 2D physics library written in pure C. The engine uses a fixed time-step thread loop
8
+ * to simluate physics. A physics step contains the following phases: get collision information,
9
+ * apply dynamics, collision solving and position correction. It uses a very simple struct for physic
10
+ * bodies with a position vector to be used in any 3D rendering API.
11
+ *
12
+ * CONFIGURATION:
13
+ *
14
+ * #define PHYSAC_IMPLEMENTATION
15
+ * Generates the implementation of the library into the included file.
16
+ * If not defined, the library is in header only mode and can be included in other headers
17
+ * or source files without problems. But only ONE file should hold the implementation.
18
+ *
19
+ * #define PHYSAC_STATIC (defined by default)
20
+ * The generated implementation will stay private inside implementation file and all
21
+ * internal symbols and functions will only be visible inside that file.
22
+ *
23
+ * #define PHYSAC_NO_THREADS
24
+ * The generated implementation won't include pthread library and user must create a secondary thread to call PhysicsThread().
25
+ * It is so important that the thread where PhysicsThread() is called must not have v-sync or any other CPU limitation.
26
+ *
27
+ * #define PHYSAC_STANDALONE
28
+ * Avoid raylib.h header inclusion in this file. Data types defined on raylib are defined
29
+ * internally in the library and input management and drawing functions must be provided by
30
+ * the user (check library implementation for further details).
31
+ *
32
+ * #define PHYSAC_DEBUG
33
+ * Traces log messages when creating and destroying physics bodies and detects errors in physics
34
+ * calculations and reference exceptions; it is useful for debug purposes
35
+ *
36
+ * #define PHYSAC_MALLOC()
37
+ * #define PHYSAC_FREE()
38
+ * You can define your own malloc/free implementation replacing stdlib.h malloc()/free() functions.
39
+ * Otherwise it will include stdlib.h and use the C standard library malloc()/free() function.
40
+ *
41
+ *
42
+ * NOTE 1: Physac requires multi-threading, when InitPhysics() a second thread is created to manage physics calculations.
43
+ * NOTE 2: Physac requires static C library linkage to avoid dependency on MinGW DLL (-static -lpthread)
44
+ *
45
+ * Use the following code to compile:
46
+ * gcc -o $(NAME_PART).exe $(FILE_NAME) -s -static -lraylib -lpthread -lopengl32 -lgdi32 -lwinmm -std=c99
47
+ *
48
+ * VERY THANKS TO:
49
+ * - raysan5: helped with library design
50
+ * - ficoos: added support for Linux
51
+ * - R8D8: added support for Linux
52
+ * - jubalh: fixed implementation of time calculations
53
+ * - a3f: fixed implementation of time calculations
54
+ * - define-private-public: added support for OSX
55
+ * - pamarcos: fixed implementation of physics steps
56
+ * - noshbar: fixed some memory leaks
57
+ *
58
+ *
59
+ * LICENSE: zlib/libpng
60
+ *
61
+ * Copyright (c) 2016-2025 Victor Fisac (github: @victorfisac)
62
+ *
63
+ * This software is provided "as-is", without any express or implied warranty. In no event
64
+ * will the authors be held liable for any damages arising from the use of this software.
65
+ *
66
+ * Permission is granted to anyone to use this software for any purpose, including commercial
67
+ * applications, and to alter it and redistribute it freely, subject to the following restrictions:
68
+ *
69
+ * 1. The origin of this software must not be misrepresented; you must not claim that you
70
+ * wrote the original software. If you use this software in a product, an acknowledgment
71
+ * in the product documentation would be appreciated but is not required.
72
+ *
73
+ * 2. Altered source versions must be plainly marked as such, and must not be misrepresented
74
+ * as being the original software.
75
+ *
76
+ * 3. This notice may not be removed or altered from any source distribution.
77
+ *
78
+ **********************************************************************************************/
79
+ // #define PHYSAC_STATIC
80
+ // #define PHYSAC_NO_THREADS
81
+ // #define PHYSAC_STANDALONE
82
+ // #define PHYSAC_DEBUG
83
+ //----------------------------------------------------------------------------------
84
+ // Defines and Macros
85
+ //----------------------------------------------------------------------------------
86
+ //----------------------------------------------------------------------------------
87
+ // Types and Structures Definition
88
+ // NOTE: Below types are required for PHYSAC_STANDALONE usage
89
+ //----------------------------------------------------------------------------------
90
+ typedef enum PhysicsShapeType { PHYSICS_CIRCLE, PHYSICS_POLYGON } PhysicsShapeType;
91
+ // Previously defined to be used in PhysicsShape struct as circular dependencies
92
+ typedef struct PhysicsBodyData *PhysicsBody;
93
+ // Mat2 type (used for polygon shape rotation matrix)
94
+ typedef struct Mat2 {
95
+ float m00;
96
+ float m01;
97
+ float m10;
98
+ float m11;
99
+ } Mat2;
100
+ typedef struct PolygonData {
101
+ unsigned int vertexCount; // Current used vertex and normals count
102
+ Vector2 positions[24]; // Polygon vertex positions vectors
103
+ Vector2 normals[24]; // Polygon vertex normals vectors
104
+ } PolygonData;
105
+ typedef struct PhysicsShape {
106
+ PhysicsShapeType type; // Physics shape type (circle or polygon)
107
+ PhysicsBody body; // Shape physics body reference
108
+ float radius; // Circle shape radius (used for circle shapes)
109
+ Mat2 transform; // Vertices transform matrix 2x2
110
+ PolygonData vertexData; // Polygon shape vertices position and normals data (just used for polygon shapes)
111
+ } PhysicsShape;
112
+ typedef struct PhysicsBodyData {
113
+ unsigned int id; // Reference unique identifier
114
+ bool enabled; // Enabled dynamics state (collisions are calculated anyway)
115
+ Vector2 position; // Physics body shape pivot
116
+ Vector2 velocity; // Current linear velocity applied to position
117
+ Vector2 force; // Current linear force (reset to 0 every step)
118
+ float angularVelocity; // Current angular velocity applied to orient
119
+ float torque; // Current angular force (reset to 0 every step)
120
+ float orient; // Rotation in radians
121
+ float inertia; // Moment of inertia
122
+ float inverseInertia; // Inverse value of inertia
123
+ float mass; // Physics body mass
124
+ float inverseMass; // Inverse value of mass
125
+ float staticFriction; // Friction when the body has not movement (0 to 1)
126
+ float dynamicFriction; // Friction when the body has movement (0 to 1)
127
+ float restitution; // Restitution coefficient of the body (0 to 1)
128
+ bool useGravity; // Apply gravity force to dynamics
129
+ bool isGrounded; // Physics grounded on other body state
130
+ bool freezeOrient; // Physics rotation constraint
131
+ PhysicsShape shape; // Physics body shape information (type, radius, vertices, normals)
132
+ } PhysicsBodyData;
133
+ typedef struct PhysicsManifoldData {
134
+ unsigned int id; // Reference unique identifier
135
+ PhysicsBody bodyA; // Manifold first physics body reference
136
+ PhysicsBody bodyB; // Manifold second physics body reference
137
+ float penetration; // Depth of penetration from collision
138
+ Vector2 normal; // Normal direction vector from 'a' to 'b'
139
+ Vector2 contacts[2]; // Points of contact during collision
140
+ unsigned int contactsCount; // Current collision number of contacts
141
+ float restitution; // Mixed restitution during collision
142
+ float dynamicFriction; // Mixed dynamic friction during collision
143
+ float staticFriction; // Mixed static friction during collision
144
+ } PhysicsManifoldData, *PhysicsManifold;
145
+ //----------------------------------------------------------------------------------
146
+ // Module Functions Declaration
147
+ //----------------------------------------------------------------------------------
148
+ extern /* Functions visible from other files*/ void InitPhysics(void); // Initializes physics values, pointers and creates physics loop thread
149
+ extern /* Functions visible from other files*/ void RunPhysicsStep(void); // Run physics step, to be used if PHYSICS_NO_THREADS is set in your main loop
150
+ extern /* Functions visible from other files*/ void SetPhysicsTimeStep(double delta); // Sets physics fixed time step in milliseconds. 1.666666 by default
151
+ extern /* Functions visible from other files*/ bool IsPhysicsEnabled(void); // Returns true if physics thread is currently enabled
152
+ extern /* Functions visible from other files*/ void SetPhysicsGravity(float x, float y); // Sets physics global gravity force
153
+ extern /* Functions visible from other files*/ PhysicsBody CreatePhysicsBodyCircle(Vector2 pos, float radius, float density); // Creates a new circle physics body with generic parameters
154
+ extern /* Functions visible from other files*/ PhysicsBody CreatePhysicsBodyRectangle(Vector2 pos, float width, float height, float density); // Creates a new rectangle physics body with generic parameters
155
+ extern /* Functions visible from other files*/ PhysicsBody CreatePhysicsBodyPolygon(Vector2 pos, float radius, int sides, float density); // Creates a new polygon physics body with generic parameters
156
+ extern /* Functions visible from other files*/ void PhysicsAddForce(PhysicsBody body, Vector2 force); // Adds a force to a physics body
157
+ extern /* Functions visible from other files*/ void PhysicsAddTorque(PhysicsBody body, float amount); // Adds an angular force to a physics body
158
+ extern /* Functions visible from other files*/ void PhysicsShatter(PhysicsBody body, Vector2 position, float force); // Shatters a polygon shape physics body to little physics bodies with explosion force
159
+ extern /* Functions visible from other files*/ int GetPhysicsBodiesCount(void); // Returns the current amount of created physics bodies
160
+ extern /* Functions visible from other files*/ PhysicsBody GetPhysicsBody(int index); // Returns a physics body of the bodies pool at a specific index
161
+ extern /* Functions visible from other files*/ int GetPhysicsShapeType(int index); // Returns the physics body shape type (PHYSICS_CIRCLE or PHYSICS_POLYGON)
162
+ extern /* Functions visible from other files*/ int GetPhysicsShapeVerticesCount(int index); // Returns the amount of vertices of a physics body shape
163
+ extern /* Functions visible from other files*/ Vector2 GetPhysicsShapeVertex(PhysicsBody body, int vertex); // Returns transformed position of a body shape (body position + vertex transformed position)
164
+ extern /* Functions visible from other files*/ void SetPhysicsBodyRotation(PhysicsBody body, float radians); // Sets physics body shape transform based on radians parameter
165
+ extern /* Functions visible from other files*/ void DestroyPhysicsBody(PhysicsBody body); // Unitializes and destroy a physics body
166
+ extern /* Functions visible from other files*/ void ClosePhysics(void); // Unitializes physics pointers and closes physics loop thread
167
+ /***********************************************************************************
168
+ *
169
+ * PHYSAC IMPLEMENTATION
170
+ *
171
+ ************************************************************************************/
raylib/py.typed ADDED
File without changes