Windows/WASM platform fixes
This commit is contained in:
parent
de7778b147
commit
3ce7de6134
5 changed files with 27 additions and 11 deletions
|
|
@ -503,6 +503,10 @@ public:
|
|||
size_ = Vector2u(256, 256);
|
||||
return true;
|
||||
}
|
||||
bool loadFromImage(const Image& image) {
|
||||
size_ = image.getSize();
|
||||
return true;
|
||||
}
|
||||
Vector2u getSize() const { return size_; }
|
||||
void setSmooth(bool smooth) {}
|
||||
bool isSmooth() const { return false; }
|
||||
|
|
|
|||
|
|
@ -1100,6 +1100,17 @@ bool Texture::loadFromMemory(const void* data, size_t size) {
|
|||
return textureId_ != 0;
|
||||
}
|
||||
|
||||
bool Texture::loadFromImage(const Image& image) {
|
||||
if (textureId_) {
|
||||
SDL2Renderer::getInstance().deleteTexture(textureId_);
|
||||
}
|
||||
auto imgSize = image.getSize();
|
||||
size_ = imgSize;
|
||||
textureId_ = SDL2Renderer::getInstance().createTexture(
|
||||
imgSize.x, imgSize.y, image.getPixelsPtr());
|
||||
return textureId_ != 0;
|
||||
}
|
||||
|
||||
void Texture::setSmooth(bool smooth) {
|
||||
smooth_ = smooth;
|
||||
if (textureId_) {
|
||||
|
|
|
|||
|
|
@ -669,6 +669,7 @@ public:
|
|||
bool create(unsigned int width, unsigned int height); // Implemented in SDL2Renderer.cpp
|
||||
bool loadFromFile(const std::string& filename); // Implemented in SDL2Renderer.cpp
|
||||
bool loadFromMemory(const void* data, size_t size); // Implemented in SDL2Renderer.cpp
|
||||
bool loadFromImage(const Image& image); // Implemented in SDL2Renderer.cpp
|
||||
|
||||
Vector2u getSize() const { return size_; }
|
||||
void setSize(unsigned int width, unsigned int height) { size_ = Vector2u(width, height); }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue