How to remove the programme from the gethce method from the conio.h library



  • My job is to keep the screen updated all the time, but when I added the function of gethce to track the downloads, the update only occurs with the compression of how to make the update independent of the press?

    void Move(Player &pl) 
    {
        switch (_getche())
        {
            case 'a':
                pl.point_y=pl.point_y-1;
                pl.ChangePositiont('$');
                break;
            case 'd':
                pl.point_y = pl.point_y + 1;
                pl.ChangePositiont('$');
                break;
            case 's':
                pl.point_x = pl.point_x + 1;
                pl.ChangePositiont('$');
                break;
            case 'w':
                pl.point_x = pl.point_x - pl.jumpforce;
                pl.ChangePositiont('$');
                break;
        }
        pl.Gravity();
    }
    


  • conio.h There's another great function: _kbhit();just telling me if the keyboard was pressed or not.

    Check it out, and call it out. _getch() Only when you need to.



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2