当前位置: 首页>>代码示例>>C++>>正文


C++ core::array类代码示例

本文整理汇总了C++中core::array的典型用法代码示例。如果您正苦于以下问题:C++ array类的具体用法?C++ array怎么用?C++ array使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了array类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setTexture

void CSoftwareRenderTarget::setTexture(const core::array<ITexture*>& texture, ITexture* depthStencil)
{
	if (Texture != texture)
	{
		if (Texture[0])
			Texture[0]->drop();

		bool textureDetected = false;

		for (u32 i = 0; i < texture.size(); ++i)
		{
			if (texture[i] && texture[i]->getDriverType() == EDT_SOFTWARE)
			{
				Texture[0] = texture[i];
				Texture[0]->grab();
				textureDetected = true;

				break;
			}
		}

		if (!textureDetected)
			Texture[0] = 0;
	}
}
开发者ID:vgck,项目名称:irrnacht,代码行数:25,代码来源:CSoftwareTexture.cpp

示例2: makeFastFace

static void makeFastFace(TileSpec tile, u16 li0, u16 li1, u16 li2, u16 li3,
                         v3f p, v3s16 dir, v3f scale, u8 light_source, core::array<FastFace> &dest)
{
    FastFace face;

    // Position is at the center of the cube.
    v3f pos = p * BS;

    v3f vertex_pos[4];
    v3s16 vertex_dirs[4];
    getNodeVertexDirs(dir, vertex_dirs);
    for(u16 i=0; i<4; i++)
    {
        vertex_pos[i] = v3f(
                            BS/2*vertex_dirs[i].X,
                            BS/2*vertex_dirs[i].Y,
                            BS/2*vertex_dirs[i].Z
                        );
    }

    for(u16 i=0; i<4; i++)
    {
        vertex_pos[i].X *= scale.X;
        vertex_pos[i].Y *= scale.Y;
        vertex_pos[i].Z *= scale.Z;
        vertex_pos[i] += pos;
    }

    f32 abs_scale = 1.;
    if     (scale.X < 0.999 || scale.X > 1.001) abs_scale = scale.X;
    else if(scale.Y < 0.999 || scale.Y > 1.001) abs_scale = scale.Y;
    else if(scale.Z < 0.999 || scale.Z > 1.001) abs_scale = scale.Z;

    v3f normal(dir.X, dir.Y, dir.Z);

    u8 alpha = tile.alpha;

    float x0 = tile.texture.pos.X;
    float y0 = tile.texture.pos.Y;
    float w = tile.texture.size.X;
    float h = tile.texture.size.Y;

    face.vertices[0] = video::S3DVertex(vertex_pos[0], normal,
                                        MapBlock_LightColor(alpha, li0, light_source),
                                        core::vector2d<f32>(x0+w*abs_scale, y0+h));
    face.vertices[1] = video::S3DVertex(vertex_pos[1], normal,
                                        MapBlock_LightColor(alpha, li1, light_source),
                                        core::vector2d<f32>(x0, y0+h));
    face.vertices[2] = video::S3DVertex(vertex_pos[2], normal,
                                        MapBlock_LightColor(alpha, li2, light_source),
                                        core::vector2d<f32>(x0, y0));
    face.vertices[3] = video::S3DVertex(vertex_pos[3], normal,
                                        MapBlock_LightColor(alpha, li3, light_source),
                                        core::vector2d<f32>(x0+w*abs_scale, y0));

    face.tile = tile;

    dest.push_back(face);
}
开发者ID:jnumm,项目名称:minetest,代码行数:59,代码来源:mapblock_mesh.cpp

示例3: addUsableSlotArray

//! Adds the slots in the array to the usable slots
void CGUIIcon::addUsableSlotArray(const core::array<IGUIElement*>& slotArray)
{
    s32 arraySize = slotArray.size();
    for(s32 i = 0; i < arraySize; i++)
    {
        UsableSlots->push_back(slotArray[i]);
    }

}
开发者ID:huytd,项目名称:fosengine,代码行数:10,代码来源:CGUIIcon.cpp

示例4: getBlocks

