AYUDA! CON GRAFICOS DE CONSOLA | HELP WITH CONSOLE GRAPHICS

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
DQ2000
Posts: 38
Joined: 07 Aug 2019 17:26

AYUDA! CON GRAFICOS DE CONSOLA | HELP WITH CONSOLE GRAPHICS

#1 Post by DQ2000 » 21 Oct 2019 14:54

Hola Me llamo DQ2000. soy nuevo en esto y queria que me ayuden con mi script para los apacionados al 'batch grafico'
Hello My name is DQ2000. I am new to this and I wanted you to help me with my script for those appearing in the 'graphic batch'


tengo un bufer de consola, y implemente el algoritmo de doble buffer. cuando se grafica un solo sprite no pardea sale bien,
DQ1.png
DQ1.png (11.79 KiB) Viewed 9169 times
. pero ala hora de aser algoritmo para que tome una cadena de sprites este parpadea toda la pantalla,
DQ2.png
DQ2.png (13.34 KiB) Viewed 9169 times
....


I have a console buffer, and it implements the double buffer algorithm. when a single sprite is plotted, it does not flash out well,
DQ1.png
DQ1.png (11.79 KiB) Viewed 9169 times
. but at the time of making algorithm so that it takes a string of sprites this flashes the whole screen,
DQ2.png
DQ2.png (13.34 KiB) Viewed 9169 times
....
######################################################################################################################
CODE
######################################################################################################################
while(A<argc){


X=atof(argv[A+1]);
Y=atof(argv[A+2]);


FILE *archivo = fopen(argv[A], "r");
char c[A];

while ((c[A] = fgetc(archivo))!= EOF)
{
// Primeros colores.
if (c[A]==48){colores=0;}
if (c[A]==49){colores=1;}
if (c[A]==50){colores=2;}
if (c[A]==51){colores=3;}
if (c[A]==52){colores=4;}
if (c[A]==53){colores=5;}
if (c[A]==54){colores=6;}
if (c[A]==55){colores=7;}
if (c[A]==56){colores=8;}
if (c[A]==57){colores=9;}
// Segundos colores.
if (c[A]==97){colores=10;}
if (c[A]==98){colores=11;}
if (c[A]==99){colores=12;}
if (c[A]==100){colores=13;}
if (c[A]==101){colores=14;}
if (c[A]==102){colores=15;}

if (c[A]==10){o++;i=-1;} else {
if (c[A]==32||c[A]==46){i=i;} else {
x=i+X,y=o+Y;
consoleBuffer[x + WIDTH * y].Char.AsciiChar = (unsigned char)219;
consoleBuffer[x + HEIGHT * y].Attributes = colores;
}
}
i++;
}
i=0, o=0;


fclose(archivo);
WriteConsoleOutputA(wHnd,consoleBuffer,characterBufferSize,characterPosition,&consoleWriteArea);
A+=3;
}

penpen
Expert
Posts: 1991
Joined: 23 Jun 2013 06:15
Location: Germany

Re: AYUDA! CON GRAFICOS DE CONSOLA | HELP WITH CONSOLE GRAPHICS

#2 Post by penpen » 24 Oct 2019 14:49

I'm not sure how that is connected to any batch, you could use code tags ([code][/code]),
also you should provide enough code for a standalone working sample that produces the issue you want to solve.
What exactly do you mean by "flashes the (...) screen" ? (Do you mean that the background turns black?)

However it is unusual to change the color and attributes of different cells ("x + WIDTH * y" versus "x + HEIGHT * y"), which might cause errors:

Code: Select all

consoleBuffer[x + WIDTH * y].Char.AsciiChar = (unsigned char)219;
consoleBuffer[x + HEIGHT * y].Attributes = colores;
Also you should check if your indices are within the "consoleBuffer" array, else (potentially) you are overwriting other meaningfull data.


penpen

DQ2000
Posts: 38
Joined: 07 Aug 2019 17:26

Re: AYUDA! CON GRAFICOS DE CONSOLA | HELP WITH CONSOLE GRAPHICS

#3 Post by DQ2000 » 25 Oct 2019 11:38

Hello!.
Sorry, fix the error. the error was that it sent to show the images on screen in each character then it was blinking

Post Reply