Jump to content
  • Advertisement
Sign in to follow this  
nuclear123

Question on class implementation

This topic is 2524 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

class CHud {
public:

CHud() : bFps(TRUE), bResolution(TRUE), bRefreshRate(TRUE) { };

// Status Checks
bool IsFps() { return bFps; };
bool IsResolution() { return bResolution; };
bool IsRefreshRate(){ return bRefreshRate; };

// Toggler
void NotFps() { bFps = !bFps; };
void NotReolution() { bResolution = !bResolution; };
void NotRefreshRate(){ bRefreshRate = !bRefreshRate; };
private:

bool bFps;
bool bResolution;
bool bRefreshRate;



};

Then i have a class Which holds the DirectX Device...along with functions such as DrawText()...DrawBox()

class CDXRenderer
{
......
void DrawText()
boid DrawBox()
}

My question is....Should the CHud have a function called DrawHealth(), DrawFps()..etc? Where should this functionality be implemented? should it be apart of CHUD or CDXRenderer or should i be using inheritance or maybe even composition for this? thanks

Share this post


Link to post
Share on other sites
Advertisement
In general, I would implement the HUD using a supplied renderer's (more likely some renderer base class') supplied primitives for drawing text/images.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!