cagou
cagou

Reputation: 25

Windows console cursor symbol / sigal bars in C++ Console app

I'm looking for a way to get a kind of signal bars for my C++ console application. (it calculates the pings and the average and output signal bars based on the difference between the ping and the ping average) So I need to print simple signal bars in ASCII or w/e, for the moment I've the following: "_▄█" (it's in 3 diff levels) But the first underscore is too "slim" to fit the other bars. (on the console window: _, alt+220, alt+219) But the console "cursor" is just perfect for that matter, any idea on what symbol it is or how can I print it to a "static" mode (without getting on/off) ? Or maybe you have any other idea on how I could display simple bars like that?

Edit: here is the actual result http://img15.hostingpics.net/pics/456373Sanstitre.jpg

Upvotes: 2

Views: 1758

Answers (3)

Darkosphere
Darkosphere

Reputation: 171

After trying to output one of the examples in console it looks like that the amount of characters used is truncated at the 4th one so what was looking promising would not be able to carry out what the OP request except on a very low scale.

You can try the upper dash combination character ̅ ( U+0305 )
You could get it from charmap on windows but you will not be able to copy it from here.

It stacks when used multiple times below is an example with the amount of characters used for each bar. There's also an under version but as it stacks down it may not be suitable for your need.


 ̅̅  ̅̅̅̅  ̅̅̅̅̅̅̅̅  ̅̅̅̅̅̅̅̅̅̅̅̅  ̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅  ̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅      
 amount of chars by displayed bar (left to right): 
 2 - 4 - 8 - 12 - 16 - 20 

It may not look like full bars but scaling and proportions may look better using this char however they may require a bit of spacing because their reading when stick together is not very clear.


 ̅̅ ̅̅̅̅ ̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅   
same bars as previous example but with no space in between

̅̅ ̅̅ ̅̅̅̅ ̅̅̅̅ ̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅    
no space doubled bars

̅̅ ̅̅  ̅̅̅̅ ̅̅̅̅  ̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅  ̅̅̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅̅̅  ̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅  ̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅    
single space doubled bars

Upvotes: 0

Mogo
Mogo

Reputation: 26

▁▂▃▄▅▆▇█ Found these by using Babelmap. Hope they help!

Upvotes: 1

Drop
Drop

Reputation: 13003

Possible solution 1

It is not exactly what you are looking for, but consider use a curses library, or some of the derivative libraries. It can help you draw neat things in console window. There are many of them, with different features, and here is some that has Windows ports: ncurses for Win32, pdcurses, libcaca.

ASCII graphics often abuses trick when multiple adjacent characters merges for human eye into some figure.

enter image description here

..or gradient

enter image description here

Maybe you can use it somehow, for example, render these indicators like rectangles.


Possible solution 2

Another solution can be embedding your custom font: with special tools you can edit existent font, for example Courier, add/replace whatever glyphs you like and change your app font to custom one.

Upvotes: 0

Related Questions