本帖最后由 cmd1152 于 2021-8-23 19:19 编辑
- @echo off
- title 画画
- color 0f
- set $=%path%
- for /f "delims== eol=$" %%a in ('set ') do (set "%%a=")
- set path=%$%
- setlocal enabledelayedexpansion
- set "$=□▁▂▃▄▅▆▇▏▎▍▌▋▊▉█■★☆▲△▼▽●○◆◇∶∵∴∷※←↑→↓↖↗↘↙┃━┏┓┗┛┣┫┳┻╋×√§◎¤()《》<>①②③④⑤⑥⑦⑧⑨⑩∞∝∽≌∈∩∪∧∨⊙⊕⌒⊿∥⊥∠∫‰%〒℉℃°±╔╦╗╠╬╣╚╩╝═║▓卍卐〓囧の♀♂*‖,。?!:;、·…~&@#︵︶︷︸︹︺︿﹀︽︾﹁﹂﹃﹄︻︼/|\︴_﹏﹍﹎ ̄﹋﹉﹊ˋˇ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
- for /l %%a in (0,1,1024) do (set C=!$:~%%a,1!
- if "!C!" neq "" (set $%%a=!C!&set #Z=%%a))
- set/a #x=32,#y=32
- call :Clear
- call :ReAlloc %#x% %#y%
-
- :Loop 绘图
- setlocal
- for /l %%a in (1,1,%#y%) do (set "li%%a=┃"
- for /l %%b in (1,1,%#x%) do (for /f %%c in ("!.%%b.%%a!") do (set li%%a=!li%%a!!$%%c!)))
- cls
- echo;┏%$w%┓
- for /l %%a in (1,1,%#y%) do (echo;!li%%a!┃)
- echo;┗%$w%┛
- echo;保存 读取 清除 调整
- echo;%$%
- endlocal
-
- ::检测鼠标
- title 画笔!$%.s%!
- cmos 0 -1 1
- set /a P=%errorlevel%
- set /a X=%P:~0,-3%
- set /a Y=%P%-1000*%X%-1
- set /a nX=(X-1)/2
- if defined .%nX%.%Y% (set/a .%nX%.%Y%=%.s%)
- if !Y! gtr %#y% (
- set/a Y-=2
- if !Y!==%#y% (
- set/a sx=nx/2
- if !sx!==0 (call :Save)
- if !sx!==2 (call :Read)
- if !sx!==4 (call :Clear)
- if !sx!==6 (call :Adjust)
- ) else (
- set/a "n=(Y-#Y-1)*wx/2+nx"
- if defined $!n! (set/a .s=n)
- )
- )
- goto :Loop
-
- :ReAlloc [x] [y] 重新分配
- set/a #x=%1,#y=%2
- for /l %%x in (1,1,%1) do (for /l %%y in (1,1,%2) do (if not defined .%%x.%%y (set/a .%%x.%%y=0)))
- set "$w="
- for /l %%a in (1,1,%#x%) do (set $w=!$w!━)
- set/a wx=#x*2+16,wy=#y+#z/#x+6
- mode con cols=%wx% lines=%wy%
- goto :eof
-
- :Save 保存
- cls&echo;保存到 *.batht2
- set /p bcwjm=文件名(不要后续名):^>
- (for /f "delims=" %%z in ('set #^&set .') do (echo;%%z))>%bcwjm%.batht2
- goto :eof
-
- :Read 读取
- cls&echo;读取 *.batht2
- set /p dqwjm=文件名(不要后续名):^>
- if exist %dqwjm%.batht2 (
- FOR /F "delims=" %%z in (%dqwjm%.batht2) do (set %%z)
- for /l %%x in (1,1,%#x%) do (for /l %%y in (1,1,%#y%) do (if not defined .%%x.%%y (set/a .%%x.%%y=0))))
- call :ReAlloc %#x% %#y%
- goto :eof
-
- :Clear 清空
- for /f "delims==" %%z in ('set .') do (set "%%z=")
- for /l %%a in (1,1,%#x%) do (for /l %%b in (1,1,%#y%) do (set .%%a.%%b=0))
- set .s=0
- goto :eof
-
- :Adjust 调整窗口大小
- cls&echo;调整窗口大小
- set /p ckdx=请输入新的窗口大小(格式[x,y],如[32,32]。):
- for /f "delims=, tokens=1-3*" %%x in ("%ckdx%") do (if "%%y" neq "" (if "%%z"=="" (set/a #x=%%x,#y=%%y)))
- if %#x% lss 8 (set/a #x=8)
- if %#y% lss 8 (set/a #y=8)
- call :ReAlloc %#x% %#y%
- goto :eof
复制代码
|