I am trying to make a 2048 game in C++ using the Win32 Console. Is it possible to include the box symbol ─ in the console? If not, is there any replacement for that symbol other than the normal dash and underscore? I am coding on Windows 10 in Visual Studio 2015. Thanks!
Asked
Active
Viewed 2,081 times
0
-
2If you pick the right character set you should get it. [UTF-8](https://en.wikipedia.org/wiki/Geometric_Shapes) has a bunch as well. – tadman Jul 27 '17 at 17:25
-
you need numbers inside the box, dont you? So just a box wont help – 463035818_is_not_an_ai Jul 27 '17 at 17:26
-
How would I do that? Using char? Because when I paste it into my code, in the console it shows question marks – mendel3 Jul 27 '17 at 17:26
-
windows console doesn't handle utf-8 well. It is better to use wide characters. – Marek R Jul 27 '17 at 17:27
-
@tobi303 I am going to make a box, then include all of the numbers – mendel3 Jul 27 '17 at 17:27
1 Answers
0
You could try Box Drawing with Unicode. https://en.wikipedia.org/wiki/Box-drawing_character
Basically, you use box drawing characters to create the containers you want and fill them in. Then you overwrite the numbers, leaving the boxes in place.
Console manipulation is tricky, so be prepared for some frustration, but you can do what you're attempting.

OneHoopyFrood
- 3,829
- 3
- 24
- 39
-
Thank you, can I just copy and paste one of these characters into my code? – mendel3 Jul 27 '17 at 17:31
-
Check this question out and the answers to it. It should help. https://stackoverflow.com/q/2849010/1795429 – OneHoopyFrood Jul 27 '17 at 17:34
-
@mendel3 [Yes](http://en.cppreference.com/w/cpp/language/string_literal). There is no text but encoded text. Your source file has an encoding ['source charset"] (you are telling your compiler what that is), your compiler output has an encoding ["execution charset"] (you are telling your compiler what to convert to), your console has an encoding ["codepage"] (go `chcp`), your program's runtime library might sense what it is and convert to/from it and the runtime might also be influenced by locale functions that your program calls and environment variables. Then comes the font… – Tom Blodget Jul 28 '17 at 02:46