Pong - Framework Problem

  • Pong - Framework Problem

    Hallo!
    Momentan programmiere ich den Klassiker Pong.
    Nun habe ich Probleme beim Framework. Es ist fertig, jedenfalls in der groben Fassung, aber in der Funktion Init sind manche Variablen und Funktionen völlig unbekannt! Dabei stehen sie in der Klasse!!
    Alles mit den rot BBCode wird nicht erkannt.
    Framework.hpp:

    Quellcode

    1. #ifndef FRAMEWORK_HPP
    2. #define FRAMEWORK_HPP
    3. #include <iostream>
    4. #include "Singleton.hpp"
    5. #include "Timer.hpp"
    6. using namespace std;
    7. #define g_pFramework CFramework::Get()
    8. class CFramework : public TSingleton<CFramework>
    9. {
    10. public:
    11. bool Init (int ScreenWidth, int ScreenHeight,
    12. int ColorDepth, bool bFullscreen);
    13. void Quit ();
    14. void Update ();
    15. void Clear ();
    16. void Flip ();
    17. bool KeyDown (int Key_ID);
    18. SDL_Surface *GetScreen () {return m_pScreen;}
    19. private:
    20. SDL_Surface *m_pScreen; // Surface für den Screen
    21. Uint8 *m_pKeystate; // Array für aktuellen Tastaturstatus
    22. };
    23. #endif
    Alles anzeigen


    Framework.cpp:

    Quellcode

    1. #include "Framework.hpp"
    2. //Init
    3. bool Init (int ScreenWidth, int ScreenHeight,
    4. int ColorDepth, bool bFullscreen)
    5. {
    6. if(SDL_Init (SDL_INIT_VIDEO | SDL_INIT_TIMER) == -1)
    7. {
    8. cout << "SDL konnte nicht richtig initialisiert werden." << endl;
    9. cout << "Fehlermeldung: " << SDL_GetError();
    10. [color=#ff0000]Quit();[/color]
    11. return(false);
    12. }
    13. if(bFullscreen == true)
    14. {
    15. [color=#ff0000]m_pScreen[/color] = SDL_SetVideoMode(ScreenWidth, ScreenHeight, ColorDepth,
    16. SDL_HWSURFACE | SDL_DOUBLEBUF |
    17. SDL_FULLSCREEN);
    18. }
    19. else
    20. {
    21. [color=#ff0000]m_pScreen[/color] = SDL_SetVideoMode(ScreenWidth, ScreenHeight, ColorDepth,
    22. SDL_HWSURFACE | SDL_DOUBLEBUF);
    23. }
    24. if([color=#ff0000]m_pScreen[/color] == 0)
    25. {
    26. cout << "VideoMode konnte nicht gesetzt werden." << endl;
    27. cout << "Fehlermeldung: " << SDL_GetError();
    28. [color=#ff0000]Quit();[/color]
    29. exit(1);
    30. }
    31. [color=#ff0000]m_pKeystate[/color] = SDL_GetKeyState (NULL);
    32. return(true);
    33. }
    34. //Init Ende
    35. //Quit
    36. void CFramework::Quit ()
    37. {
    38. SDL_Quit ();
    39. }
    40. //Quit Ende
    41. //Update
    42. void CFramework::Update ()
    43. {
    44. g_pTimer->Update();
    45. SDL_PumpEvents();
    46. }
    47. //Update Ende
    48. //KeyDown
    49. bool CFramework::KeyDown (int Key_ID)
    50. {
    51. return(m_pKeystate[Key_ID] ? true : false);
    52. }
    53. //KeyDown Ende
    54. //Clear
    55. void CFramework::Clear ()
    56. {
    57. SDL_FillRect (m_pScreen, NULL, SDL_MapRGB(m_pScreen->format, 0, 0, 0));
    58. }
    59. //Clear Ende
    60. //Flip
    61. void CFramework::Flip ()
    62. {
    63. SDL_Flip (m_pScreen);
    64. }
    65. //Flip Ende
    Alles anzeigen