誰かが説明してくれることを期待していたクラスとは少し混乱しています。
ゲームメニューのボタンを作成するために作成しているクラスがあります。4つの変数があります:
int m_x
int m_y
int m_width
int m_height
次に、クラスでレンダリング関数を使用したいのですが、クラスで4つのint変数を使用して、それをクラスの関数に渡す方法がわかりません。
私のクラスは次のようなものです。
class Button
{
private:
int m_x, m_y; // coordinates of upper left corner of control
int m_width, m_height; // size of control
public:
Button(int x, int y, int width, int height)
{
m_x = x;
m_y = y;
m_width = width;
m_height = height;
}
void Render(SDL_Surface *source,SDL_Surface *destination,int x, int y)
{
SDL_Rect offset;
offset.x = x;
offset.y = y;
SDL_BlitSurface( source, NULL, destination, &offset );
}
} //end class
私が混乱しているのは、で作成された値がどのようにpublic:Button
渡されるvoid render
かです。まだ少し混乱しているので、これまでのところ純粋な運があれば、これが正しいかどうかは完全にはわかりません。