Jump to content
  • Advertisement
Sign in to follow this  
Kuraitou

Removing Console Input Underscore? (solved)

This topic is 3775 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am working on a console-based engine for *serious* game development, however I have run into one problem that I can't solve. A picture would be the best to show the problem: [image removed] You can see the annoying underscore that is there as if normal console input was expected. I just want to completely get rid of it. The thing is, if there is no character attributes set on that particular character, the cursor is invisible. I looked over MSDN's console functions but nothing there suits my needs, and I thought that perhaps someone who has done this in the past has a workaround. If there's no way to fix it I just won't use that character. I'm using Visual Studio 2008 with C++, if that is relevant. [Edited by - Kuraitou on March 18, 2009 9:19:33 PM]

Share this post


Link to post
Share on other sites
Advertisement
I am unsure of how to achieve the behavior you want, however...

you may want to consider using a different console library for a more robust set of console features. It might prove to be more useful for your needs in the long run.

Share this post


Link to post
Share on other sites
The problem with that is that I'm developing my own engine, not using someone else's. I just want a way to remove the underscore that appears when you type.

Share this post


Link to post
Share on other sites
I think the function you need is SetConsoleCursorInfo
take a look at http://msdn.microsoft.com/en-us/library/ms686019(VS.85).aspx
you can then just set the cursor as invisible.

Share this post


Link to post
Share on other sites
Ah, I must have overlooked that. I had been doing this before, but it wasn't working:

	CONSOLE_CURSOR_INFO *pCCI = new CONSOLE_CURSOR_INFO();
pCCI->bVisible = false;
pCCI->dwSize = 0;
SetConsoleCursorInfo(m_wHnd, pCCI);
delete pCCI;



(Now after looking at it, I suspect the delete statement, another part of my stupidity. Also this is a very stupid place to use pointers.) Thanks to both of you and ++ratings.

Share this post


Link to post
Share on other sites
Quote:
Original post by Kuraitou
Ah, I must have overlooked that. I had been doing this before, but it wasn't working:

*** Source Snippet Removed ***

(Now after looking at it, I suspect the delete statement, another part of my stupidity. Also this is a very stupid place to use pointers.) Thanks to both of you and ++ratings.


Then don't use pointers. You can do this just as easily:
	CONSOLE_CURSOR_INFO CCI;
CCI.bVisible = false;
CCI.dwSize = 0;
SetConsoleCursorInfo(m_wHnd, &CCI);
(not tested)
Remember, just because a function takes a pointer doesn't necessarily mean manual memory allocation/deallocation.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!