Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F626295
CachedTexture.h
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
934 B
Referenced Files
None
Subscribers
None
CachedTexture.h
View Options
#ifndef CACHEDTEXTURE_H
#define CACHEDTEXTURE_H
#include
"Render.h"
//A class to cache textures that display stuff that is updated regularly
template
<
typename
T
>
class
CachedTexture
{
private
:
T
id
;
TexturePtr
tex
;
public
:
CachedTexture
()
{}
TexturePtr
&
getTexture
(){
return
tex
;
}
SDL_Texture
*
get
(){
return
tex
.
get
();
}
const
T
&
getId
()
const
{
return
id
;
}
// Check if the texture exists.
bool
exists
()
{
return
tex
.
get
()
!=
nullptr
;
}
// Check if the contained texture has to be updated.
bool
needsUpdate
(
const
T
&
id
){
if
(
this
->
id
!=
id
||
!
tex
)
{
return
true
;
}
else
{
return
false
;
}
}
//Update the contained texture with a new id and texture.
void
update
(
T
id
,
TexturePtr
&&
texture
)
{
this
->
id
=
id
;
this
->
tex
=
std
::
move
(
texture
);
}
};
#endif
// CACHEDTEXTURE_H
File Metadata
Details
Attached
Mime Type
text/x-c++
Expires
Sun, Nov 15, 12:33 AM (1 d, 16 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
122114
Default Alt Text
CachedTexture.h (934 B)
Attached To
Mode
R79 meandmyshadow
Attached
Detach File
Event Timeline