summaryrefslogtreecommitdiff
path: root/src/irrlichtwrapper.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-01-24 13:32:11 +0200
committerPerttu Ahola <celeron55@gmail.com>2011-01-24 13:32:11 +0200
commit24e41ab4c892a7cecee2d4e5e625afd83de43034 (patch)
tree077aa79e8618d0c2fd44ebc6ad36b72586a3041e /src/irrlichtwrapper.cpp
parent4a952f22d779cdce27dbfc68a23a7d13d3e62c0d (diff)
downloadminetest-24e41ab4c892a7cecee2d4e5e625afd83de43034.tar.gz
minetest-24e41ab4c892a7cecee2d4e5e625afd83de43034.tar.bz2
minetest-24e41ab4c892a7cecee2d4e5e625afd83de43034.zip
Mainly some texture tweaking
Diffstat (limited to 'src/irrlichtwrapper.cpp')
-rw-r--r--src/irrlichtwrapper.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/irrlichtwrapper.cpp b/src/irrlichtwrapper.cpp
index fe4ff2771..e26cbfd15 100644
--- a/src/irrlichtwrapper.cpp
+++ b/src/irrlichtwrapper.cpp
@@ -175,6 +175,40 @@ video::ITexture * CrackTextureMod::make(video::ITexture *original,
return newtexture;
}
+video::ITexture * SideGrassTextureMod::make(video::ITexture *original,
+ const char *newname, video::IVideoDriver* driver)
+{
+ // Size of the base image
+ core::dimension2d<u32> dim(16, 16);
+ // Position to copy the grass to in the base image
+ core::position2d<s32> pos_base(0, 0);
+ // Position to copy the grass from in the grass image
+ core::position2d<s32> pos_other(0, 0);
+
+ video::IImage *baseimage = driver->createImage(original, pos_base, dim);
+ assert(baseimage);
+
+ video::IImage *grassimage = driver->createImageFromFile(porting::getDataPath("grass_side.png").c_str());
+ assert(grassimage);
+
+ // Then copy the right part of grassimage to baseimage
+
+ grassimage->copyToWithAlpha(baseimage, v2s32(0,0),
+ core::rect<s32>(pos_other, dim),
+ video::SColor(255,255,255,255),
+ NULL);
+
+ grassimage->drop();
+
+ // Create texture from resulting image
+
+ video::ITexture *newtexture = driver->addTexture(newname, baseimage);
+
+ baseimage->drop();
+
+ return newtexture;
+}
+
video::ITexture * ProgressBarTextureMod::make(video::ITexture *original,
const char *newname, video::IVideoDriver* driver)
{