소스 검색

Merge branch 'master' of https://github.com/raysan5/raylib

pull/508/head
raysan5 7 년 전
부모
커밋
b9573e583f
6개의 변경된 파일260개의 추가작업 그리고 255개의 파일을 삭제
  1. +11
    -4
      examples/physac/physics_demo.c
  2. +1
    -1
      examples/physac/physics_friction.c
  3. +1
    -1
      examples/physac/physics_movement.c
  4. +1
    -1
      examples/physac/physics_restitution.c
  5. +10
    -4
      examples/physac/physics_shatter.c
  6. +236
    -244
      src/physac.h

+ 11
- 4
examples/physac/physics_demo.c 파일 보기

@ -10,7 +10,7 @@
* 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
*
* Copyright (c) 2017 Victor Fisac
* Copyright (c) 2016-2018 Victor Fisac
*
********************************************************************************************/
@ -32,6 +32,7 @@ int main()
// Physac logo drawing position
int logoX = screenWidth - MeasureText("Physac", 30) - 10;
int logoY = 15;
bool needsReset = false;
// Initialize physics and default physics bodies
InitPhysics();
@ -52,10 +53,9 @@ int main()
{
// 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->enabled = false;
@ -63,6 +63,13 @@ int main()
circle->enabled = false;
}
// Reset physics input
if (IsKeyPressed('R'))
{
ResetPhysics();
needsReset = true;
}
// Physics body creation inputs
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);

+ 1
- 1
examples/physac/physics_friction.c 파일 보기

@ -10,7 +10,7 @@
* 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
*
* Copyright (c) 2017 Victor Fisac
* Copyright (c) 2016-2018 Victor Fisac
*
********************************************************************************************/

+ 1
- 1
examples/physac/physics_movement.c 파일 보기

@ -10,7 +10,7 @@
* 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
*
* Copyright (c) 2017 Victor Fisac
* Copyright (c) 2016-2018 Victor Fisac
*
********************************************************************************************/

+ 1
- 1
examples/physac/physics_restitution.c 파일 보기

@ -10,7 +10,7 @@
* 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
*
* Copyright (c) 2017 Victor Fisac
* Copyright (c) 2016-2018 Victor Fisac
*
********************************************************************************************/

+ 10
- 4
examples/physac/physics_shatter.c 파일 보기

@ -10,7 +10,7 @@
* 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
*
* Copyright (c) 2017 Victor Fisac
* Copyright (c) 2016-2018 Victor Fisac
*
********************************************************************************************/
@ -32,6 +32,7 @@ int main()
// Physac logo drawing position
int logoX = screenWidth - MeasureText("Physac", 30) - 10;
int logoY = 15;
bool needsReset = false;
// Initialize physics and default physics bodies
InitPhysics();
@ -48,14 +49,19 @@ int main()
{
// Update
//----------------------------------------------------------------------------------
if (IsKeyPressed('R')) // Reset physics input
// Delay initialization of variables due to physics reset asynchronous
if (needsReset)
{
ResetPhysics();
// 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
{
ResetPhysics();
needsReset = true;
}
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) // Physics shatter input
{
// Note: some values need to be stored in variables due to asynchronous changes during main thread

+ 236
- 244
src/physac.h
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
파일 보기


불러오는 중...
취소
저장