void MapSector::getBlocks(core::array<MapBlock*> &dest)
{
	core::map<s16, MapBlock*>::Iterator bi;

	bi = m_blocks.getIterator();
	for(; bi.atEnd() == false; bi++)
	{
		MapBlock *b = bi.getNode()->getValue();
		dest.push_back(b);
	}
}
开发者ID:DMV27,项目名称:minetest,代码行数:11,代码来源:mapsector.cpp

示例5: activateJoysticks

//! Activate any joysticks, and generate events for them.
bool CIrrDeviceSDL::activateJoysticks(core::array<SJoystickInfo> & joystickInfo)
{
#if defined(_IRR_COMPILE_WITH_JOYSTICK_EVENTS_)
	joystickInfo.clear();

	// we can name up to 256 different joysticks
	const int numJoysticks = core::min_(SDL_NumJoysticks(), 256);
	Joysticks.reallocate(numJoysticks);
	joystickInfo.reallocate(numJoysticks);

	int joystick = 0;
	for (; joystick<numJoysticks; ++joystick)
	{
		Joysticks.push_back(SDL_JoystickOpen(joystick));
		SJoystickInfo info;

		info.Joystick = joystick;
		info.Axes = SDL_JoystickNumAxes(Joysticks[joystick]);
		info.Buttons = SDL_JoystickNumButtons(Joysticks[joystick]);
		info.Name = SDL_JoystickName(joystick);
		info.PovHat = (SDL_JoystickNumHats(Joysticks[joystick]) > 0)
						? SJoystickInfo::POV_HAT_PRESENT : SJoystickInfo::POV_HAT_ABSENT;

		joystickInfo.push_back(info);
	}

	for(joystick = 0; joystick < (int)joystickInfo.size(); ++joystick)
	{
		char logString[256];
		(void)sprintf(logString, "Found joystick %d, %d axes, %d buttons '%s'",
		 joystick, joystickInfo[joystick].Axes,
   joystickInfo[joystick].Buttons, joystickInfo[joystick].Name.c_str());
		os::Printer::log(logString, ELL_INFORMATION);
	}

	return true;

#endif // _IRR_COMPILE_WITH_JOYSTICK_EVENTS_

	return false;
}
开发者ID:AwkwardDev,项目名称:pseuwow,代码行数:42,代码来源:CIrrDeviceSDL.cpp

示例6: createBoxTower

// Create a tower of the specified number of boxes
void createBoxTower(IPhysxManager* physxManager, scene::ISceneManager* smgr, video::IVideoDriver* driver, core::array<SPhysxAndNodePair*>& objects, f32 towerSize, f32 density, const core::vector3df& position) {

    const core::vector3df scale(4,4,4);
    const f32 spacing = -2.0f*physxManager->getSkinWidth();
    core::vector3df pos = position + core::vector3df(0.0f, scale.Y/2.0f, 0.0f);

    while (towerSize > 0) {
        objects.push_back(createBox(physxManager, smgr, driver, pos, scale, density));
        pos.Y += (scale.Y + spacing);
        towerSize--;
    }

}
开发者ID:bdbdonp,项目名称:tubras,代码行数:14,代码来源:irrphysxFuncs.cpp

示例7: v2s32

