Compare commits

...

14 Commits

Author SHA1 Message Date
f84e9af92c
update ci/cd 2023-12-31 20:49:53 +03:00
3aa6753846 Merge branch 'MegaLinter' 2023-05-14 12:16:42 +03:00
56ae8f820c update .editorconfig 2023-05-14 12:16:17 +03:00
a9a22e9133
Update README.md 2023-05-10 05:40:28 +03:00
e76556be11
Update README.md 2023-05-10 05:35:52 +03:00
13798bb0b8
Update README.md 2023-05-10 05:17:21 +03:00
bca4a2638b
Merge pull request #1 from GenZmeY/MegaLinter
add Mega Linter
2023-05-10 05:13:39 +03:00
a672112516
Merge branch 'master' into MegaLinter 2023-05-10 05:13:15 +03:00
3a63046420
Update README.md 2023-05-10 05:11:29 +03:00
0974960556 fix style to match the linters 2023-05-10 04:42:07 +03:00
74e90c84e6 add MegaLinter 2023-05-10 04:29:14 +03:00
83281bf7f9 update .editorconfig 2023-05-10 04:28:42 +03:00
d41af8e4ee Update README.md 2023-05-01 19:47:17 +03:00
e65f6efc81
Update README.md (add examples) 2023-01-30 03:57:28 +03:00
5 changed files with 284 additions and 133 deletions

View File

@ -1,5 +1,33 @@
root = true
[*]
indent_style = tab
indent_size = 4
root = true
# Global
[*]
indent_style = unset
indent_size = 4
tab_width = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = unset
# Unreal Engine 3 / Source
[*.uc]
indent_style = tab
[*.{uci,upkg}]
# Unreal Engine 3 / i18n
[*.{chn,cht,cze,dan,deu,dut,esl,esn,fra,frc,hun,int,ita,jpn,kor,pol,por,ptb,rus,tur,ukr}]
charset = utf-16le
# Other
[*.md]
indent_style = space
trim_trailing_whitespace = false
[*.yml]
indent_style = space
indent_size = 2
[*.{txt,cfg,conf}]
indent_style = tab

114
.github/workflows/mega-linter.yml vendored Normal file
View File

@ -0,0 +1,114 @@
---
name: MegaLinter
permissions: read-all
on:
push:
pull_request:
branches:
- master
env:
APPLY_FIXES: none
APPLY_FIXES_EVENT: pull_request
APPLY_FIXES_MODE: commit
FILTER_REGEX_EXCLUDE: (mega-linter.yml)
DISABLE: SPELL
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
megalinter:
name: MegaLinter
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
steps:
- name: Checkout Code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: MegaLinter
uses: oxsecurity/megalinter@7e042c726c68415475b05a65a686c612120a1232
id: ml
env:
VALIDATE_ALL_CODEBASE: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Archive production artifacts
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392
if: success() || failure()
with:
name: MegaLinter reports
path: |
megalinter-reports
mega-linter.log
- name: Set APPLY_FIXES_IF var
run: |
printf 'APPLY_FIXES_IF=%s\n' "${{
steps.ml.outputs.has_updated_sources == 1 &&
(
env.APPLY_FIXES_EVENT == 'all' ||
env.APPLY_FIXES_EVENT == github.event_name
) &&
(
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name == github.repository
)
}}" >> "${GITHUB_ENV}"
- name: Set APPLY_FIXES_IF_* vars
run: |
printf 'APPLY_FIXES_IF_PR=%s\n' "${{
env.APPLY_FIXES_IF == 'true' &&
env.APPLY_FIXES_MODE == 'pull_request'
}}" >> "${GITHUB_ENV}"
printf 'APPLY_FIXES_IF_COMMIT=%s\n' "${{
env.APPLY_FIXES_IF == 'true' &&
env.APPLY_FIXES_MODE == 'commit' &&
(!contains(fromJSON('["refs/heads/main", "refs/heads/master"]'), github.ref))
}}" >> "${GITHUB_ENV}"
- name: Create Pull Request with applied fixes
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38
id: cpr
if: env.APPLY_FIXES_IF_PR == 'true'
with:
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
commit-message: "[MegaLinter] Apply linters automatic fixes"
title: "[MegaLinter] Apply linters automatic fixes"
labels: bot
- name: Create PR output
if: env.APPLY_FIXES_IF_PR == 'true'
run: |
echo "PR Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "PR URL - ${{ steps.cpr.outputs.pull-request-url }}"
- name: Prepare commit
if: env.APPLY_FIXES_IF_COMMIT == 'true'
run: sudo chown -Rc $UID .git/
- name: Commit and push applied linter fixes
uses: stefanzweifel/git-auto-commit-action@8756aa072ef5b4a080af5dc8fef36c5d586e521d
if: env.APPLY_FIXES_IF_COMMIT == 'true'
with:
branch: >-
${{
github.event.pull_request.head.ref ||
github.head_ref ||
github.ref
}}
commit_message: "[MegaLinter] Apply linters fixes"
commit_user_name: "github-actions"
commit_user_email: "github-actions[bot]@users.noreply.github.com"

