Introduction: C++ Portal Art

About: I love electronic projects and anything to do with a robot. I still have a lot to learn and I love instructibles.

In this instructable I will be going over the basics of ASCII text art in c++ as well as making some fun portal themed programs. Although I'm using C++ this technique can be implemented to most coding languages.

what you'll need.

a computer

c++

internet access (if you're reading this then you have it ;)

basic programming skills

Step 1: Choosing and Converting

Text art is often very finicky so it's best to find a simple picture, silhouettes work great! Once you've located a suitable picture save it to your computer and then google ASCII image converter. This website can convert images into several types of data. We want to convert them to ASCII so be sure to click on the middle circle in the convert page, before you convert your picture. Here is a link to the website, or you can google it, whatever you prefer. I give full credit to this website for the actual image converting.

Step 2: Encoding the Image

Copy and paste the ASCII images from the previous step into your code. If you're using C++ then write cout<<" for every line of text. I find that the best way to do this is to copy cout<<" then click before the line of text starts. Press Ctrl v then click on the next line and repeat for all the lines of text. Make sure that the cout<<"s are all even like this. If they are not even, the picture will be distorted.

example

cout<<"

cout<<"

cout<<"

At the end of each line of text, write "<<endl; following the method above. Since the "<<endl; is at the end of the line they don't have to be even.

If you are using a different program, then just put whatever command you normally use to write to the screen and end a line in place of cout<<" and"<<endl;.

Step 3: Sizing Command Prompt

When you compile your code for the first time, your command prompt window will probably not fit the image. To remedy this, right click on the top of the command prompt window and select properties. Once in the properties window select layout and extend the length and width of the window to fit your screen. Press OK and then close your program. When you run the program again the new command prompt window should fill your screen and display your image. You can also change the color of your image by selecting colors in the properties tab. Make sure to change the text color and not the background color. To get the orange glados color, select yellow text and lower the green value to about 110. Using the primary colors you could get any color that fits your needs.

Step 4: Final Thoughts

If I were to use this in some important code I would make the image a function that I could call, so that I wouldn't interrupt the flow of the program with a giant picture. I am aware that there are many more efficient ways to put a picture in a program, but I really liked the retro look it gave my programs. I think this would be a great way for a novice programmer to add some flare to their programs. The plain command prompt window can get boring and I think this is a fun way to make a program more exciting. Also, I fell down the stairs and broke my laptop so if you could vote for me in the coded creations contest I would really appreciate it.

Here's some examples that I've made for you to mess around with, enjoy! :)

Mind for Design

Participated in the
Mind for Design

Coded Creations

Participated in the
Coded Creations