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


C++ Components类代码示例

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


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

示例1: displayString

QString Component::displayString()
{
    Components *p = static_cast<Components *>(_parent);
    return (QString("%1 %2")
            .arg(p->cType() == CT_FACE ? "Face" : (p->cType() == CT_EDGE ? "Edge" : "Vertex"))
            .arg(_index + 1));
}
开发者ID:akva2,项目名称:BSGUI,代码行数:7,代码来源:ObjectSet.cpp

示例2: areaSize

GameController::GameController()
{
  // TODO: All this static initialization will have to be done through some other
  //       means. This is just for testing purposes.
  Box areaSize(100, 100);
  
  _player = new Character("Trey Cucco", Traits(5, 7, 6, 7, 8, 7, 5), Character::Gender::Male);
  _player->currentPosition(areaSize.center());
  _area = new Area(areaSize, "The Arena!", "The arena is where we test out moving, fighting and NPC AI. We hope to use this as the primary test bed for much of the game engine.");

  _area->npcs().push_back(new Character("Johnny Ringo", Traits(2, 2, 2, 2, 2, 6, 2), Character::Gender::Male));
  _area->npcs().push_back(new Character("Ike Clanton", Traits(3, 3, 3, 3, 3, 6, 3), Character::Gender::Male));
  _area->npcs()[0]->currentPosition(areaSize.center() + Point(areaSize.width() / 10, areaSize.height() / 8));
  _area->npcs()[1]->currentPosition(areaSize.center() + Point(-areaSize.width() / 7, -areaSize.height() / 15));

  double radius = areaSize.width() / 2;
  for (int c = 0; c < areaSize.width(); ++c)
  {
    for (int r = 0; r < areaSize.height(); ++r)
    {
      Point p(c, r);
      if (Components::dist(p, areaSize.center()) > radius)
      {
        _area->location(p).locationType(Models::AreaLocationType::Barrier);
      }
    }
  }
  
  for (auto i = _area->npcs().begin(); i != _area->npcs().end(); ++i)
  {
    _area->location((*i)->currentPosition()).occupyingCharacter(*i);
  }
  _area->location(_player->currentPosition()).occupyingCharacter(_player);
}
开发者ID:treycucco,项目名称:BNTCops,代码行数:34,代码来源:GameController.cpp

示例3: main

int main() {
    Components test;
    vector<pair<int, int>> edges1 = {{0, 1}, {1, 2}, {3, 4}};
    vector<pair<int, int>> edges2 = {{0, 1}, {1, 2}, {2, 3}, {3, 4}};
    cout << test.countComponents(5, edges1) << " " << test.countComponents(5, edges2) << endl;

}
开发者ID:kaywsy,项目名称:Leetcode-Locked,代码行数:7,代码来源:323_number_of_connected_components_in_an_undirected_graph.cpp

示例4: c1

GlyphId CompositeText::addToFont(String name) {
    Exception::FontContext c1 (font);

    HorMetric hm;
    hm.advanceWidth = 0;
    hm.lsb = 0;
    Components components;
    Chars::iterator c;
    UShort totalAdvance = 0;
    for (c = chars.begin(); c != chars.end(); c ++) {
        totalAdvance += (*c)->getAdvance();
    }
    for (c = chars.begin(); c != chars.end(); c ++) {
        ((CompositeChar &)(**c)).addToComponents (components, hm, totalAdvance);
    }
    GlyphPtr newGlyph;
    if (components.empty())
        newGlyph = new Glyph (font, name, hm);
    else {
        newGlyph = new CompositeGlyph (font, name, hm, components);
        hm.lsb = newGlyph->getDisplacement();
        newGlyph->setHorMetric (hm);
    }
    return font.addGlyph (newGlyph);
}
开发者ID:kennytm,项目名称:tticomp,代码行数:25,代码来源:CompositeOTText.cpp

示例5: Timestamp

