Today I have a question about this code.
class Engine
{
static Engine* getInstance()
{
return instance = (instance == NULL) ? new Engine() : instance;
}
SDL_Renderer* getRenderer() {
return mRenderer;
}
bool init();
bool Clean();
bool Quit();
void Update();
void Render();
void Events();
SDL_Renderer* getRenderer()
{
return mRenderer;
}
private:
Engine();
static Engine* instance;
SDL_Renderer *mRenderer;
};
Engine* Engine::instance = NULL;
If I want to change the value of mRenderer as like a reference variable, I must write this code void render(Engine::GetInstance()->getRenderer())
. So I don't know how the mRenderer change are.
Thanks for reading.
Aucun commentaire:
Enregistrer un commentaire