/*
	Here is an example traditional set-up sequence for a DrawSpec list:

	std::string furnace_inv_id = "nodemetadata:0,1,2";
	core::array<GUIInventoryMenu::DrawSpec> draw_spec;
	draw_spec.push_back(GUIInventoryMenu::DrawSpec(
			"list", furnace_inv_id, "fuel",
			v2s32(2, 3), v2s32(1, 1)));
	draw_spec.push_back(GUIInventoryMenu::DrawSpec(
			"list", furnace_inv_id, "src",
			v2s32(2, 1), v2s32(1, 1)));
	draw_spec.push_back(GUIInventoryMenu::DrawSpec(
			"list", furnace_inv_id, "dst",
			v2s32(5, 1), v2s32(2, 2)));
	draw_spec.push_back(GUIInventoryMenu::DrawSpec(
			"list", "current_player", "main",
			v2s32(0, 5), v2s32(8, 4)));
	setDrawSpec(draw_spec);

	Here is the string for creating the same DrawSpec list (a single line,
	spread to multiple lines here):

	GUIInventoryMenu::makeDrawSpecArrayFromString(
			draw_spec,
			"nodemetadata:0,1,2",
			"invsize[8,9;]"
			"list[current_name;fuel;2,3;1,1;]"
			"list[current_name;src;2,1;1,1;]"
			"list[current_name;dst;5,1;2,2;]"
			"list[current_player;main;0,5;8,4;]");

	Returns inventory menu size defined by invsize[].
*/
v2s16 GUIInventoryMenu::makeDrawSpecArrayFromString(
		core::array<GUIInventoryMenu::DrawSpec> &draw_spec,
		const std::string &data,
		const std::string &current_name)
{
	v2s16 invsize(8,9);
	Strfnd f(data);
	while(f.atend() == false)
	{
		std::string type = trim(f.next("["));
		//infostream<<"type="<<type<<std::endl;
		if(type == "list")
		{
			std::string name = f.next(";");
			if(name == "current_name")
				name = current_name;
			std::string subname = f.next(";");
			s32 pos_x = stoi(f.next(","));
			s32 pos_y = stoi(f.next(";"));
			s32 geom_x = stoi(f.next(","));
			s32 geom_y = stoi(f.next(";"));
			infostream<<"list name="<<name<<", subname="<<subname
					<<", pos=("<<pos_x<<","<<pos_y<<")"
					<<", geom=("<<geom_x<<","<<geom_y<<")"
					<<std::endl;
			draw_spec.push_back(GUIInventoryMenu::DrawSpec(
					type, name, subname,
					v2s32(pos_x,pos_y),v2s32(geom_x,geom_y)));
			f.next("]");
		}
		else if(type == "invsize")
		{
			invsize.X = stoi(f.next(","));
			invsize.Y = stoi(f.next(";"));
			infostream<<"invsize ("<<invsize.X<<","<<invsize.Y<<")"<<std::endl;
			f.next("]");
		}
		else
		{
			// Ignore others
			std::string ts = f.next("]");
			infostream<<"Unknown DrawSpec: type="<<type<<", data=\""<<ts<<"\""
					<<std::endl;
		}
	}

	return invsize;
}
开发者ID:ray8888,项目名称:MINETEST-Minetest-classic-remoboray,代码行数:81,代码来源:guiInventoryMenu.cpp

示例8: create

void CFontTextTag::create( IExtendedText* text, const core::stringw& tag, const core::array<core::stringw>& params )
{
    if ( params.size() == 0 )
    {
        text->setCurrentFont( text->getDefaultFont() );
    }
    else
    {
        core::map<core::stringw,IGUIFont*>::Node* node = FontMap.find( params[0] );
        
        if ( node != NULL )
        {
            text->setCurrentFont( node->getValue() );
        }
    }
}
开发者ID:tecan,项目名称:Luna,代码行数:16,代码来源:CFontTextTag.cpp

示例9: setFramesDirectionSet

void CSceneNodeAnimatorTexture::setFramesDirectionSet(
	u32 direction_idx, const core::array<SAnimationFrame> &frames)
{
	if (direction_idx >= m_DirectionSets.size())
		for (u32 d = m_DirectionSets.size(); d <= direction_idx; d++)
			m_DirectionSets.push_back(core::array<SAnimationFrame>());
	u32 i=0;
	for (i=0; i < m_DirectionSets[direction_idx].size(); ++i)
        SAFE_DROP(m_DirectionSets[direction_idx][i].Texture);
	m_DirectionSets[direction_idx].set_used(0);
	for (i = 0; i < frames.size(); ++i)
    {
        m_DirectionSets[direction_idx].push_back(frames[i]);
		SAFE_GRAB(frames[i].Texture);
    }
}
开发者ID:zdementor,项目名称:my-base,代码行数:16,代码来源:CSceneNodeAnimatorTexture.cpp

示例10: Loop

