
I have to say that on my pretty swift box there is no difference with CursorPos or not. No flicker either way.
Moderator: DosItHelp
dbenham wrote:I've posted version 3.7 to the top of the thread.
The only change is to reduce the screen flicker when playing without CursorPos.exe by building the entire screen as a single variable with line feeds before using CLS and ECHOing the screen content. This was in response to einstein1969's post: Anti-Flicker in dos batch
Dave Benham
Code: Select all
set screen=%\n%
Code: Select all
set screen=ÿ!LF!%\n%
einstein1969 wrote:I have probed the 3.7 version and is very beautyful!
If you use timer coalesce this is not necessary.
foxidrive wrote:I hope you don't take offense at this but I wanted to make a comment on a couple of your English terms.einstein1969 wrote:I have probed the 3.7 version and is very beautyful!
instead of probed an English speaker may say I have examined or I have testedIf you use timer coalesce this is not necessary.
The term timer coalesce is not an English expression that is in common use and I don't know what you mean by it.
This isn't meant to point out flaws, but just to say that some terms which you use fairly frequently have little meaning in English.
Your English is far far better than my Italian, or Spanish, or German, so I hope you take this constructively.
einstein1969 wrote:The "timer coalescing" is a concept.
From now on, I'll put it in quotation marks.
what is your mother tongue?
foxidrive wrote:Can you describe how batch code can enter and exit idle states, and which affects screen flicker?
Has this been discussed here before? I may have missed it.
einstein1969 wrote:But there is a problem... On my pc windows 7 the FIRST LINE flicker/blink. I have not probed on xp.
C:\dev>echo foo>new.txt
C:\dev>attrib +r new.txt
C:\dev>copy /Z c:\dev\new.txt nul
100% copied 1 file(s) copied.
C:\dev>cmd /c copy /Z c:\dev\new.txt nul
The parameter is incorrect.
0 file(s) copied.
C:\dev>
Code: Select all
@echo off
for /f %%A in ('copy /Z "%~dpf0" nul') do set "CR=%%A"
set CR
pause
Code: Select all
CR=
Press any key to continue . . .
Code: Select all
The parameter is incorrect.
CR=0
Press any key to continue . . .
Code: Select all
for /f %%a in ('copy /Z "%~dpf0" nul') do set "CR=%%a"
Code: Select all
set "CR=" &For /F "skip=1" %%a in (
'"echo(|replace.exe ? . /u /w"'
) do if not defined CR set "CR=%%a"
Code: Select all
for /f "delims=" %%A in ('xcopy /w "%~f0" "%~f0" 2^>nul') do (
Code: Select all
for /f "delims=" %%A in ('xcopy /d /w ? ? 2^>nul') do (
Code: Select all
Tiny 15 x 10
Small 30 x 20
Medium 40 x 25
Large 47 x 32
Wide 82 x 19
Narrow 15 x 40
Code: Select all
:: delay#
::: Gives the movement on the Y axis 25 percent more delay time
::: because the default resolution of the command line is
::: 8 pixels x 12 pixels. Thus reducing the too fast movement
::: on the Y-axis to keep the axes moving synchronously.
set delay#=(%\n%
set /a "xDelay=delay"%\n%
set /a "yDelay=delay*45/30"%\n%
if !delay! gtr 10 set /a "yDelay=delay*4/3"%\n%
)
Code: Select all
if !axis! == X (set /a "delay=xDelay") else set /a delay=yDelay
Code: Select all
set "delay=!delay%key%!"
%delay#%
pieh-ejdsch wrote:Is there a possibility to read the fonts resolution of the command line?
Code: Select all
@echo off &setlocal
reg query HKCU\Console\%%SystemRoot%%_system32_cmd.exe /v FaceName >nul 2>&1 && set "key1=HKCU\Console\^^%%SystemRoot^^%%_system32_cmd.exe" || set "key1=HKCU\Console"
reg query HKCU\Console\%%SystemRoot%%_system32_cmd.exe /v FontSize >nul 2>&1 && set "key2=HKCU\Console\^^%%SystemRoot^^%%_system32_cmd.exe" || set "key2=HKCU\Console"
for /f "tokens=2*" %%i in ('reg query %key1% /v FaceName') do set "facename=%%j"
for /f "tokens=3" %%i in ('reg query %key2% /v FontSize') do set /a "height=%%i>>16, width=%%i&0xFFFF"
if "%facename%"=="Terminal" (echo Raster Font %width%x%height%) else echo %facename% %height%
pause
It looks like you are trying to define a macro, but there is no need - the two values are constant throughout one entire game play. So I would simply define the two values as part of game initialization.pieh-ejdsch wrote:I do not like this calculation especially, since this does not round properly. But in the fastest speed it must be increased by one hundredths.Code: Select all
:: delay#
::: Gives the movement on the Y axis 25 percent more delay time
::: because the default resolution of the command line is
::: 8 pixels x 12 pixels. Thus reducing the too fast movement
::: on the Y-axis to keep the axes moving synchronously.
set delay#=(%\n%
set /a "xDelay=delay"%\n%
set /a "yDelay=delay*45/30"%\n%
if !delay! gtr 10 set /a "yDelay=delay*4/3"%\n%
)
The axis changes every time a turn key is pressed in 2 key mode.pieh-ejdsch wrote:I have only found the possibility within this part %=== establish direction ===%
In the 4-key mode.Code: Select all
if !axis! == X (set /a "delay=xDelay") else set /a delay=yDelay
Code: Select all
set /a "delay.!left!=delay.!right!=delay, delay.!up!=delay.!down!=delay*5/4, delayDiff=delay.!up!-delay"
Code: Select all
%=== establish direction ===%
if not defined replay (echo(!key!.) >>"!gameLog!"
for %%K in (!key!) do if !moveKeys! equ 2 (
set /a "xDiff=xTurn%%K*!yDiff!, yDiff=yTurn%%K*!xDiff!, delay-=(delayDiff*=-1)"
) else if "!%%KAxis!" neq "!axis!" (
set /a "xDiff=xDiff%%K, yDiff=yDiff%%K, delay=delay.%%K"
set "axis=!%%KAxis!"
)