Skip to content

Commit

Permalink
Add a function to check if the handled pointer is NULL.
Browse files Browse the repository at this point in the history
  • Loading branch information
lipk committed Jun 8, 2014
1 parent f3258c7 commit 0ec70a2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/sdl/texture.cpp
Expand Up @@ -343,6 +343,11 @@ void ttexture::update_pixels(SDL_Surface *surf)
}
}

bool ttexture::null() const
{
return texture_ == NULL;
}

void ttexture::initialise_from_surface(SDL_Renderer& renderer, const int access)
{
if(access == SDL_TEXTUREACCESS_STATIC) {
Expand Down
7 changes: 7 additions & 0 deletions src/sdl/texture.hpp
Expand Up @@ -281,6 +281,13 @@ class ttexture
*/
void update_pixels(SDL_Surface* surf);

/**
* Tells whether the instance really handles an SDL_Texture object.
*
* @return True if the handled pointer is NULL.
*/
bool null() const;

private:
/**
* The reference count of the texture.
Expand Down

0 comments on commit 0ec70a2

Please sign in to comment.