Timestamp
Timestamp::fromComponents(const Timestamp::Components &c)
{
  Components normal = c;
  normal.normalize();
  return Timestamp((c.hours * millisPerHour)
                 + (c.minutes * millisPerMinute)
                 + (c.seconds * millisPerSecond)
                 + (c.msec));
}
开发者ID:caitp,项目名称:TimedText,代码行数:10,代码来源:Timestamp.cpp

示例6: registerComponent

void PhysicsComponent::registerComponent(Components& components)
{
	Component::registerComponent(components);

	components.subscribeMessageType(*this, ComponentInterface::ePositionChangedMsg);
   components.subscribeMessageType(*this, ComponentInterface::eRotationChangedMsg);
   components.subscribeMessageType(*this, ComponentInterface::eQueryBodyMsg);

   mpBody->setEntity(getEntity());
}
开发者ID:crafter2d,项目名称:crafter2d,代码行数:10,代码来源:physicscomponent.cpp

示例7:

void
Timestamp::setComponents(const Timestamp::Components &c)
{
  Components normal = c;
  normal.normalize();
  ms = (c.hours * millisPerHour)
     + (c.minutes * millisPerMinute)
     + (c.seconds * millisPerSecond)
     + (c.msec);
}
开发者ID:caitp,项目名称:TimedText,代码行数:10,代码来源:Timestamp.cpp

示例8: component_currentlcid

void ComponentsUnitTests::testLcidFilters()
{
    Components components;
    ComponentPtr component_currentlcid(new MsiComponent());
    component_currentlcid->os_filter_lcid = L"1040";
    ComponentPtr component_anotherlcid(new MsiComponent());
    component_anotherlcid->os_filter_lcid = L"!1040";
    components.add(component_currentlcid);
    components.add(component_anotherlcid);
    Assert::IsTrue(components.size() == 2);
    Assert::IsTrue(components.GetSupportedComponents(LcidUser, SequenceInstall).size() == 1);
}
开发者ID:dblock,项目名称:dotnetinstaller,代码行数:12,代码来源:ComponentsUnitTests.cpp

示例9: testExecNoCallback

void ComponentsUnitTests::testExecNoCallback()
{
    Components components;
    CmdComponent * component1 = new CmdComponent();
    component1->id = DVLib::GenerateGUIDStringW();
    std::wstring check_file = DVLib::DirectoryCombine(DVLib::GetTemporaryDirectoryW(), component1->id);
    Assert::IsTrue(! DVLib::FileExists(check_file));
    component1->command = L"cmd.exe /C dir > \"" + check_file + L"\"";
    components.add(ComponentPtr(component1));
    components.Exec(NULL);
    Assert::IsTrue(DVLib::FileExists(check_file));
    DVLib::FileDelete(check_file);
}
开发者ID:dblock,项目名称:dotnetinstaller,代码行数:13,代码来源:ComponentsUnitTests.cpp

示例10: component_currentpa

void ComponentsUnitTests::testPAFilters()
{
    Components components;
    ComponentPtr component_currentpa(new MsiComponent());
    component_currentpa->processor_architecture_filter = L"mips";
    ComponentPtr component_anotherpa(new MsiComponent());
    component_anotherpa->processor_architecture_filter = L"x86,x64";
    components.add(component_currentpa);
    components.add(component_anotherpa);
    Assert::IsTrue(components.size() == 2);
    Assert::IsTrue(components.GetSupportedComponents(LcidUser, SequenceInstall).size() == 1);
    Assert::IsTrue(get(components.GetSupportedComponents(LcidUser, SequenceInstall)[0]) == get(component_anotherpa));
}
开发者ID:dblock,项目名称:dotnetinstaller,代码行数:13,代码来源:ComponentsUnitTests.cpp

示例11: process_component

//-----------------------------------------------------------------------------------------
void process_component(const XmlElement& xf, const Components& components, const int depth, ostream& outf)
{
	string name;
	xf.GetAttr("name", name);
	Components::const_iterator citr(components.find(name));
	if (citr == components.end())
	{
		cerr << shortName << ':' << recover_line(xf) << ": error: Could not find component " << name << endl;
		++glob_errors;
	}
	else
		for(XmlElement::XmlSet::const_iterator itr(citr->second->begin()); itr != citr->second->end(); ++itr)
			process_elements(itr, components, depth, outf);
}
开发者ID:mattyv,项目名称:fix8,代码行数:15,代码来源:f8precomp.cpp

