-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDemo_Batbox.bat
More file actions
92 lines (74 loc) · 1.98 KB
/
Demo_Batbox.bat
File metadata and controls
92 lines (74 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
@echo off
cls
Title Batbox Demo - www.Batch-man.com
Set "Path=%Path%;%~dp0;%~dp0bin;"
setlocal enabledelayedexpansion
set x_1=0
set y_1=0
set x_2=30
set y_2=24
set old_x_1=%x_1%
set old_y_1=%y_1%
set old_x_2=%x_2%
set old_y_2=%y_2%
rem delay is in mili scnd
set delay=0
set sign_x_1=+
set sign_y_1=+
set sign_x_2=-
set sign_y_2=+
set total_items=2
set item_1=namish
set item_1_len=6
set item_2=Karan
set item_2_len=5
set Columns=80
set lines=25
mode %columns%,%lines%
::call :get_size Lines Columns
set /a upper_x=%columns%-%item_1_len%
set /a upper_y=%lines%-3
set lowr_x=1
set lowr_y=1
::fn.dll cursor 0
:loop
::cls
for /l %%a in (1,1,!total_items!) do (
for %%A in (x y) do (
if !%%A_%%a! gtr !upper_%%A! (set sign_%%A_%%a=-)
if !%%A_%%a! lss !lowr_%%A! (set sign_%%A_%%a=+)
)
)
set item_1_limit_1=%x_1%
set /a item_1_limit_2=%x_1%+%item_1_len%
set item_2_limit_1=%x_2%
set /a item_2_limit_2=%x_2%+%item_2_len%
for /l %%x in (%item_1_limit_1%,1,%item_1_limit_2%) do for /l %%y in (!item_2_limit_1!,1,!item_2_limit_2!) do (if /i "%%x" == "%%y" (if /i "!y_1!" == "!y_2!" (set collision=true)))
if /i "!collision!" == "true" (
for /l %%a in (1,1,%total_items%) do (
for %%A in (x) do (
if /i "!sign_%%A_%%a!" == "-" (set sign_%%A_%%a=+) else (set sign_%%A_%%a=-)
)
)
)
batbox /g !x_1! !y_1! /c 0x0a /d "!item_1!" /g !x_2! !y_2! /c 0x0c /d "!item_2!" /w !delay! /g !old_x_1! !old_y_1! /c 0x00 /d "!item_1!" /g !old_x_2! !old_y_2! /c 0x00 /d "!item_2!" /g 0 0
title [Item : !item_1!, Pos: x=!x_1!,y=!y_1!] [Item : !item_2!, Pos: x=!x_2!,y=!y_2!]
set old_x_1=%x_1%
set old_y_1=%y_1%
set old_x_2=%x_2%
set old_y_2=%y_2%
set /a x_1%sign_x_1%=1
set /a y_1%sign_y_1%=1
set /a x_2%sign_x_2%=1
set /a y_2%sign_y_2%=1
set collision=false
goto loop
:get_size
mode | find "Columns">"%tmp%\c.tmp"
mode | find "Lines">"%tmp%\l.tmp"
set now=%cd%
cd /d "%tmp%" >nul
for /f "tokens=2 delims=:" %%a in (l.tmp) do (set /a %~1=%%a)
for /f "tokens=2 delims=:" %%a in (c.tmp) do (set /a %~2=%%a)
cd /d "%now%"
goto :eof