私のコードは実際には機能していません(エラーはありませんが、長方形は表示されていません)。CFramework、CRectangle、CGameの3つのクラスがあります。何が間違っている/行方不明ですか?
私のCFrameworkクラスはSDLを開始し、ビデオモードなどを設定します。
CRectangle.hpp:
#ifndef RECTANGLE_HPP
#define RECTANGLE_HPP
#include "Framework.hpp"
class CRectangle
{
public:
CRectangle ();
void createRectangle (int x, int y, int width, int height, int r, int g, int b);
private:
SDL_Surface *m_pScreen; // Pointer at the screen of CFramework
SDL_Rect m_Rect;
};
#endif
CRectangle.cpp:
#include "Rectangle.hpp"
// Konstruktor
//
// Aufgabe: Zeiger auf Screen holen
//
CRectangle::CRectangle ()
{
// Zeiger auf Screen holen
m_pScreen = g_pFramework->GetScreen ();
} // Konstruktor
// createRectangle
//
// Aufgabe: Viereck erstellen
//
void CRectangle::createRectangle (int x, int y, int width, int height, int r, int g, int b)
{
m_Rect.x = x;
m_Rect.y = y;
m_Rect.w = width;
m_Rect.h = height;
SDL_FillRect(m_pScreen, &m_Rect, SDL_MapRGB(m_pScreen->format, r, g, b));
} // createRectangle
CGame.cpp:
... // just the important stuff
m_pRectangleMenu = new CRectangle;
m_pRectangleMenu->createRectangle(100,100,400,400,233,34,34);
...