-
Movement in c++ dos
Can i make characters move on a dos screen without:
Code:
include <iostream>
using namespace std;
int main()
{
cout << "*************************\n";
cout << "* T *\n";
cout << "* *\n";
cout << "*************************\n";
system("CLS");
cout << "*************************\n";
cout << "* *\n";
cout << "* T *\n";
cout << "*************************\n";
}
-
Look up SetConsoleCursorPosition(), that should do what you need.
-
I use conio.h (mostly because my Windows and DOS compilers both have it) and therefore use: gotoxy(x, y);
Code:
void drawchar(x, y, icon)
{
gotoxy(x, y);
putch(icon);
}
My compiler also has color support in conio.h, but I know VC++ doesn't (I've already tried).
-
You shoot look at Dos Programming
:cool:
-
It's Win32 Console not DOS,
Blizzarddog plz tell us what compiler youre using
-
answer
i have instalt a compiler but it doesn't workso i cot e other one but it's not working because it's c++ but it doeen't do it good
compiler 1 : microsoft visual studio 6.0
compiler 2 : dev-ccp
-
Dev C++ with Gnu.
What do i need to include for gotoxy(x, y)?
-
hmm, conio isnt a standard ansi C function so it doesnt have to be there, but gotoxy is usually in conio. ALthough Ive noticed dev c++ is missing a few of those dos-like functions.
why not try something like this:
Code:
unsigned char far *VidPtr=0xB8000000;
int PutChar(int x, int y, unsigned char c)
{
*VidPtr[y*80+x]=c;
return 0;
}
you can avoid having to deal with the blinking cursor, although I donno if this will work as a windows console program.
-
well if youa are using gotoxy you can do this..
Every time you put a char on screen.. store x and y in a variable.. when displaying again clear the previous place..
Or even sometin like this will work...
Code:
# include <iostream.h>
# include <conio.h>
int main()
{
clrscr();
for(int i=0;i<20;i++)
{
gotoxy(i,10);
cout<<"t";
delay(100);
gotoxy(i,10);
cout<<" ";
}
retirn 0;
}