Well it's one of the problems of C++ which forces you to list all your privates in the interface.
You can hide them all, at the expense of an extra level of indirection.
Code:
#ifndef _TEXHANDLER_H_
#define _TEXHANDLER_H_
enum E_texture_type
{
TEXTYPE_player,
TEXTYPE_hud,
TEXTYPE_level,
TEXTYPE_monster,
TEXTYPE_misc,
};
struct S_texthander_private;
class TextureHandler
{
public:
TextureHandler();
~TextureHandler();
unsigned int GetTexture(const char* tex_file_name, E_texture_type tex_type = TEXTYPE_misc);
void UseTexture(unsigned int entry_id);
void MarkTypeAsUnused(E_texture_type unused_type);
void ClearUnusedTextures();
private:
S_texthander_private *privates;
};
#endif // ifndef _TEXHANDLER_H_
#ifndef _TEXHANDLER_PRIVATE_H_
#define _TEXHANDLER_PRIVATE_H_
struct S_texture_entry
{
GLuint texture_id;
E_texture_type texture_type;
int texture_inuse;
char texture_name[80];
};
struct S_texthander_private
{
unsigned int default_texture;
S_texture_entry *entries;
int entries_currentsize;
GLuint LoadTGA(const char* tex_file_name);
int CheckSize(int size);
};
#endif // _TEXHANDLER_PRIVATE_H_
Texturehandler.cpp would begin
#include "Texturehandler.h"
#include "Texturehandler_private.h"
Along with any GL headers it needs.
Anything just using the class only needs Texturehandler.h and no GL header files.
An alternative is to include all your GL header files in Texturehandler.h, like so
Code:
#ifndef _TEXHANDLER_H_
#define _TEXHANDLER_H_
#include <gl.h>
// rest of class.
This has it's downside as well, since any code which uses this class automatically gets all the GL interface in it's namespace as well, which is perhaps not what you want either.