Are you practicing a new language? Do you have an real world examples of what you want? Do you know any programs that do what you're asking?
Printable View
Are you practicing a new language? Do you have an real world examples of what you want? Do you know any programs that do what you're asking?
Depends on if you want it to be portable or not because it's dependent on the operating system.
For windows the conio library will do. With it you will be able to enter and change text at specific positions. If you want it to be portable, use PDCurses instead.
For the timer part of your code you can simulate a sleep function with the help of the time standard library:
Code:void sleep(unsigned int msec) {
clock_t stop_ = msec + clock();
while ( stop_ > clock() ) ; // don't forget the semi-colon
}
ok im gonna try to find the nes game this is in
ill edit when i do but yull need the jnes emu to view it
heh heh sorry i head the description of what i wanted a little bit wrong sorry..
the game is final fantasy2
Where? When you're choosing a name, or you mean the way they display the scrolling text in game?Quote:
Originally Posted by lilhawk2892
I think he means the latter. Fortunately there is a simple way.
Click: https://cboard.cprogramming.com/showthread.php?t=78570
yes ..no sortof
well its not exactly what i wanted but i suppose its good enouph :(
but download final fantasy 2 the first thing you see should be what i want
Well what else did you want it to do?
If you want the top line to disappear, then there is no standard way to do that. You can easily do it with curses or conio.h or window.h, though.
> but download final fantasy 2 the first thing you see should be what i want
- My fellow compatriots are not going to download something so that you can get what you want.
- If you cannot explain coherently what you want to do then it is not worth doing.
- Final Fantasy took a while to develop and is a big [illegal] undertaking to reproduce all by yourself, etc.
you wont download ff2? its a great game well aside from that i think i can figure out what i want now
Not in this lifetime! I like my computer free of viruses and other nasty things you can get from downloading stuff like that.Quote:
Originally Posted by lilhawk2892
How about this?
Code:#include <iostream>
#include <string>
#include <windows.h>
using namespace std;
const int screen_size = 20;
void clrscr(void);
void gotoxy(int x, int y);
int main()
{
HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);
WORD wOldColorAttr;
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(h, &csbi);
wOldColorAttr = csbi.wAttributes;
SetConsoleTextAttribute(h, FOREGROUND_RED | FOREGROUND_INTENSITY);
string display("FINAL FANTASY 2");
clrscr();
int x = 1;
for (string::size_type i=0; i<display.length(); i++)
{
char ch = ' ';
for (;;)
{
for (int y=0; y<screen_size; y++)
{
gotoxy(x, y);
cout << ch << flush;
}
Sleep(50);
if (ch == display[i])
break;
ch++;
}
Sleep(200);
x += 2;
}
cin.get();
SetConsoleTextAttribute(h, wOldColorAttr);
return 0;
}
void clrscr(void)
{
COORD coordScreen = { 0, 0 };
DWORD cCharsWritten;
CONSOLE_SCREEN_BUFFER_INFO csbi;
DWORD dwConSize;
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
GetConsoleScreenBufferInfo(hConsole, &csbi);
dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
FillConsoleOutputCharacter(hConsole, TEXT(' '),
dwConSize, coordScreen, &cCharsWritten);
GetConsoleScreenBufferInfo(hConsole, &csbi);
FillConsoleOutputAttribute(hConsole, csbi.wAttributes,
dwConSize, coordScreen, &cCharsWritten);
SetConsoleCursorPosition(hConsole, coordScreen);
}
void gotoxy(int x, int y)
{
COORD coord;
coord.X = x;
coord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}
!!!! yes it is yes it is yes it is well thank you so much just wow thank you you rock thank you thank you
but wheres the code segment that controls how many letters there are
nvm found it just thank you so much
>but wheres the code segment that controls how many letters there are
If you make the banner to be displayed a string, there's a length() member function you can use to control your for-loop. So it would be:
Since in this case I called the banner striing "display", it's this loop:Code:for (string::size_type i=0; i<name_of_string.length(); i++)
I guess I could have called it title or banner. Those might be better names.Code:for (string::size_type i=0; i<display.length(); i++)