how to C++ output overlay

Jun 2, 2022 at 9:42am
So I am currently creating a c++ monopoly and wanted to give the center of the screen some purpose. Is there a way to print text when there is already text there?
https://i.stack.imgur.com/xDX05.png
Jun 2, 2022 at 9:45am
What library/API do you use to draw the monopoly board?
Jun 2, 2022 at 9:46am
Just std::cout
Jun 2, 2022 at 9:48am
If you use a curses library (e.g. ncurses) you could specify where you want to draw the text.
Jun 2, 2022 at 9:48am
ou thanks i will look into that :D
Jun 2, 2022 at 9:51am
I think ncurses is the most popular but I don't think it works on Windows so if you use that you might want to use pdcurses instead, but they are very similar and I think it should be possible to write code that will work with both. You could find similar functionality in the "WinAPI" but then it will only work on Windows for sure.
Last edited on Jun 2, 2022 at 9:53am
Jun 2, 2022 at 9:54am
I'm a go big or go home guy. I'd prefer creating a full GUI with something like wxWidgets rather than draw it on a console with ncurses.
Jun 2, 2022 at 11:09am
If using Windows, then there is the whole console set of API's

https://docs.microsoft.com/en-us/windows/console/console-functions

Jun 2, 2022 at 12:24pm
You don't have to dump a logo thru the center of the board. This game is uniquely suited for having your game info in the center of the board... whos turn it is, what you rolled, where you landed, your turn options menu (buy, mortgage, pay rent, whatever) ...
you can also have a summary of the computer player(s) .. their cash on hand, # of properties...
its a large area and you can stuff it full of things.

When doing ascii art redraws, you have to erase what was there full before writing over it. That way if you write 'hello' over 'monopoly' you don't get hellooly
a simple way to do this is have fixed string sizes that you fill with spaces between end of used string and max size.
Last edited on Jun 2, 2022 at 12:27pm
Topic archived. No new replies allowed.