Skip to content
This repository was archived by the owner on Dec 29, 2023. It is now read-only.

Commit

Permalink
Update Main.hx
Browse files Browse the repository at this point in the history
latest update to minimize the cutter size to a circle (basicaly the very radius). Parameterized the smoothing parameter
  • Loading branch information
fire-h0und authored Dec 11, 2023
1 parent 04b09c6 commit 93e23b1
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions Sources/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@ import kha.System;

class Main {
static var logo = ["1 1 1 1 111", "11 111 111", "1 1 1 1 1 1"];
static var smooth = 2.2;
static var scale = 51/100;
static var outline = 0;
static var topradius = 8;
static var bottomradius = 4;
static var topradius = 10*scale;
static var bottomradius = 8*scale;
static var topcolor = 0xffaaaaaa;
static var bottomcolor = 0xffcccccc;
static var backgroundcolor = Color.Black;
static var xcoord1 = 30;
static var ycoord1 = 20;
static var xcoord2 = 330;
static var xcoord2 = 30+300*scale;
static var ycoord2 = 20;


Expand All @@ -31,50 +33,50 @@ class Main {
//ISO shape (units are 1/100 of 1U)
sdfPainter.color = bottomcolor;
//basic rectangle
sdfPainter.sdfRect(xcoord1+ 0,ycoord1+ 0, 150, 100, {tr: bottomradius}, outline, Color.White, 1.2);
sdfPainter.sdfRect(xcoord1+ 0,ycoord1+ 0, 150*scale, 100*scale, {tr: bottomradius}, outline, backgroundcolor, smooth);
//overlapping lower part:
sdfPainter.sdfRect(xcoord1+ 25,ycoord1+ 0, 125, 200, {tr: bottomradius}, outline, Color.White, 1.2);
sdfPainter.sdfRect(xcoord1+ 25*scale,ycoord1+ 100*scale-bottomradius, 125*scale, 100*scale+bottomradius, {tr: bottomradius}, outline, backgroundcolor, smooth);
//inner meat to be cut off later
sdfPainter.sdfCircle(xcoord1+ 25,ycoord1+100, bottomradius*1.5, outline, Color.White, 1.2);
sdfPainter.sdfCircle(xcoord1+ 25*scale,ycoord1+100*scale, bottomradius, outline, backgroundcolor, smooth);
sdfPainter.color = backgroundcolor;
//the cutter
sdfPainter.sdfRect(xcoord1+ 0,ycoord1+100, 25, 25, {tr: bottomradius}, outline, Color.White, 1.2, Black, Black, Black, Black);
sdfPainter.sdfCircle(xcoord1+ 25*scale-bottomradius,ycoord1+100*scale+bottomradius, bottomradius, outline, backgroundcolor, smooth);

//the top:
sdfPainter.color = topcolor;
//basic rectangle
sdfPainter.sdfRect(xcoord1+ topradius*2,ycoord1+ topradius*1, 150-topradius*4, 100-topradius*4, {tr: topradius}, outline, Color.White, 1.2);
sdfPainter.sdfRect(xcoord1+ topradius*2,ycoord1+ topradius*1, 150*scale-topradius*4, 100*scale-topradius*4, {tr: topradius}, outline, backgroundcolor, smooth);
//overlapping lower part:
sdfPainter.sdfRect(xcoord1+ 25+topradius*2,ycoord1+ topradius*1, 125-topradius*4, 200-topradius*4, {tr: topradius}, outline, Color.White, 1.2);
sdfPainter.sdfRect(xcoord1+ 25*scale+topradius*2,ycoord1+ topradius*1, 125*scale-topradius*4, 200*scale-topradius*4, {tr: topradius}, outline, backgroundcolor, smooth);
//inner meat to be cut off later
sdfPainter.sdfCircle(xcoord1+ 25+topradius*2,ycoord1+ 100-topradius*3, topradius*1, outline, Color.White, 1.2);
sdfPainter.sdfCircle(xcoord1+ 25*scale+topradius*2,ycoord1+ 100*scale-topradius*3, topradius*1, outline, backgroundcolor, smooth);
//the cutter
sdfPainter.color = bottomcolor;
sdfPainter.sdfRect(xcoord1+ 25-topradius*0,ycoord1+ 100-topradius*3, topradius*2, topradius*2, {tr: topradius}, outline, Color.White, 1.2);
sdfPainter.sdfCircle(xcoord1+ 25*scale+topradius*2-topradius*1,ycoord1+ 100*scale-topradius*3+topradius*1, topradius*1, outline, backgroundcolor, smooth);

//BAE shape (units are 1/100 of 1U)
sdfPainter.color = bottomcolor;
//overlapping upper part:
sdfPainter.sdfRect(xcoord2+75,ycoord2+ 0, 150, 200, {tr: bottomradius}, outline, Color.White, 1.2);
sdfPainter.sdfRect(xcoord2+75*scale,ycoord2+ 0, 150*scale, 100*scale+bottomradius, {tr: bottomradius}, outline, backgroundcolor, smooth);
//basic rectangle
sdfPainter.sdfRect(xcoord2+ 0,ycoord2+100, 225, 100, {tr: bottomradius}, outline, Color.White, 1.2);
sdfPainter.sdfRect(xcoord2+ 0,ycoord2+100*scale, 225*scale, 100*scale, {tr: bottomradius}, outline, backgroundcolor, smooth);
//inner meat to be cut off later
sdfPainter.sdfCircle(xcoord2+75,ycoord2+100, bottomradius*1.5, outline, Color.White, 1.2);
sdfPainter.sdfCircle(xcoord2+75*scale,ycoord2+100*scale, bottomradius, outline, backgroundcolor, smooth);
sdfPainter.color = backgroundcolor;
//the cutter
sdfPainter.sdfRect(xcoord2+ 75-25,ycoord2+100-25, 25, 25, {tr: bottomradius}, outline, Color.White, 1.2, Black, Black, Black, Black);
sdfPainter.sdfCircle(xcoord2+75*scale-bottomradius,ycoord2+100*scale-bottomradius, bottomradius, outline, backgroundcolor, smooth);

//the top:
sdfPainter.color = topcolor;
//overlapping lower part:
sdfPainter.sdfRect(xcoord2+ 75+topradius*2,ycoord2+ topradius*1, 150-topradius*4, 200-topradius*4, {tr: topradius}, outline, Color.White, 1.2);
sdfPainter.sdfRect(xcoord2+ 75*scale+topradius*2,ycoord2+ topradius*1, 150*scale-topradius*4, 200*scale-topradius*4, {tr: topradius}, outline, backgroundcolor, smooth);
//basic rectangle
sdfPainter.sdfRect(xcoord2+ topradius*2,ycoord2+100+ topradius*1, 225-topradius*4, 100-topradius*4, {tr: topradius}, outline, Color.White, 1.2);
sdfPainter.sdfRect(xcoord2+ topradius*2,ycoord2+100*scale+ topradius*1, 225*scale-topradius*4, 100*scale-topradius*4, {tr: topradius}, outline, backgroundcolor, smooth);
//inner meat to be cut off later
sdfPainter.sdfCircle(xcoord2+ 75+topradius*2,ycoord2+ 100+topradius*1, topradius*1, outline, Color.White, 1.2);
sdfPainter.sdfCircle(xcoord2+ 75*scale+topradius*2,ycoord2+ 100*scale+topradius*1, topradius*1, outline, backgroundcolor, smooth);
//the cutter
sdfPainter.color = bottomcolor;
sdfPainter.sdfRect(xcoord2+ 75-topradius*0,ycoord2+ 100-topradius*1, topradius*2, topradius*2, {tr: topradius}, outline, Color.White, 1.2);
sdfPainter.sdfCircle(xcoord2+ 75*scale+topradius*2-topradius,ycoord2+ 100*scale+topradius*1-topradius, topradius, outline, backgroundcolor, smooth);

sdfPainter.end();
}
Expand Down

0 comments on commit 93e23b1

Please sign in to comment.