JN> write a C++ function that will display a screen of a
JN> certain ascii character, however when running the program
JN> it appears very slow :( hJN> is the code ...
JN> void screen(int fc, int bc, char sym) {
JN> textcolor(fc); textbackground(bc);
JN> int i = 0;
JN> int j = 0;
JN> for (i= 1; i <= 25; i++) {
JN> for (j = 1; j <= 80; j++) {
JN> cprintf("%c", sym);
JN> }
JN> }
JN> }
JN> // I call the function like this .... screen(15, 1, '*');
JN> // takes a while for the screen to come up...just
JN> wondering if there is a better way to do this...any help
JN> would be much appreciated...thanx!!!!
Quite simply, yes. :)
It's hardly a C++ concept, however.
#include
#include
void screen(int fc, int bc, char sym)
{
char text[81];
int line;
_wscroll = 0; // turn scrolling off
gotoxy(1, 1);
textattr((bc << 4) + fc);
memset(text, sym, 80);
text[80] = '\0';
for(line = 0; line < 24; line++)
cprintf("%s\n\r", text);
cprintf("%s", text);
gotoxy(1, 1);
_wscroll = 1; // turn scrolling on
}
> ] Their only crime was being delicious........................
---
---------------
* Origin: *YOPS ]I[* 3.1 GIG * RA/FD/FE RADist * Milwaukee, WI (1:154/750)
|