Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C - Curses, remove blinking cursor from game

Hi I'm doing an assignment in C in Unix and the task is to make a simple pong game. I've got the game working now except there is one annoying part, there is a blinking cursor directly behind the paddle constantly. How do I turn this off?

Here is a screenshot.

enter image description here

like image 427
user2661167 Avatar asked Oct 27 '13 02:10

user2661167


People also ask

How do I Turn Off the blinking of the cursor?

In Emacs, M-x blink-cursor-mode toggles the cursor's blinking. Put (blink-cursor-mode 0) in your ~/.emacs to turn it off. This is a global setting and does not apply in a text terminal. See also Juri Linkov (Jurta)'s No Blinking page for how to turn off blinking in Lesstif, Tk, Gtk (Gnome), Qt (KDE), Firefox, and more.

Why is my computer screen black with a blinking cursor?

Let's begin. Note: A black screen with a blinking cursor is different from a black screen with no cursor. We are going to discuss the former here. Different errors require different troubleshooting steps. 1. Remove Accessories Here is what's happening. Your computer fails to boot up because it can't read the necessary files stored on the partition.

What does curs_set do in C++?

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. Thanks for contributing an answer to Stack Overflow!

How do I make the xterm cursor Blink faster?

The xterm cursor blinks if the cursorBlink resource is set to true or the -bc option is passed on the command line. The blink rate is customizable through the cursorOnTime and cursorOffTime resources. Some other GUI terminal emulators can blink the cursor; check their configuration dialog box.


1 Answers

If your terminal supports making the cursor invisible, you can do so with the curs_set function:

curs_set(0);

If your terminal doesn't support making it invisible, curs_set will return ERR, and your only option will be to try to move the cursor to the least distracting location possible (In this case, just keeping the cursor on top of the ball should be suitable).

like image 50
jwodder Avatar answered Sep 18 '22 13:09

jwodder