//! constructor
CSceneNodeAnimatorTexture::CSceneNodeAnimatorTexture(const core::array<video::ITexture*>& textures,
                                                     s32 timePerFrame, bool loop, u32 now)
	: Loop(loop), StartTime(now), TimePerFrame(timePerFrame)
{
	#ifdef _DEBUG
	setDebugName("CSceneNodeAnimatorTexture");
	#endif

	for (u32 i=0; i<textures.size(); ++i)
	{
		if (textures[i])
			textures[i]->grab();

		Textures.push_back(textures[i]);
	}

	EndTime = now + (timePerFrame * Textures.size());
}
开发者ID:jduranmaster,项目名称:ltegameengine,代码行数:19,代码来源:CSceneNodeAnimatorTexture.cpp

示例11: getObjects

void MapBlockObjectList::getObjects(v3f origin, f32 max_d,
		core::array<DistanceSortedObject> &dest)
{
	for(core::map<s16, MapBlockObject*>::Iterator
			i = m_objects.getIterator();
			i.atEnd() == false; i++)
	{
		MapBlockObject *obj = i.getNode()->getValue();

		f32 d = (obj->getRelativeShowPos() - origin).getLength();

		if(d > max_d)
			continue;

		DistanceSortedObject dso(obj, d);

		dest.push_back(dso);
	}
}
开发者ID:DMV27,项目名称:minetest,代码行数:19,代码来源:mapblockobject.cpp

示例12: getActiveObjects

void ClientEnvironment::getActiveObjects(v3f origin, f32 max_d,
		core::array<DistanceSortedActiveObject> &dest)
{
	for(core::map<u16, ClientActiveObject*>::Iterator
			i = m_active_objects.getIterator();
			i.atEnd()==false; i++)
	{
		ClientActiveObject* obj = i.getNode()->getValue();

		f32 d = (obj->getPosition() - origin).getLength();

		if(d > max_d)
			continue;

		DistanceSortedActiveObject dso(obj, d);

		dest.push_back(dso);
	}
}
开发者ID:MarkTraceur,项目名称:minetest-delta,代码行数:19,代码来源:environment.cpp

示例13: createBoxStack

// Create a stack of boxes, with the bottom row having the specified number of boxes
void createBoxStack(IPhysxManager* physxManager, scene::ISceneManager* smgr, video::IVideoDriver* driver, core::array<SPhysxAndNodePair*>& objects, f32 stackSize, f32 density, const core::vector3df& position) {

    const core::vector3df scale(4,4,4);
    const f32 spacing = -2.0f*physxManager->getSkinWidth();
    core::vector3df pos = position + core::vector3df(0.0f, scale.Y/2.0f, 0.0f);
    f32 offset = -stackSize * (scale.X + spacing) * 0.5f;

    while (stackSize > 0) {
        for (s32 i = 0 ; i < stackSize ; ++i) {
            pos.X = offset + (f32)i * (scale.X + spacing);
            objects.push_back(createBox(physxManager, smgr, driver, pos, scale, density));
        }

        offset += scale.X / 2.0f;
        pos.Y += (scale.Y + spacing);
        stackSize--;
    }

}
开发者ID:bdbdonp,项目名称:tubras,代码行数:20,代码来源:irrphysxFuncs.cpp

示例14: getTextureName

std::string TextureSource::getTextureName(u32 id)
{
	JMutexAutoLock lock(m_atlaspointer_cache_mutex);

	if(id >= m_atlaspointer_cache.size())
	{
		errorstream<<"TextureSource::getTextureName(): id="<<id
				<<" >= m_atlaspointer_cache.size()="
				<<m_atlaspointer_cache.size()<<std::endl;
		return "";
	}
	
	return m_atlaspointer_cache[id].name;
}
开发者ID:AMDmi3,项目名称:minetest,代码行数:14,代码来源:tile.cpp

示例15: clear

	void Mesh::clear()
	{
		flags = 0;
		groupId = 0;
		visgroupId = 0;
		props = "";
		color.clear();
		position.set(0,0,0);

		for(u32 s = 0; s < surfaces.size(); s++)
		{
			delete surfaces[s];
		}
		surfaces.clear();
	}
开发者ID:RealBadAngel,项目名称:irrlicht.netcp,代码行数:15,代码来源:CCSMLoader.cpp


注:本文中的core::array类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。