9

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

user2661167
  • 491
  • 5
  • 13
  • 22
  • Dude I really wanna know how you coded that game .. – sukhvir Oct 27 '13 at 03:21
  • I used example code from the text book of my course which had a bouncing ball code. I created a window object and a paddle object. Made the ball detect collision with paddle. Made a game over function if ball touched right side of box and that was it. – user2661167 Oct 27 '13 at 03:41
  • Does this answer your question? [How can I hide the cursor in ncurses?](https://stackoverflow.com/questions/18837836/how-can-i-hide-the-cursor-in-ncurses) – Polluks Aug 10 '21 at 10:14

1 Answers1

16

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).

jwodder
  • 54,758
  • 12
  • 108
  • 124