void WPN_Init(TextureManager& textureManager, Sound& sound, Console& console) { std::set<Int32> nearestFilterBoom = { 5, 6, 9, 13, 14, 15, 16 }; console.printLine("\n===Weapon initialization==="); for (Weapon& weap : d6WpnDef) { const std::string wpnPath = Format("{0}{1,3|0}") << D6_TEXTURE_WPN_PATH << weap.index; weap.textures.boom = textureManager.load(Format("{0}/boom/") << wpnPath, nearestFilterBoom.find(weap.index) != nearestFilterBoom.end() ? GL_NEAREST : GL_LINEAR, true); weap.textures.gun = textureManager.load(Format("{0}/gun/") << wpnPath, GL_NEAREST, true); weap.textures.shot = textureManager.load(Format("{0}/shot/") << wpnPath, GL_NEAREST, true); if (weap.shotSound) { weap.shotSample = sound.loadSample(std::string(D6_FILE_WEAPON_SOUNDS) + weap.shotSound); } if (weap.boomSound) { weap.boomSample = sound.loadSample(std::string(D6_FILE_WEAPON_SOUNDS) + weap.boomSound); } } Color brownColor(83, 44, 0); PlayerSkinColors skinColors(brownColor); brownSkin = std::make_unique<PlayerSkin>("textures/man/", skinColors, textureManager); }
ParticleSystem::ParticleSystem(TextureManager &texture_manager, ConfigFile &config_file) : position(0, 0, 0), unitx(1,0,0), unity(0,1,0), unitz(0,0,1), enabled(true), active(true), alive(true) { string texture; config_file.selectSection("ParticleSystem"); config_file.get("dimensions", dimensions); config_file.get("maxparticles", maxparticles); config_file.get("minspawntime", minspawntime); config_file.get("maxspawntime", maxspawntime); config_file.get("maxspawncount", maxspawncount); config_file.selectSection("SpawnVelocity"); config_file.get("min", minvel); config_file.get("max", maxvel); config_file.get("acceleration", acceleration); config_file.selectSection("Particle"); config_file.get("texture", texture); config_file.get("startsize", startsize); config_file.get("endsize", endsize); config_file.get("minlifetime", minlifetime); config_file.get("maxlifetime", maxlifetime); config_file.get("startangle", startangle); config_file.get("endangle", endangle); config_file.get("startcolor", startcolor); config_file.get("endcolor", endcolor); this->texture = texture_manager.load(texture); spawntime = 0.0; }
const Texture& getTexture(const std::string& path) { if (!textureManager.isLoaded(path)) { textureManager.load(path); } return textureManager.get(path); }
MapDraw::MapDraw() { showPheramone = 0; smoothScrollX = smoothScrollY = 0; boxSide = 0.1; picked = '\0'; pickMode = false; //tm = '\0'; TextureManager *tm = new TextureManager(); tm->load( 0, (u8*)dirt_one_img_bin ); // tm->bind( ); }
PlayerSkin::PlayerSkin(const std::string& texturePath, const PlayerSkinColors& colors, TextureManager& textureManager) { TextureManager::SubstitutionTable substTable; substTable[Color(255, 255, 0)] = colors.get(PlayerSkinColors::HairTop); substTable[Color(222,218,0)] = colors.get(PlayerSkinColors::HairBottom); substTable[Color(0, 0, 172)] = colors.get(PlayerSkinColors::BodyOuter); substTable[Color(0, 0, 255)] = colors.get(PlayerSkinColors::BodyInner); substTable[Color(0, 182, 0)] = colors.get(PlayerSkinColors::HandOuter); substTable[Color(0, 255, 0)] = colors.get(PlayerSkinColors::HandInner); substTable[Color(139, 0, 0)] = colors.get(PlayerSkinColors::Trousers); substTable[Color(180, 182, 0)] = colors.get(PlayerSkinColors::Shoes); substTable[Color(255, 145, 172)] = colors.get(PlayerSkinColors::Face); textures = textureManager.load(texturePath, TextureFilter::NEAREST, true, substTable); }