Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
void Videosystem::read_picture(const std::string& filename, std::size_t block, std::vector<std::string>& data) { std::ifstream file(filename.c_str()); if (!file) cout << "could not open file"; data.clear(); std::ostringstream ss; ss << "// Task_Beginn " << std::setw(2) << std::setfill('0') << block; std::string start(ss.str()); ss.str(""); ss.clear(); ss << "// Task_End " << std::setw(2) << std::setfill('0') << block; std::string line; bool in_data = false; while (std::getline(file, line)) { if (in_data == false && line.find(start) != std::string::npos) in_data = true; else if (in_data == true) { if (line.find(ss.str()) != std::string::npos) in_data = false; else data.push_back(line); } } } |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
int Videosystem::Hafen_Video() { std::vector< std::vector<std::string> > data; for (std::size_t i = 0; i < 40; ++i) { std::vector<std::string> tmp_obj; data.push_back(tmp_obj); read_picture("ASCII/boot.txt", i + 1, data.at(data.size() - 1)); } while (true) { for (std::size_t i = 0; i < 40; ++i) { std::system("cls"); std::copy(data.at(i).begin(), data.at(i).end(), std::ostream_iterator<std::string>(std::cout, "\n")); Sleep(8); } } std::cin.get(); } |
Zitat von »"Toa"«
Deviloper konnte mir auch nicht mehr weiter helfen ....
Zitat von »"David_pb"«
Zitat von »"Toa"«
Deviloper konnte mir auch nicht mehr weiter helfen ....
Dann ist es hoffnungslos!!
Versuchs mal mit nem Puffer und WriteConsoleOutput.
Zitat von »"Toa"«
Wow du sprichst mir aber sehr viel Mut zu xD
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
HANDLE screen = CreateConsoleScreenBuffer(GENERIC_READ|GENERIC_WRITE, 0, 0, CONSOLE_TEXTMODE_BUFFER, 0); HANDLE buffer = CreateConsoleScreenBuffer(GENERIC_READ|GENERIC_WRITE, 0, 0, CONSOLE_TEXTMODE_BUFFER, 0); SetConsoleActiveScreenBuffer(screen); // mit allen möglichen / nötigen Funktionen buffer befüllen, verändern etc //... DWORD tmp = 0; WriteConsole(buffer, _T("bla bla"), sizeof ("bla bla") / sizeof (TCHAR), &tmp, 0) // buffer auf screen bringen CONSOLE_SCREEN_BUFFER_INFO info; GetConsoleScreenBufferInfo(screen, &info); COORD coord = {0, 0}; WORD attr1 = 0, attr2 = 0; TCHAR sign1 = _T(' '), sign2 = _T(' '); while (coord.X < info.dwSize.X && coord.Y < info.dwSize.Y) { ReadConsoleOutputCharacter(buffer, &sign1, 1, coord, &tmp); ReadConsoleOutputAttribute(buffer, &attr1, 1, coord, &tmp); ReadConsoleOutputCharacter(screen, &sign2, 1, coord, &tmp); ReadConsoleOutputAttribute(screen, &attr2, 1, coord, &tmp); if (attr1 != attr2 || sign1 != sign2) { WriteConsoleOutputCharacter(screen, &sign1, 1, coord, &tmp); WriteConsoleOutputAttribute(screen, &attr1, 1, coord, &tmp); } if ((++coord.X) >= info.dwSize.X) { coord.X=0; ++coord.Y; } } |
C-/C++-Quelltext |
|
1 |
WriteConsole(buffer, _T("bla bla"), sizeof ("bla bla") / sizeof (TCHAR), &tmp, 0) |
C-/C++-Quelltext |
|
1 2 |
std::basic_string<TCHAR> string = _T(""); // was auch immer da drin is - mir ja egal ;) WriteConsole(buffer, string.c_str(), static_cast<DWORD>(string.size()), &tmp, 0) |
Werbeanzeige