1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
//***Classes***//
class Game{
public:
class Button{
private:
SDL_Rect *TempButtonCut;
SDL_Rect Box; // <=--***** I wanna pass this!! *****
public:
Button(int x, int y, int w, int h);
void HandleButtonEvent();
};
SDL_Surface *Screen;
SDL_Surface *MenuBackground;
SDL_Surface *MenuButtonNewGame;
SDL_Surface *MenuButtonLoadGame;
SDL_Surface *MenuButtonControls;
SDL_Surface *MenuButtonSettings;
SDL_Surface *MenuButtonQuit;
SDL_Surface *Level1;
bool Init();
void Controls();
void Update(Button *NewGameButton); // <=-- Into Here! Not sure if thats correct so far!
void Display();
void Quit();
};
void Game::Update(Button *NewGameButton) // <=-- Here is the Function!
{
PutImage(0, 0, MenuBackground, Screen);
// This is Fixed now!
PutImage(NewGameButton->Box.x, Button.NewGameButton.Box.y, MenuButtonNewGame, Screen, Button.NewGameButton.TempButtonCut); // <=-- This is where I can't work out
PutImage(Box.x, Box.y, MenuButtonLoadGame, Screen, TempButtonCut);
PutImage(Box.x, Box.y, MenuButtonControls, Screen, TempButtonCut);
PutImage(Box.x, Box.y, MenuButtonSettings, Screen, TempButtonCut);
PutImage(Box.x, Box.y, MenuButtonQuit, Screen, TempButtonCut);
}
int main(int argc, char *args[])
{
Game Game; //<=-- Declearing
Game::Button NewGameButton(320, 315, 640, 100); // <=-- Declaring
//************New Problem********************************
Game.Update(Game::Button *NewGameButton, Game::Button *LoadGameButton, Game::Button *ControlsButton, Game::Button *SettingsButton, Game::Button *QuitButton); // <=-- New Problem!! ***************
//**************************************************************
|