Merge branch 'master' of https://github.com/raysan5/raylib
This commit is contained in:
commit
b9573e583f
@ -10,7 +10,7 @@
|
|||||||
* gcc -o $(NAME_PART).exe $(FILE_NAME) -s $(RAYLIB_DIR)\raylib\raylib_icon -static -lraylib -lpthread
|
* gcc -o $(NAME_PART).exe $(FILE_NAME) -s $(RAYLIB_DIR)\raylib\raylib_icon -static -lraylib -lpthread
|
||||||
* -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm -std=c99 -Wl,--subsystem,windows -Wl,-allow-multiple-definition
|
* -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm -std=c99 -Wl,--subsystem,windows -Wl,-allow-multiple-definition
|
||||||
*
|
*
|
||||||
* Copyright (c) 2017 Victor Fisac
|
* Copyright (c) 2016-2018 Victor Fisac
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
@ -32,6 +32,7 @@ int main()
|
|||||||
// Physac logo drawing position
|
// Physac logo drawing position
|
||||||
int logoX = screenWidth - MeasureText("Physac", 30) - 10;
|
int logoX = screenWidth - MeasureText("Physac", 30) - 10;
|
||||||
int logoY = 15;
|
int logoY = 15;
|
||||||
|
bool needsReset = false;
|
||||||
|
|
||||||
// Initialize physics and default physics bodies
|
// Initialize physics and default physics bodies
|
||||||
InitPhysics();
|
InitPhysics();
|
||||||
@ -52,10 +53,9 @@ int main()
|
|||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
if (IsKeyPressed('R')) // Reset physics input
|
// Delay initialization of variables due to physics reset async
|
||||||
|
if (needsReset)
|
||||||
{
|
{
|
||||||
ResetPhysics();
|
|
||||||
|
|
||||||
floor = CreatePhysicsBodyRectangle((Vector2){ screenWidth/2, screenHeight }, 500, 100, 10);
|
floor = CreatePhysicsBodyRectangle((Vector2){ screenWidth/2, screenHeight }, 500, 100, 10);
|
||||||
floor->enabled = false;
|
floor->enabled = false;
|
||||||
|
|
||||||
@ -63,6 +63,13 @@ int main()
|
|||||||
circle->enabled = false;
|
circle->enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reset physics input
|
||||||
|
if (IsKeyPressed('R'))
|
||||||
|
{
|
||||||
|
ResetPhysics();
|
||||||
|
needsReset = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Physics body creation inputs
|
// Physics body creation inputs
|
||||||
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) CreatePhysicsBodyPolygon(GetMousePosition(), GetRandomValue(20, 80), GetRandomValue(3, 8), 10);
|
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) CreatePhysicsBodyPolygon(GetMousePosition(), GetRandomValue(20, 80), GetRandomValue(3, 8), 10);
|
||||||
else if (IsMouseButtonPressed(MOUSE_RIGHT_BUTTON)) CreatePhysicsBodyCircle(GetMousePosition(), GetRandomValue(10, 45), 10);
|
else if (IsMouseButtonPressed(MOUSE_RIGHT_BUTTON)) CreatePhysicsBodyCircle(GetMousePosition(), GetRandomValue(10, 45), 10);
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
* gcc -o $(NAME_PART).exe $(FILE_NAME) -s $(RAYLIB_DIR)\raylib\raylib_icon -static -lraylib -lpthread
|
* gcc -o $(NAME_PART).exe $(FILE_NAME) -s $(RAYLIB_DIR)\raylib\raylib_icon -static -lraylib -lpthread
|
||||||
* -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm -std=c99 -Wl,--subsystem,windows -Wl,-allow-multiple-definition
|
* -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm -std=c99 -Wl,--subsystem,windows -Wl,-allow-multiple-definition
|
||||||
*
|
*
|
||||||
* Copyright (c) 2017 Victor Fisac
|
* Copyright (c) 2016-2018 Victor Fisac
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
* gcc -o $(NAME_PART).exe $(FILE_NAME) -s $(RAYLIB_DIR)\raylib\raylib_icon -static -lraylib -lpthread
|
* gcc -o $(NAME_PART).exe $(FILE_NAME) -s $(RAYLIB_DIR)\raylib\raylib_icon -static -lraylib -lpthread
|
||||||
* -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm -std=c99 -Wl,--subsystem,windows -Wl,-allow-multiple-definition
|
* -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm -std=c99 -Wl,--subsystem,windows -Wl,-allow-multiple-definition
|
||||||
*
|
*
|
||||||
* Copyright (c) 2017 Victor Fisac
|
* Copyright (c) 2016-2018 Victor Fisac
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
* gcc -o $(NAME_PART).exe $(FILE_NAME) -s $(RAYLIB_DIR)\raylib\raylib_icon -static -lraylib -lpthread
|
* gcc -o $(NAME_PART).exe $(FILE_NAME) -s $(RAYLIB_DIR)\raylib\raylib_icon -static -lraylib -lpthread
|
||||||
* -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm -std=c99 -Wl,--subsystem,windows -Wl,-allow-multiple-definition
|
* -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm -std=c99 -Wl,--subsystem,windows -Wl,-allow-multiple-definition
|
||||||
*
|
*
|
||||||
* Copyright (c) 2017 Victor Fisac
|
* Copyright (c) 2016-2018 Victor Fisac
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
* gcc -o $(NAME_PART).exe $(FILE_NAME) -s $(RAYLIB_DIR)\raylib\raylib_icon -static -lraylib -lpthread
|
* gcc -o $(NAME_PART).exe $(FILE_NAME) -s $(RAYLIB_DIR)\raylib\raylib_icon -static -lraylib -lpthread
|
||||||
* -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm -std=c99 -Wl,--subsystem,windows -Wl,-allow-multiple-definition
|
* -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm -std=c99 -Wl,--subsystem,windows -Wl,-allow-multiple-definition
|
||||||
*
|
*
|
||||||
* Copyright (c) 2017 Victor Fisac
|
* Copyright (c) 2016-2018 Victor Fisac
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
@ -32,6 +32,7 @@ int main()
|
|||||||
// Physac logo drawing position
|
// Physac logo drawing position
|
||||||
int logoX = screenWidth - MeasureText("Physac", 30) - 10;
|
int logoX = screenWidth - MeasureText("Physac", 30) - 10;
|
||||||
int logoY = 15;
|
int logoY = 15;
|
||||||
|
bool needsReset = false;
|
||||||
|
|
||||||
// Initialize physics and default physics bodies
|
// Initialize physics and default physics bodies
|
||||||
InitPhysics();
|
InitPhysics();
|
||||||
@ -48,12 +49,17 @@ int main()
|
|||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
// Delay initialization of variables due to physics reset asynchronous
|
||||||
|
if (needsReset)
|
||||||
|
{
|
||||||
|
// Create random polygon physics body to shatter
|
||||||
|
body = CreatePhysicsBodyPolygon((Vector2){ screenWidth/2, screenHeight/2 }, GetRandomValue(80, 200), GetRandomValue(3, 8), 10);
|
||||||
|
}
|
||||||
|
|
||||||
if (IsKeyPressed('R')) // Reset physics input
|
if (IsKeyPressed('R')) // Reset physics input
|
||||||
{
|
{
|
||||||
ResetPhysics();
|
ResetPhysics();
|
||||||
|
needsReset = true;
|
||||||
// Create random polygon physics body to shatter
|
|
||||||
body = CreatePhysicsBodyPolygon((Vector2){ screenWidth/2, screenHeight/2 }, GetRandomValue(80, 200), GetRandomValue(3, 8), 10);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) // Physics shatter input
|
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) // Physics shatter input
|
||||||
|
458
src/physac.h
458
src/physac.h
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user