0
votes

I need help hiding the cursor in my console game. OS is Linux Mint. I'm tried using unit video and it didn't work. CursorOff in Crt unit works only under win OS. How can such a problem be solved?

The main idea is to hide blinking cursor after updating the map. Every time the playing field is drawn, everything flashes creepyly. Significantly improved the case of moving the cursor to the upper left corner. But this is still far from ideal. Maybe if i could hide the display of the cursor everything would work as it should. (Game map is a two dim. array of char)

    repeat
       ch := ReadKey;
       MainCharMove(Character, MainCharSym, ch);
       BumpTheWall := MainMap[Character.y, Character.x] = FrameSym;
    if BumpTheWall then 
      begin
        Character.x := Character.px;
        Character.y := Character.py;
        GoToXY(1,1);
        ClrMap();
        PutCharacter(Character, MainMap, MainCharSym);
        MapDisplay(MainMap);
      end
    else
      begin
        GoToXY(1,1);
        ClrMap();
        PutCharacter(Character, MainMap, MainCharSym);
        MapDisplay(MainMap);
      end;
  until ch = #27;
1
Please show in detail what your code does - David Heffernan
If you are using a terminal emulator, try a different one. Anyway, find documentation about "escape sequences", maybe you find one of them able to hide the cursor in your console/emulator... - linuxfan says Reinstate Monica

1 Answers

0
votes

Use unit video, it is meant for whole screen applications. Crt is meant for legacy dos program compatibility not to base frameworks on.

It is strange that you have flicker issues with both units, since they update the screen differently.

That said, FPC comes with textual games using unit video (demo/graph/fpctris which can be compiled for graphics and for console). I looked (I did those 21 years ago), and it uses crt for cursor, but video for output.