View File

@ -3,7 +3,7 @@ class BoxPainter extends BoxPainterBase;
public final function DrawBox(float X, float Y, float Width, float Height, float Edge, optional byte Shape = 0)
{
Edge = FMin(FMin(Edge, Width * 0.5), Height * 0.5);
switch (Shape)
{
case 100:
@ -15,7 +15,7 @@ public final function DrawBox(float X, float Y, float Width, float Height, float
ECS_Corner // BottomRight //
);
break;
case 110:
DrawShapedBox(
X, Y, Width, Height, Edge, // ______
@ -25,17 +25,17 @@ public final function DrawBox(float X, float Y, float Width, float Height, float
ECS_BeveledCorner // BottomRight //
);
break;
case 111:
DrawShapedBox(
X, Y, Width, Height, Edge, // ______
ECS_Corner, // TopLeft // | \
ECS_Corner, // TopLeft // | \
ECS_BeveledCorner, // TopRight // | |
ECS_BeveledCorner, // BottomLeft // \______|
ECS_Corner // BottomRight //
);
break;
case 120:
DrawShapedBox(
X, Y, Width, Height, Edge, // |\____/|
@ -45,17 +45,17 @@ public final function DrawBox(float X, float Y, float Width, float Height, float
ECS_VerticalCorner // BottomRight // |/ \|
);
break;
case 121:
DrawShapedBox(
X, Y, Width, Height, Edge, // _______
ECS_HorisontalCorner, // TopLeft // \ /
ECS_HorisontalCorner, // TopRight // | |
ECS_HorisontalCorner, // BottomLeft // | |
ECS_HorisontalCorner // BottomRight // /_____\
ECS_HorisontalCorner // BottomRight // /_____\
);
break;
case 130:
DrawShapedBox(
X, Y, Width, Height, Edge, // ______
@ -65,17 +65,17 @@ public final function DrawBox(float X, float Y, float Width, float Height, float
ECS_BeveledCorner // BottomRight //
);
break;
case 131:
DrawShapedBox(
X, Y, Width, Height, Edge, // ______
ECS_Corner, // TopLeft // | \
ECS_Corner, // TopLeft // | \
ECS_BeveledCorner, // TopRight // | |
ECS_Corner, // BottomLeft // |______|
ECS_Corner // BottomRight //
);
break;
case 132:
DrawShapedBox(
X, Y, Width, Height, Edge, // ______
@ -85,7 +85,7 @@ public final function DrawBox(float X, float Y, float Width, float Height, float
ECS_Corner // BottomRight //
);
break;
case 133:
DrawShapedBox(
X, Y, Width, Height, Edge, // ______
@ -95,17 +95,17 @@ public final function DrawBox(float X, float Y, float Width, float Height, float
ECS_Corner // BottomRight //
);
break;
case 140:
DrawShapedBox(
X, Y, Width, Height, Edge, // ______
ECS_BeveledCorner, // TopLeft // / \
ECS_BeveledCorner, // TopLeft // / \
ECS_BeveledCorner, // TopRight // | |
ECS_BeveledCorner, // BottomLeft // \______|
ECS_Corner // BottomRight //
);
break;
case 141:
DrawShapedBox(
X, Y, Width, Height, Edge, // ______
@ -115,47 +115,47 @@ public final function DrawBox(float X, float Y, float Width, float Height, float
ECS_BeveledCorner // BottomRight //
);
break;
case 142:
case 142:
DrawShapedBox(
X, Y, Width, Height, Edge, // ______
ECS_Corner, // TopLeft // | \
ECS_Corner, // TopLeft // | \
ECS_BeveledCorner, // TopRight // | |
ECS_BeveledCorner, // BottomLeft // \______/
ECS_BeveledCorner // BottomRight //
);
break;
case 143:
DrawShapedBox(
X, Y, Width, Height, Edge, // ______
ECS_BeveledCorner, // TopLeft // / \
ECS_BeveledCorner, // TopLeft // / \
ECS_BeveledCorner, // TopRight // | |
ECS_Corner, // BottomLeft // |______/
ECS_BeveledCorner // BottomRight //
);
break;
case 150:
DrawShapedBox(
X, Y, Width, Height, Edge, // ______
ECS_BeveledCorner, // TopLeft // / \
ECS_BeveledCorner, // TopLeft // / \
ECS_BeveledCorner, // TopRight // | |
ECS_VerticalCorner, // BottomLeft // | ____ |
ECS_VerticalCorner // BottomRight // |/ \|
);
break;
case 151:
DrawShapedBox(
X, Y, Width, Height, Edge, // _______
ECS_BeveledCorner, // TopLeft // / /
ECS_HorisontalCorner, // TopRight // | |
ECS_BeveledCorner, // BottomLeft // \______\
ECS_BeveledCorner, // BottomLeft // \______\
ECS_HorisontalCorner // BottomRight //
);
break;
case 152:
DrawShapedBox(
X, Y, Width, Height, Edge, // |\____/|
@ -165,17 +165,17 @@ public final function DrawBox(float X, float Y, float Width, float Height, float
ECS_BeveledCorner // BottomRight //
);
break;
case 153:
DrawShapedBox(
X, Y, Width, Height, Edge, // _______
ECS_HorisontalCorner, // TopLeft // \ \
ECS_HorisontalCorner, // TopLeft // \ \
ECS_BeveledCorner, // TopRight // | |
ECS_HorisontalCorner, // BottomLeft // /______/
ECS_BeveledCorner // BottomRight //
);
break;
case 160:
DrawShapedBox(
X, Y, Width, Height, Edge, // ______
@ -185,47 +185,47 @@ public final function DrawBox(float X, float Y, float Width, float Height, float
ECS_BeveledCorner // BottomRight //
);
break;
case 161:
DrawShapedBox(
X, Y, Width, Height, Edge, // |\_____
ECS_VerticalCorner, // TopLeft // | \
ECS_VerticalCorner, // TopLeft // | \
ECS_BeveledCorner, // TopRight // | |
ECS_BeveledCorner, // BottomLeft // \______/
ECS_BeveledCorner // BottomRight //
);
break;
case 162:
DrawShapedBox(
X, Y, Width, Height, Edge, // ______
ECS_BeveledCorner, // TopLeft // / \
ECS_BeveledCorner, // TopLeft // / \
ECS_BeveledCorner, // TopRight // | |
ECS_HorisontalCorner, // BottomLeft // /______/
ECS_BeveledCorner // BottomRight //
);
break;
case 163:
DrawShapedBox(
X, Y, Width, Height, Edge, // ______
ECS_BeveledCorner, // TopLeft // / \
ECS_BeveledCorner, // TopLeft // / \
ECS_BeveledCorner, // TopRight // | |
ECS_BeveledCorner, // BottomLeft // \_____ |
ECS_VerticalCorner // BottomRight // \|
);
break;
case 170:
DrawShapedBox(
X, Y, Width, Height, Edge, // ______
ECS_BeveledCorner, // TopLeft // / \
ECS_BeveledCorner, // TopLeft // / \
ECS_BeveledCorner, // TopRight // | |
ECS_BeveledCorner, // BottomLeft // \______\
ECS_BeveledCorner, // BottomLeft // \______\
ECS_HorisontalCorner // BottomRight //
);
break;
case 171:
DrawShapedBox(
X, Y, Width, Height, Edge, // _____/|
@ -235,27 +235,27 @@ public final function DrawBox(float X, float Y, float Width, float Height, float
ECS_BeveledCorner // BottomRight //
);
break;
case 172:
DrawShapedBox(
X, Y, Width, Height, Edge, // _______
ECS_HorisontalCorner, // TopLeft // \ \
ECS_HorisontalCorner, // TopLeft // \ \
ECS_BeveledCorner, // TopRight // | |
ECS_BeveledCorner, // BottomLeft // \______/
ECS_BeveledCorner // BottomRight //
);
break;
case 173:
DrawShapedBox(
X, Y, Width, Height, Edge, // ______
ECS_BeveledCorner, // TopLeft // / \
ECS_BeveledCorner, // TopLeft // / \
ECS_BeveledCorner, // TopRight // | |
ECS_VerticalCorner, // BottomLeft // | _____/
ECS_BeveledCorner // BottomRight // |/
);
break;
case 180:
DrawShapedBox(
X, Y, Width, Height, Edge, // _______
@ -265,7 +265,7 @@ public final function DrawBox(float X, float Y, float Width, float Height, float
ECS_Corner // BottomRight //
);
break;
case 181:
DrawShapedBox(
X, Y, Width, Height, Edge, // |\_____
@ -275,7 +275,7 @@ public final function DrawBox(float X, float Y, float Width, float Height, float
ECS_Corner // BottomRight //
);
break;
case 182:
DrawShapedBox(
X, Y, Width, Height, Edge, // ______
@ -285,7 +285,7 @@ public final function DrawBox(float X, float Y, float Width, float Height, float
ECS_Corner // BottomRight //
);
break;
case 183:
DrawShapedBox(
X, Y, Width, Height, Edge, // ______
@ -295,17 +295,17 @@ public final function DrawBox(float X, float Y, float Width, float Height, float
ECS_VerticalCorner // BottomRight // \|
);
break;
case 190:
DrawShapedBox(
X, Y, Width, Height, Edge, // ______
ECS_Corner, // TopLeft // | |
ECS_Corner, // TopRight // | |
ECS_Corner, // BottomLeft // |______\
ECS_Corner, // BottomLeft // |______\
ECS_HorisontalCorner // BottomRight //
);
break;
case 191:
DrawShapedBox(
X, Y, Width, Height, Edge, // _____/|
@ -315,7 +315,7 @@ public final function DrawBox(float X, float Y, float Width, float Height, float
ECS_Corner // BottomRight //
);
break;
case 192:
DrawShapedBox(
X, Y, Width, Height, Edge, // _______
@ -325,7 +325,7 @@ public final function DrawBox(float X, float Y, float Width, float Height, float
ECS_Corner // BottomRight //
);
break;
case 193:
DrawShapedBox(
X, Y, Width, Height, Edge, // ______
@ -335,7 +335,7 @@ public final function DrawBox(float X, float Y, float Width, float Height, float
ECS_Corner // BottomRight // |/
);
break;
case 200:
DrawShapedBox(
X, Y, Width, Height, Edge, // ______
@ -345,17 +345,17 @@ public final function DrawBox(float X, float Y, float Width, float Height, float
ECS_VerticalCorner // BottomRight // |/ \|
);
break;
case 201:
DrawShapedBox(
X, Y, Width, Height, Edge, // _______
ECS_Corner, // TopLeft // | /
ECS_HorisontalCorner, // TopRight // | |
ECS_Corner, // BottomLeft // |______\
ECS_Corner, // BottomLeft // |______\
ECS_HorisontalCorner // BottomRight //
);
break;
case 202:
DrawShapedBox(
X, Y, Width, Height, Edge, // |\____/|
@ -365,7 +365,7 @@ public final function DrawBox(float X, float Y, float Width, float Height, float
ECS_Corner // BottomRight //
);
break;
case 203:
DrawShapedBox(
X, Y, Width, Height, Edge, // _______
@ -375,7 +375,7 @@ public final function DrawBox(float X, float Y, float Width, float Height, float
ECS_Corner // BottomRight //
);
break;
case 210:
DrawShapedBox(
X, Y, Width, Height, Edge, // ________
@ -385,27 +385,27 @@ public final function DrawBox(float X, float Y, float Width, float Height, float
ECS_BeveledCorner // BottomRight //
);
break;
case 211:
DrawShapedBox(
X, Y, Width, Height, Edge, // |\_____
ECS_VerticalCorner, // TopLeft // | \
ECS_VerticalCorner, // TopLeft // | \
ECS_BeveledCorner, // TopRight // | |
ECS_VerticalCorner, // BottomLeft // | _____/
ECS_BeveledCorner // BottomRight // |/
);
break;
case 212:
DrawShapedBox(
X, Y, Width, Height, Edge, // ______
ECS_BeveledCorner, // TopLeft // / \
ECS_BeveledCorner, // TopLeft // / \
ECS_BeveledCorner, // TopRight // | |
ECS_HorisontalCorner, // BottomLeft // /______\
ECS_HorisontalCorner, // BottomLeft // /______\
ECS_HorisontalCorner // BottomRight //
);
break;
case 213:
DrawShapedBox(
X, Y, Width, Height, Edge, // _____/|
@ -415,7 +415,7 @@ public final function DrawBox(float X, float Y, float Width, float Height, float
ECS_VerticalCorner // BottomRight // \|
);
break;
case 220:
DrawShapedBox(
X, Y, Width, Height, Edge, // ________
@ -425,7 +425,7 @@ public final function DrawBox(float X, float Y, float Width, float Height, float
ECS_Corner // BottomRight //
);
break;
case 221:
DrawShapedBox(
X, Y, Width, Height, Edge, // |\_____
@ -435,17 +435,17 @@ public final function DrawBox(float X, float Y, float Width, float Height, float
ECS_Corner // BottomRight // |/
);
break;
case 222:
DrawShapedBox(
X, Y, Width, Height, Edge, // ______
ECS_Corner, // TopLeft // | |
ECS_Corner, // TopRight // | |
ECS_HorisontalCorner, // BottomLeft // /______\
ECS_HorisontalCorner, // BottomLeft // /______\
ECS_HorisontalCorner // BottomRight //
);
break;
case 223:
DrawShapedBox(
X, Y, Width, Height, Edge, // _____/|
@ -455,37 +455,37 @@ public final function DrawBox(float X, float Y, float Width, float Height, float
ECS_VerticalCorner // BottomRight // \|
);
break;
case 230:
DrawShapedBox(
X, Y, Width, Height, Edge, // _______
ECS_BeveledCorner, // TopLeft // / /
ECS_BeveledCorner, // TopLeft // / /
ECS_HorisontalCorner, // TopRight // | |
ECS_HorisontalCorner, // BottomLeft // /______/
ECS_BeveledCorner // BottomRight //
);
break;
case 231:
DrawShapedBox(
X, Y, Width, Height, Edge, // |\_____
ECS_VerticalCorner, // TopLeft // | \
ECS_VerticalCorner, // TopLeft // | \
ECS_BeveledCorner, // TopRight // | |
ECS_BeveledCorner, // BottomLeft // \_____ |
ECS_VerticalCorner // BottomRight // \|
);
break;
case 232:
DrawShapedBox(
X, Y, Width, Height, Edge, // _______
ECS_HorisontalCorner, // TopLeft // \ \
ECS_HorisontalCorner, // TopLeft // \ \
ECS_BeveledCorner, // TopRight // | |
ECS_BeveledCorner, // BottomLeft // \______\
ECS_BeveledCorner, // BottomLeft // \______\
ECS_HorisontalCorner // BottomRight //
);
break;
case 233:
DrawShapedBox(
X, Y, Width, Height, Edge, // _____/|
@ -495,17 +495,17 @@ public final function DrawBox(float X, float Y, float Width, float Height, float
ECS_BeveledCorner // BottomRight // |/
);
break;
case 240:
DrawShapedBox(
X, Y, Width, Height, Edge, // _______
ECS_Corner, // TopLeft // | /
ECS_Corner, // TopLeft // | /
ECS_HorisontalCorner, // TopRight // | |
ECS_HorisontalCorner, // BottomLeft // /______|
ECS_Corner // BottomRight //
);
break;
case 241:
DrawShapedBox(
X, Y, Width, Height, Edge, // |\_____
@ -515,37 +515,37 @@ public final function DrawBox(float X, float Y, float Width, float Height, float
ECS_VerticalCorner // BottomRight // \|
);
break;
case 242:
DrawShapedBox(
X, Y, Width, Height, Edge, // _______
ECS_HorisontalCorner, // TopLeft // \ |
ECS_Corner, // TopRight // | |
ECS_Corner, // BottomLeft // |______\
ECS_Corner, // BottomLeft // |______\
ECS_HorisontalCorner // BottomRight //
);
break;
case 243:
DrawShapedBox(
X, Y, Width, Height, Edge, // _____/|
ECS_Corner, // TopLeft // | |
ECS_Corner, // TopLeft // | |
ECS_VerticalCorner, // TopRight // | |
ECS_VerticalCorner, // BottomLeft // | _____|
ECS_Corner // BottomRight // |/
);
break;
case 250:
DrawShapedBox(
X, Y, Width, Height, Edge, // ______
ECS_BeveledCorner, // TopLeft // / \
ECS_BeveledCorner, // TopLeft // / \
ECS_BeveledCorner, // TopRight // | |
ECS_Corner, // BottomLeft // |______|
ECS_Corner // BottomRight //
);
break;
case 251:
DrawShapedBox(
X, Y, Width, Height, Edge, // ______
@ -555,7 +555,7 @@ public final function DrawBox(float X, float Y, float Width, float Height, float
ECS_Corner // BottomRight //
);
break;
case 252:
DrawShapedBox(
X, Y, Width, Height, Edge, // ______
@ -565,23 +565,23 @@ public final function DrawBox(float X, float Y, float Width, float Height, float
ECS_BeveledCorner // BottomRight //
);
break;
case 253:
DrawShapedBox(
X, Y, Width, Height, Edge, // ______
ECS_Corner, // TopLeft // | \
ECS_Corner, // TopLeft // | \
ECS_BeveledCorner, // TopRight // | |
ECS_Corner, // BottomLeft // |______/
ECS_BeveledCorner // BottomRight //
);
break;
case 0:
default:
DrawShapedBox(
X, Y, Width, Height, Edge, //
ECS_BeveledCorner, // TopLeft // ______
ECS_BeveledCorner, // TopRight // / \
ECS_BeveledCorner, // TopRight // / \
ECS_BeveledCorner, // BottomLeft // | |
ECS_BeveledCorner // BottomRight // \______/
);

View File

@ -44,80 +44,80 @@ private final function DrawCorner(float X, float Y, float Edge, byte Position, b
{
case ECS_Corner:
return;
case ECS_BeveledCorner:
Canvas.SetPos(X, Y);
DrawCornerTexture(Edge, ECP_TopLeft);
return;
case ECS_VerticalCorner:
Canvas.SetPos(X, Y - Edge);
DrawCornerTexture(Edge, ECP_TopRight);
return;
case ECS_HorisontalCorner:
Canvas.SetPos(X - Edge, Y);
DrawCornerTexture(Edge, ECP_BottomLeft);
return;
}
case ECP_TopRight: switch (Shape)
{
case ECS_Corner:
return;
case ECS_BeveledCorner:
Canvas.SetPos(X - Edge, Y);
DrawCornerTexture(Edge, ECP_TopRight);
return;
case ECS_VerticalCorner:
Canvas.SetPos(X - Edge, Y - Edge);
DrawCornerTexture(Edge, ECP_TopLeft);
return;
case ECS_HorisontalCorner:
Canvas.SetPos(X, Y);
DrawCornerTexture(Edge, ECP_BottomRight);
return;
}
case ECP_BottomLeft: switch (Shape)
{
case ECS_Corner:
return;
case ECS_BeveledCorner:
Canvas.SetPos(X, Y - Edge);
DrawCornerTexture(Edge, ECP_BottomLeft);
return;
case ECS_VerticalCorner:
Canvas.SetPos(X, Y);
DrawCornerTexture(Edge, ECP_BottomRight);
return;
case ECS_HorisontalCorner:
Canvas.SetPos(X - Edge, Y - Edge);
DrawCornerTexture(Edge, ECP_TopLeft);
return;
}
case ECP_BottomRight: switch (Shape)
{
case ECS_Corner:
return;
case ECS_BeveledCorner:
Canvas.SetPos(X - Edge, Y - Edge);
DrawCornerTexture(Edge, ECP_BottomRight);
return;
case ECS_VerticalCorner:
Canvas.SetPos(X - Edge, Y);
DrawCornerTexture(Edge, ECP_BottomLeft);
return;
case ECS_HorisontalCorner:
Canvas.SetPos(X, Y - Edge);
DrawCornerTexture(Edge, ECP_TopRight);
@ -129,7 +129,7 @@ private final function DrawCorner(float X, float Y, float Edge, byte Position, b
public final function DrawShapedBox(float X, float Y, float W, float H, float Edge, byte TopLeftShape, byte TopRightShape, byte BottomLeftShape, byte BottomRightShape)
{
local float BoxX, BoxW;
Canvas.PreOptimizeDrawTiles((
3 // x3 DrawBoxTexture(...) + x1..x4 DrawCornerTexture(...)
+ (TopLeftShape == ECS_Corner ? 0 : 1)
@ -137,10 +137,10 @@ public final function DrawShapedBox(float X, float Y, float W, float H, float Ed
+ (BottomLeftShape == ECS_Corner ? 0 : 1)
+ (BottomRightShape == ECS_Corner ? 0 : 1)
), Texture);
// Top Line
DrawCorner(X, Y, Edge, ECP_TopLeft, TopLeftShape);
BoxX = X; BoxW = W;
if (TopLeftShape == ECS_BeveledCorner)
{
@ -153,16 +153,16 @@ public final function DrawShapedBox(float X, float Y, float W, float H, float Ed
}
Canvas.SetPos(BoxX, Y);
DrawBoxTexture(BoxW, Edge);
DrawCorner(X + W, Y, Edge, ECP_TopRight, TopRightShape);
// Mid Line
Canvas.SetPos(X, Y + Edge);
DrawBoxTexture(W, H - Edge * 2);
// Bottom Line
DrawCorner(X, Y + H, Edge, ECP_BottomLeft, BottomLeftShape);
BoxX = X; BoxW = W;
if (BottomLeftShape == ECS_BeveledCorner)
{
@ -175,7 +175,7 @@ public final function DrawShapedBox(float X, float Y, float W, float H, float Ed
}
Canvas.SetPos(BoxX, Y + H - Edge);
DrawBoxTexture(BoxW, Edge);
DrawCorner(X + W, Y + H, Edge, ECP_BottomRight, BottomRightShape);
}

View File

@ -1,13 +1,17 @@
# KF2-BoxPainterLib
[![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/GenZmeY/KF2-BoxPainterLib)](https://github.com/GenZmeY/KF2-BoxPainterLib/tags)
[![MegaLinter](https://github.com/GenZmeY/KF2-BoxPainterLib/actions/workflows/mega-linter.yml/badge.svg?branch=master)](https://github.com/GenZmeY/KF2-BoxPainterLib/actions/workflows/mega-linter.yml)
[![GitHub top language](https://img.shields.io/github/languages/top/GenZmeY/KF2-BoxPainterLib)](https://docs.unrealengine.com/udk/Three/WebHome.html)
[![GitHub](https://img.shields.io/github/license/GenZmeY/KF2-BoxPainterLib)](LICENSE)
**2D box drawing library**
**2D box drawing library.
Ported from [YetAnotherScoreboard](https://github.com/GenZmeY/KF2-YetAnotherScoreboard) and published under LGPLv3 due to licensing issues with some closed source mods.**
## Add to your project
⚠️ If your code uses the GPL or LGPL you can choose any of the methods below. But if you're using a different license and don't want to change it to the (L)GPL, then you should use methods 1 or 2, and don't make changes to the BoxPainterLib code.
**Here are the ways:**
# Add to your project
There are two ways to add BoxPainterLib to your project:
### 1. As [git submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules)
Open git-bash and go to your project: `cd <your_project_path>`
Add submodule: `git submodule add https://github.com/GenZmeY/KF2-BoxPainterLib BoxPainterLib`
@ -19,29 +23,34 @@ Commit the changes: `git add BoxPainterLib && git commit -m 'update box painter
### 2. As standalone sources
Create a `BoxPainterLib` folder and put [this repo](https://github.com/GenZmeY/KF2-BoxPainterLib) there.
# Using
### 3. As part of your sources (only for GPL and LGPL projects)
Include the BoxPainterLib code in your project wherever you want and however you like, make (or not) any changes
## Using
1. Create `BoxPainter` object: `BoxPainter = new class'BoxPainterLib.BoxPainter';`
2. Initialize the canvas: `BoxPainter.Canvas = <REPLACE_THIS_WITH_YOUR_CANVAS_OBJECT>;`
3. `BoxPainter` is ready! Use functions [DrawBox(...)](https://github.com/GenZmeY/KF2-BoxPainterLib/blob/master/Classes/BoxPainter.uc#L3) and [DrawShapedBox(...)](https://github.com/GenZmeY/KF2-BoxPainterLib/blob/master/Classes/BoxPainterBase.uc#L129) to draw cool interface boxes.
# Available Functions
#### DrawShapedBox(float X, float Y, float W, float H, float Edge, byte TopLeftShape, byte TopRightShape, byte BottomLeftShape, byte BottomRightShape)
## Available Functions
**DrawShapedBox(float X, float Y, float W, float H, float Edge, byte TopLeftShape, byte TopRightShape, byte BottomLeftShape, byte BottomRightShape)**
Draws a box using the [shape code](https://github.com/GenZmeY/KF2-BoxPainterLib/blob/master/Classes/BoxPainterBase.uc#L13) for each corner:
- ECS_Corner
- ECS_BeveledCorner
- ECS_VerticalCorner
- ECS_HorisontalCorner
#### DrawBox(float X, float Y, float Width, float Height, float Edge, optional byte Shape = 0)
**DrawBox(float X, float Y, float Width, float Height, float Edge, optional byte Shape = 0)**
Draws a box using the shape code:
![](rect_shapes.png)
![codes_table](rect_shapes.png)
# Build
## Build
If you are using [KF2-BuildTools](https://github.com/GenZmeY/KF2-BuildTools) open `builder.cfg` and add `BoxPainterLib` **first** in `PackageBuildOrder` and `PackageUpload` parameters
If you are building manually add line `ModPackages=BoxPainterLib` to your `KFEditor.ini` before all other `ModPackages`
Now build the mod. `BoxPainterLib.u` library will be next to your `*.u` files
# License
[GNU LGPLv3](LICENSE)
## Examples
[KF2-YetAnotherScoreboard (master branch)](https://github.com/GenZmeY/KF2-YetAnotherScoreboard/tree/master) - BoxPainterLib is part of sources
[KF2-YetAnotherScoreboard (BoxPainterLib branch)](https://github.com/GenZmeY/KF2-YetAnotherScoreboard/tree/BoxPainterLib) - BoxPainterLib is git submodule
## License
[![license](https://www.gnu.org/graphics/lgplv3-with-text-154x68.png)](LICENSE)