summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorSmallJoker <mk939@ymail.com>2016-05-03 20:14:01 +0200
committerest31 <MTest31@outlook.com>2016-05-09 20:48:42 +0200
commit53e9587861fdf8c588f7e51eca522215167250b4 (patch)
tree258deb7537632ff8787e7e05094f2cffdcfd3d73 /src/client
parent95446f4b6d16e8b24b3513fcdd028cedebef3f06 (diff)
downloadminetest-53e9587861fdf8c588f7e51eca522215167250b4.tar.gz
minetest-53e9587861fdf8c588f7e51eca522215167250b4.tar.bz2
minetest-53e9587861fdf8c588f7e51eca522215167250b4.zip
Add [resize texture modifier Resizes the texture to the given dimensions.
Diffstat (limited to 'src/client')
-rw-r--r--src/client/tile.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/client/tile.cpp b/src/client/tile.cpp
index 72d626da7..ec8c95f02 100644
--- a/src/client/tile.cpp
+++ b/src/client/tile.cpp
@@ -1352,7 +1352,6 @@ bool TextureSource::generateImagePart(std::string part_of_name,
u32 r1 = stoi(sf.next(","));
u32 g1 = stoi(sf.next(","));
u32 b1 = stoi(sf.next(""));
- std::string filename = sf.next("");
core::dimension2d<u32> dim = baseimg->getDimension();
@@ -1711,6 +1710,31 @@ bool TextureSource::generateImagePart(std::string part_of_name,
}
}
}
+ /*
+ [resize:WxH
+ Resizes the base image to the given dimensions
+ */
+ else if (str_starts_with(part_of_name, "[resize"))
+ {
+ if (baseimg == NULL) {
+ errorstream << "generateImagePart(): baseimg == NULL "
+ << "for part_of_name=\""<< part_of_name
+ << "\", cancelling." << std::endl;
+ return false;
+ }
+
+ Strfnd sf(part_of_name);
+ sf.next(":");
+ u32 width = stoi(sf.next("x"));
+ u32 height = stoi(sf.next(""));
+ core::dimension2d<u32> dim(width, height);
+
+ video::IImage* image = m_device->getVideoDriver()->
+ createImage(video::ECF_A8R8G8B8, dim);
+ baseimg->copyToScaling(image);
+ baseimg->drop();
+ baseimg = image;
+ }
else
{
errorstream << "generateImagePart(): Invalid "