Advertisement

3 Questions on Outputting ASCII characters (and other things)

Started by September 16, 2002 10:32 AM
12 comments, last by Radagar 22 years, 2 months ago
I''m not sure how you output your text, but you can do something like this:

cout << "Blah, Blah" << (char) 15 << "Blah, Blah";
______________________________________________________________________________________The Phoenix shall arise from the ashes... ThunderHawk -- ¦þ"So. Any n00bs need some pointers? I have a std::vector<n00b*> right here..." - ZahlmanMySite | Forum FAQ | File Formats______________________________________________________________________________________
You can output non-keyboard characters without ugly casts using something like this:

cout << ''\x57'';

Which will print out the letter ''W''. Similarly you can do this with any character. Note that the ''x'' signifies that the 57 is in hex.
Advertisement
quote: Original post by Anonymous Poster
You can output non-keyboard characters without ugly casts using something like this:

cout << ''\x57'';

Which will print out the letter ''W''. Similarly you can do this with any character. Note that the ''x'' signifies that the 57 is in hex.



Thanks, I''ll try that as well as the cout<< (char) 243;

WyrmSlayer RPG - In Early Development
All I need to say is this:


    #include <windows.h>#include <time.h>HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE);int main(){   srand(time(NULL));      int MapSizeX = 80;  //The X Size of the map   int MapSizeY = 25;  //The Y size of the map   //If you use this you must make sure the map is a single dimensional array   CHAR_INFO* map = new CHAR_INFO[MapSizeX * MapSizeY];   //This represents the borders of the Map   SMALL_RECT DrawRect = {0, 0, MapSizeX - 1, MapSizeY - 1};   COORD MapSize = {MapSizeX, MapSizeY}; //The Size of the map   COORD ZeroZero = {0,0};  //Must stay 0,0 I really dont know why   int iLoop;   for(iLoop = 0; iLoop <= MapSizeX * MapSizeY; iLoop++)   {      (map[iLoop]).Char.AsciiChar = 65; //Letter A      //There are a possible of 256 colors in the Console functions	  (map[iLoop]).Attributes = rand() % 255;   }   //The best thing about this is that it draws on 1 command and is very fast   WriteConsoleOutput(hOutput, map, MapSize, ZeroZero, &DrawRect);   return 0;}    


I know this really doesn't anser your questions, but maybe in your code you could find a way to use the CHAR_INFO and WriteConsole Output for your maps. I hope I helped you a little.

Jeff D

[edited by - Jeff D on September 17, 2002 3:17:49 AM]
Suffered seven plagues, but refused to let the slaves go free. ~ Ross Atherton

This topic is closed to new replies.

Advertisement