From 59038bae96bf8e9ae96ce3432ddbde96590f4642 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sun, 5 Mar 2017 21:04:07 +0100 Subject: Added function: DrawLineEx() Supports line thickness --- examples/core_basic_window.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'examples') diff --git a/examples/core_basic_window.c b/examples/core_basic_window.c index fb83400a..888f3460 100644 --- a/examples/core_basic_window.c +++ b/examples/core_basic_window.c @@ -39,6 +39,11 @@ int main() // Update //---------------------------------------------------------------------------------- // TODO: Update your variables here + float dx = 600 - 100; + float dy = 105 - 405; + + float d = sqrtf(dx*dx + dy*dy); + float angle = asinf(dy/d); //---------------------------------------------------------------------------------- // Draw @@ -47,7 +52,22 @@ int main() ClearBackground(RAYWHITE); - DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY); + //DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY); + + DrawRectangle(100, 400, 1, 10, BLACK); + DrawRectangle(96, 404, 10, 1, BLACK); + + DrawRectangle(600, 100, 1, 10, BLACK); + DrawRectangle(596, 104, 10, 1, BLACK); + + DrawLine(100, 405, 600, 105, RED); + + // Draw lines using textures + /* + DrawTexturePro(GetDefaultTexture(), (Rectangle){ 0, 0, GetDefaultTexture().width, GetDefaultTexture().height }, + (Rectangle){ 100, 405, (float)GetDefaultTexture().width*d, 1 }, + (Vector2){ 0, (float)GetDefaultTexture().height/2 }, -RAD2DEG*angle, BLUE); + */ EndDrawing(); //---------------------------------------------------------------------------------- -- cgit v1.2.3 From b734802743f2089c8d649b27aea48ab71fa653b3 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sun, 5 Mar 2017 21:05:17 +0100 Subject: Revert test code... --- examples/core_basic_window.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'examples') diff --git a/examples/core_basic_window.c b/examples/core_basic_window.c index 888f3460..fb83400a 100644 --- a/examples/core_basic_window.c +++ b/examples/core_basic_window.c @@ -39,11 +39,6 @@ int main() // Update //---------------------------------------------------------------------------------- // TODO: Update your variables here - float dx = 600 - 100; - float dy = 105 - 405; - - float d = sqrtf(dx*dx + dy*dy); - float angle = asinf(dy/d); //---------------------------------------------------------------------------------- // Draw @@ -52,22 +47,7 @@ int main() ClearBackground(RAYWHITE); - //DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY); - - DrawRectangle(100, 400, 1, 10, BLACK); - DrawRectangle(96, 404, 10, 1, BLACK); - - DrawRectangle(600, 100, 1, 10, BLACK); - DrawRectangle(596, 104, 10, 1, BLACK); - - DrawLine(100, 405, 600, 105, RED); - - // Draw lines using textures - /* - DrawTexturePro(GetDefaultTexture(), (Rectangle){ 0, 0, GetDefaultTexture().width, GetDefaultTexture().height }, - (Rectangle){ 100, 405, (float)GetDefaultTexture().width*d, 1 }, - (Vector2){ 0, (float)GetDefaultTexture().height/2 }, -RAD2DEG*angle, BLUE); - */ + DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY); EndDrawing(); //---------------------------------------------------------------------------------- -- cgit v1.2.3 From c964559bc966292a7d70f00559ea80c224aab96d Mon Sep 17 00:00:00 2001 From: victorfisac Date: Mon, 6 Mar 2017 22:57:33 +0100 Subject: Update physac source and examples with new changes --- examples/physics_demo.c | 7 +++++-- examples/physics_friction.c | 7 +++++-- examples/physics_movement.c | 7 +++++-- examples/physics_restitution.c | 7 +++++-- examples/physics_shatter.c | 7 +++++-- src/physac.h | 9 ++++++++- 6 files changed, 33 insertions(+), 11 deletions(-) (limited to 'examples') diff --git a/examples/physics_demo.c b/examples/physics_demo.c index de8d515e..b12ac708 100644 --- a/examples/physics_demo.c +++ b/examples/physics_demo.c @@ -3,9 +3,12 @@ * Physac - Physics demo * * NOTE: Physac requires multi-threading, when InitPhysics() a second thread is created to manage physics calculations. -* The file pthreadGC2.dll is required to run the program; you can find it in 'src\external' * -* Copyright (c) 2016 Victor Fisac +* Use the following code to compile (-static -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 +* +* Copyright (c) 2017 Victor Fisac * ********************************************************************************************/ diff --git a/examples/physics_friction.c b/examples/physics_friction.c index a4baad53..db1b5f4c 100644 --- a/examples/physics_friction.c +++ b/examples/physics_friction.c @@ -3,9 +3,12 @@ * Physac - Physics friction * * NOTE: Physac requires multi-threading, when InitPhysics() a second thread is created to manage physics calculations. -* The file pthreadGC2.dll is required to run the program; you can find it in 'src\external' * -* Copyright (c) 2016 Victor Fisac +* Use the following code to compile (-static -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 +* +* Copyright (c) 2017 Victor Fisac * ********************************************************************************************/ diff --git a/examples/physics_movement.c b/examples/physics_movement.c index ee97845f..3345404d 100644 --- a/examples/physics_movement.c +++ b/examples/physics_movement.c @@ -3,9 +3,12 @@ * Physac - Physics movement * * NOTE: Physac requires multi-threading, when InitPhysics() a second thread is created to manage physics calculations. -* The file pthreadGC2.dll is required to run the program; you can find it in 'src\external' * -* Copyright (c) 2016 Victor Fisac +* Use the following code to compile (-static -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 +* +* Copyright (c) 2017 Victor Fisac * ********************************************************************************************/ diff --git a/examples/physics_restitution.c b/examples/physics_restitution.c index 378f6f24..534d125e 100644 --- a/examples/physics_restitution.c +++ b/examples/physics_restitution.c @@ -3,9 +3,12 @@ * Physac - Physics restitution * * NOTE: Physac requires multi-threading, when InitPhysics() a second thread is created to manage physics calculations. -* The file pthreadGC2.dll is required to run the program; you can find it in 'src\external' * -* Copyright (c) 2016 Victor Fisac +* Use the following code to compile (-static -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 +* +* Copyright (c) 2017 Victor Fisac * ********************************************************************************************/ diff --git a/examples/physics_shatter.c b/examples/physics_shatter.c index 637a163e..fac90714 100644 --- a/examples/physics_shatter.c +++ b/examples/physics_shatter.c @@ -3,9 +3,12 @@ * Physac - Body shatter * * NOTE: Physac requires multi-threading, when InitPhysics() a second thread is created to manage physics calculations. -* The file pthreadGC2.dll is required to run the program; you can find it in 'src\external' * -* Copyright (c) 2016 Victor Fisac +* Use the following code to compile (-static -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 +* +* Copyright (c) 2017 Victor Fisac * ********************************************************************************************/ diff --git a/src/physac.h b/src/physac.h index a6b529bc..ff56615d 100644 --- a/src/physac.h +++ b/src/physac.h @@ -38,13 +38,20 @@ * You can define your own malloc/free implementation replacing stdlib.h malloc()/free() functions. * Otherwise it will include stdlib.h and use the C standard library malloc()/free() function. * +* +* NOTE: Physac requires multi-threading, when InitPhysics() a second thread is created to manage physics calculations. +* +* Use the following code to compile (-static -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 +* * VERY THANKS TO: * Ramón Santamaria (@raysan5) * * * LICENSE: zlib/libpng * -* Copyright (c) 2016 Victor Fisac +* Copyright (c) 2017 Victor Fisac * * This software is provided "as-is", without any express or implied warranty. In no event * will the authors be held liable for any damages arising from the use of this software. -- cgit v1.2.3