mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 06:05:38 +00:00
Added a setRawImage function to ImageComponent to load raw pixel data into textures
This commit is contained in:
parent
e7e3db7f6d
commit
177dd23b7c
|
@ -128,6 +128,15 @@ void ImageComponent::setImage(const std::shared_ptr<TextureResource>& texture, b
|
|||
resize();
|
||||
}
|
||||
|
||||
void ImageComponent::setRawImage(const unsigned char* data, float width, float height)
|
||||
{
|
||||
mTexture.reset();
|
||||
mTexture = TextureResource::get("");
|
||||
mTexture->initFromPixels(data, width, height);
|
||||
|
||||
resize();
|
||||
}
|
||||
|
||||
void ImageComponent::setGameOverrideImage(const std::string& basename, const std::string& system)
|
||||
{
|
||||
if (mGameOverridePath == "")
|
||||
|
|
|
@ -29,6 +29,8 @@ public:
|
|||
void setImage(const char* data, size_t length, bool tile = false);
|
||||
// Use an already existing texture.
|
||||
void setImage(const std::shared_ptr<TextureResource>& texture, bool resizeTexture = true);
|
||||
// Loads a texture using raw image pixel data.
|
||||
void setRawImage(const unsigned char* data, float width, float height);
|
||||
|
||||
// Sets per-game overrides of static images using the game file basename.
|
||||
void setGameOverrideImage(const std::string& basename, const std::string& system) override;
|
||||
|
|
Loading…
Reference in a new issue