Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2011
    Posts
    1

    Unhappy Error in game loop

    This is the code
    Code:
    #include "game.h"
    #include <conio.h>
    
    
    bool Game::run(void)
    {
        char key = ' ';
        while (key != 'q')
        {
            while (!getInput(&key))
            {
    
            }
        }
        
        return true;
    }
    
    bool Game::getInput(char *c)
    {
        if (kbhit())
        {
            *c = getch();
            return true;
        }
        return false
    }
    #ifndef GAME_H
    #define GAME_H
    
    class Game
    {
    public:
        bool run(void);
    
    protected:
        bool GetInput(char *c);
        void timerUpdate;
    
    };
    
    #endif
    #include "game.h"
    
    
    int main()
    {
        Game gameheart;
    
        gameheart.run();
    
        return 0;
    }
    i have no idea whats wrong
    Last edited by fatgav; 12-21-2011 at 08:52 PM. Reason: code tags

  2. #2
    Join Date
    Oct 2005
    Location
    Seattle, WA
    Posts
    501
    Function names are case sensitive. You declare GetInput(char *c) but define it as getInput(char *c).

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •