mindoo
mindoo

Reputation: 11

How to stop white cursor from moving in curses console in c++

I'm am currently trying to develop a simple rpg using the curses library that I installed on my Ubuntu distribution. The problem I am running into is that I still have a white cursor blinking on my screen even though the lib is initialized. And when I press key down, the cursor moves down a line and sometimes two at once randomly. Is there any way of preventing this ?

Upvotes: 0

Views: 1149

Answers (2)

Thomas Dickey
Thomas Dickey

Reputation: 54515

Use curs_set to hide the cursor:

The curs_set routine sets the cursor state to invisible, normal, or very visible for visibility equal to 0, 1, or 2 respectively. If the terminal supports the visibility requested, the previous cursor state is returned; otherwise, ERR is returned.

When your program calls endwin, ncurses automatically restores the cursor visibility.

Regarding the cursor moving "randomly", no one can answer that without seeing your (small) sample program.

Upvotes: 1

Jean-philippe Emond
Jean-philippe Emond

Reputation: 1614

You can try to use something like:

system("setterm -cursor off");

With the cstdliblibrary

Upvotes: 1

Related Questions