示例12: testAdd

void ComponentsUnitTests::testAdd()
{
    Components components;
    ComponentPtr component1(new CmdComponent());
    component1->id = DVLib::GenerateGUIDStringW();
    ComponentPtr component2(new CmdComponent());
    component2->id = DVLib::GenerateGUIDStringW();
    components.add(component1);
    components.add(component2);
    Assert::IsTrue(components.size() == 2);
    Assert::IsTrue(components.contains(component1->id));
    Assert::IsTrue(components.contains(component2->id));
    Assert::IsTrue(! components.contains(DVLib::GenerateGUIDStringW()));
}
开发者ID:dblock,项目名称:dotnetinstaller,代码行数:14,代码来源:ComponentsUnitTests.cpp

示例13: testExecWithError

void ComponentsUnitTests::testExecWithError()
{
    Components components;
    CmdComponent * component1 = new CmdComponent();
    component1->id = DVLib::GenerateGUIDStringW();
    component1->command = L"foobar.exe";
    components.add(ComponentPtr(component1));
    ExecuteComponentCallbackImpl callback;
    components.Exec(& callback);
    Assert::IsTrue(1 == callback.starts);
    Assert::IsTrue(1 == callback.begins);
    Assert::IsTrue(0 == callback.waits);
    Assert::IsTrue(0 == callback.successes);
    Assert::IsTrue(1 == callback.errors);
}
开发者ID:dblock,项目名称:dotnetinstaller,代码行数:15,代码来源:ComponentsUnitTests.cpp

示例14:

poison::Components poison::DefaultEntityManager::getComponentsForEntity(Entity* entity) {
    ComponentsIndex::index<Component::byEntityIdTag>::type::iterator first, last;
    boost::tuples::tie(first, last) = componentsContainer_.get<Component::byEntityIdTag>().equal_range(entity->getId());
    Components components;
    
    if (first != componentsContainer_.get<Component::byEntityIdTag>().end()) {
        
        auto size = std::distance(first, last);
        components.reserve(size);
        for (auto it = first; it != last; ++it) {
            components.push_back( (*it).get() );
        }
    }
    
    return components;
}
开发者ID:JohnPoison,项目名称:ComponentsSystem,代码行数:16,代码来源:DefaultEntityManager.cpp

示例15: addToComponents

void CompositeChar::addToComponents (Components &components, HorMetric &hm, UShort totalAdvance) {
    // Current "pen" position is hm.advanceWidth
    ComponentPtr c;
    GlyphPtr glyph = font.getGlyph (glyphId);
    if (!glyph->isEmpty()) {
        CompositeComponent::Flags flags;
        if (totalAdvance && totalAdvance == advance && position.x == 0) {
            flags = CompositeComponent::Flags (
                        CompositeComponent::cfRoundXYToGrid | CompositeComponent::cfUseMyMetrics);
        } else
            flags = CompositeComponent::cfRoundXYToGrid;

        CompositeComponent::Scale scale;// = {0x4000, 0, 0, 0x4000};
        scale.xx = scale.yy = 1;
        scale.xy = scale.yx = 0;
        if (thisAttachPoint == 0xFFFF) {
            CompositeComponent::Translation translation = {hm.advanceWidth -
                                                           glyph->getDisplacement() + position.x, position.y
                                                          };
            c = new PositionedCompositeComponent (font, glyphId, flags,
                                                  scale, translation);
        } else {
            c = new AttachedCompositeComponent (font, glyphId, flags,
                                                scale, baseAttachPoint, thisAttachPoint);
        }
        components.push_back (c);
    }
    hm.advanceWidth += advance;
}
开发者ID:kennytm,项目名称:tticomp,代码行数:29,代码来源:CompositeOTText.cpp


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