Jump to content
  • Advertisement
Sign in to follow this  
Genjix

reading width and height from SDL_Surface* or storing in a seperate buffer?

This topic is 4726 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

I regularly need to query the screen size from within the application, and I know this may sound stupid but I was wondering whether reading the w,h data members of the screen struct is sufficient. Is there any reason I should store the dimensions in a separate place rather than repeatedly reading the screen.
class A
{
        int Width();
        int Height();
    private:
        SDL_Surface *screen;
};

class A
{
        const Dimension &ScreenSize();
    private:
        SDL_Surface *screen;
        Dimension screensize;
};

I ask this because I remember some issues with reading certain SDL structure's members. Thanks for your time.

Share this post


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

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!