From 24e41ab4c892a7cecee2d4e5e625afd83de43034 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Mon, 24 Jan 2011 13:32:11 +0200 Subject: Mainly some texture tweaking --- src/irrlichtwrapper.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src/irrlichtwrapper.cpp') 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 dim(16, 16); + // Position to copy the grass to in the base image + core::position2d pos_base(0, 0); + // Position to copy the grass from in the grass image + core::position2d 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(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) { -- cgit v1.2.3