From d930066a204df290db6f7dcdd6d9ca890ec2f2f1 Mon Sep 17 00:00:00 2001 From: realtradam Date: Mon, 16 May 2022 20:30:47 -0400 Subject: added origin markers --- .gitignore | 3 ++- Makefile | 4 ++-- main.c | 50 ++++++++++++++++++++++++++++++++++++++------------ 3 files changed, 42 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index e5dca67..bf225ca 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ game -output +output/* +lib/* diff --git a/Makefile b/Makefile index db9308f..aec7883 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ desktop: - zig cc -target native main.c -o game -lGL -lm -lpthread -ldl -lrt -lX11 -Iraylib/src -Iraygui/src raylib/src/libraylib.a && ./game + zig cc -target native main.c -o game -lGL -lm -lpthread -ldl -lrt -lX11 -Iraylib/src -Iraygui/src lib/tux/libraylib.a && ./game web: - emcc -Os -Wall main.c -o game -Iraylib/src -Iraygui/src raylib/src/libraylib.a -o output/index.html -s USE_GLFW=3 -DPLATFORM_WEB --shell-file raylib/src/minshell.html -s TOTAL_MEMORY=268435456 -s ASYNCIFY --preload-file ./assets + emcc -Os -Wall main.c -o game -Iraylib/src -Iraygui/src lib/web/libraylib.a -o output/index.html -s USE_GLFW=3 -DPLATFORM_WEB --shell-file raylib/src/minshell.html -s TOTAL_MEMORY=268435456 -s ASYNCIFY --preload-file ./assets diff --git a/main.c b/main.c index b956417..45dd5ba 100644 --- a/main.c +++ b/main.c @@ -506,7 +506,6 @@ void DrawOutput() { } if (sourceRect.height < 0) { sourceRect.height *= -1; - } DrawRectangleLinesEx( (Rectangle) { @@ -619,6 +618,16 @@ void DrawOutput() { destRect.height *= -1; } + DrawRectangleLinesEx( + (Rectangle) { + .x = destRect.x - dtpOrigin.x, + .y = destRect.y - dtpOrigin.y, + .width = destRect.width, + .height = destRect.height, + }, + 1, + BLUE + ); DrawRectangleLinesEx( (Rectangle) { .x = destRect.x, @@ -629,11 +638,28 @@ void DrawOutput() { 2, DARKGREEN ); + DrawCircle( + destRect.x - dtpOrigin.x, + destRect.y - dtpOrigin.y, + 5, + BLUE + ); + DrawTextEx( + sourceCodeFont, + "Origin", + (Vector2) { + .x = destRect.x - 48 - dtpOrigin.x, + .y = destRect.y - fontSize + 16 - dtpOrigin.y + }, + fontSize, + fontSpacing, + BLUE + ); DrawTextEx( sourceCodeFont, "Dest", (Vector2) { - .x = destRect.x, + .x = destRect.x + 8, .y = destRect.y - fontSize + 1 }, fontSize, @@ -664,16 +690,16 @@ void DrawOutput() { ); //elementCode - sprintf(codePreviewArray[3], " .x = %d.0f,", (int)dtpSource.x); - sprintf(codePreviewArray[4], " .y = %d.0f,", (int)dtpSource.y); - sprintf(codePreviewArray[5], " .width = %d.0f,", (int)dtpSource.width); - sprintf(codePreviewArray[6], " .height = %d.0f", (int)dtpSource.height); - sprintf(codePreviewArray[9], " .x = %d.0f,", (int)dtpDest.x); - sprintf(codePreviewArray[10], " .y = %d.0f,", (int)dtpDest.y); - sprintf(codePreviewArray[11], " .width = %d.0f,", (int)dtpDest.width); - sprintf(codePreviewArray[12], " .height = %d.0f", (int)dtpDest.height); - sprintf(codePreviewArray[15], " .x = %d.0f,", (int)dtpOrigin.x); - sprintf(codePreviewArray[16], " .y = %d.0f,", (int)dtpOrigin.y); + sprintf(codePreviewArray[3], " .x = %d,", (int)dtpSource.x); + sprintf(codePreviewArray[4], " .y = %d,", (int)dtpSource.y); + sprintf(codePreviewArray[5], " .width = %d,", (int)dtpSource.width); + sprintf(codePreviewArray[6], " .height = %d", (int)dtpSource.height); + sprintf(codePreviewArray[9], " .x = %d,", (int)dtpDest.x); + sprintf(codePreviewArray[10], " .y = %d,", (int)dtpDest.y); + sprintf(codePreviewArray[11], " .width = %d,", (int)dtpDest.width); + sprintf(codePreviewArray[12], " .height = %d", (int)dtpDest.height); + sprintf(codePreviewArray[15], " .x = %d,", (int)dtpOrigin.x); + sprintf(codePreviewArray[16], " .y = %d,", (int)dtpOrigin.y); sprintf(codePreviewArray[18], " %d, // Rotation", (int)dtpRotation); for(i = 0; i < 21; i += 1) { -- cgit v1.2.3