Konsolenanwendung: Loader erstellen
-
Hi,
Erstmal finde ich euer Forum super, alle Probleme die ich hatte wurden auf dem Board genau beschrieben und korrigiert
Nun zu meinem Problem, da ich neu in C++ bin, habe ich mich mal rangemacht eine art Loader zu erstellen in Visual Studio 2008. Nun alles schön und gut jedoch nun zu meinem Problem:
Ich habe zB. nen Header
cout << setcolour(GREEN, chandle) << "\t\t\t ##########################" << endl; cout << setcolour(TEAL, chandle) << "\t\t\t # #" << endl; cout << setcolour(TEAL, chandle) << "\t\t\t # Codename: MELIKE #" << endl; cout << setcolour(TEAL, chandle) << "\t\t\t # Version 0.1 #" << endl; cout << setcolour(TEAL, chandle) << "\t\t\t # #" << endl; cout << setcolour(GREEN, chandle) << "\t\t\t ##########################" << endl << endl;
setcolour ist für die Text Colorierung.. :). nun was ich nun machen möchte:
Ich möchte das alles was nach dem Header kommt zB. alles von Links nach rechts "geschrieben" wird. Damit meine ich zB. (*L o a d i n g... |/-\|/-\/ ). Er soll Zeichen für Zeichen nacheinander ausgeben. Die Striche am schluss sollen ne art Animation darstellen.
Ich habe es momentant in billiger Form geschrieben, damit meine ich immer mit system("cls") und alles neu ....haha
Vielen Dank für eure Hilfe im Voraus..
gruss Manuelle
-
Hi,
vielleicht kannst du dir hiervon etwas verwenden:#define ANIM_SLEEPTIME 10 #define LETTER_SLEEPTIME 200 #define TEXT_LOADTIME 2000 void anim_thread ( void* pv ) { char* r = "|/-\\|/-\\/", *p = r; while (*r) { printf(" %c\b\b", *r), Sleep(ANIM_SLEEPTIME), r++; if(!*r) r = p; } } int main() { char* text = "Please wait a moment, while text is being loaded ... ", *s = text; char* r = "|/-\\|/-\\/", *p = r; int n; if ( -1 == _beginthread ( anim_thread, 0, NULL )) // #include <process.h> puts("beginthread failed."); while(*s) { Sleep(LETTER_SLEEPTIME); // #include <windows.h> putchar(*s++); } Sleep ( TEXT_LOADTIME ); puts ("done."); return 0; }
Gruß,
B.B.