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


C++ csRef类代码示例

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


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

示例1: FillWithColliderGeometry

    void csBulletCollider::FillWithColliderGeometry (
        csRef<iGeneralFactoryState> genmesh_fact)
    {
        // @@@ TODO
#if 0
        switch (geomType)
        {
        case BOX_COLLIDER_GEOMETRY:
        {
            SimdTransform trans;
            SimdVector3 max;
            SimdVector3 min;
            BoxShape*  b = (BoxShape*)pc->GetRigidBody ()->GetCollisionShape ();

            csBox3 box;
            for (int i = 0; i < b->GetNumVertices (); i++)
            {
                SimdVector3 vtx;
                b->GetVertex (i, vtx);
                box.AddBoundingVertexTest (csVector3 (vtx[0], vtx[1], vtx[2]));
            }
            genmesh_fact->GenerateBox (box);
            genmesh_fact->CalculateNormals ();
        }
        break;
        default:
            break;
        }
#endif
    }
开发者ID:yushiming,项目名称:CS,代码行数:30,代码来源:colliders.cpp

示例2: csTinyDocumentSystem

csPtr<iString> AssetManager::LoadDocument (iObjectRegistry* object_reg,
    csRef<iDocument>& doc,
    const char* vfspath, const char* file)
{
  doc.Invalidate ();
  csRef<iVFS> vfs = csQueryRegistry<iVFS> (object_reg);
  if (vfspath) vfs->PushDir (vfspath);

  csRef<iDataBuffer> buf = vfs->ReadFile (file);
  if (vfspath) vfs->PopDir ();
  if (!buf)
    return 0;	// No error, just a non-existing file.

  csRef<iDocumentSystem> docsys;
  docsys = csQueryRegistry<iDocumentSystem> (object_reg);
  if (!docsys)
    docsys.AttachNew (new csTinyDocumentSystem ());

  doc = docsys->CreateDocument ();
  const char* error = doc->Parse (buf->GetData ());
  if (error)
  {
    scfString* msg = new scfString ();;
    msg->Format ("Can't parse '%s': %s", file, error);
    doc.Invalidate ();
    return msg;
  }

  return 0;
}
开发者ID:Dracophoenix1,项目名称:ares,代码行数:30,代码来源:assetmanager.cpp

示例3: scfImplementationType

pawsFrameDrawable::pawsFrameDrawable(csRef<iDocumentNode> node)
    : scfImplementationType (this)
{
    defaultTransparentColourBlue  = -1;
    defaultTransparentColourGreen = -1;
    defaultTransparentColourRed   = -1;

    defaultAlphaValue = 0;

    // Read off the image and file vars
    imageFileLocation = node->GetAttributeValue("file");
    resourceName = node->GetAttributeValue("resource");

    csString typeStr(node->GetAttributeValue("type"));
    type = FDT_FULL;
    if (typeStr == "horizontal")
        type = FDT_HORIZONTAL;
    else if (typeStr == "vertical")
        type = FDT_VERTICAL;

    csRef<iDocumentNodeIterator> iter = node->GetNodes();
    while ( iter->HasNext() )
    {
        csRef<iDocumentNode> childNode = iter->Next();

        // Read the default alpha value.
        if (strcmp(childNode->GetValue(), "alpha") == 0)
            defaultAlphaValue = childNode->GetAttributeValueAsInt("level");

        // Read the default transparent colour.
        else if (strcmp(childNode->GetValue(), "trans") == 0)
        {
            defaultTransparentColourRed   = childNode->GetAttributeValueAsInt("r");
            defaultTransparentColourGreen = childNode->GetAttributeValueAsInt("g");
            defaultTransparentColourBlue  = childNode->GetAttributeValueAsInt("b");
        }

        else if (strcmp(childNode->GetValue(), "top_left") == 0)
            LoadPiece(childNode, FDP_TOP_LEFT);
        else if (strcmp(childNode->GetValue(), "top") == 0)
            LoadPiece(childNode, FDP_TOP);
        else if (strcmp(childNode->GetValue(), "top_right") == 0)
            LoadPiece(childNode, FDP_TOP_RIGHT);
        else if (strcmp(childNode->GetValue(), "left") == 0)
            LoadPiece(childNode, FDP_LEFT);
        else if (strcmp(childNode->GetValue(), "middle") == 0)
            LoadPiece(childNode, FDP_MIDDLE);
        else if (strcmp(childNode->GetValue(), "right") == 0)
            LoadPiece(childNode, FDP_RIGHT);
        else if (strcmp(childNode->GetValue(), "bottom_left") == 0)
            LoadPiece(childNode, FDP_BOTTOM_LEFT);
        else if (strcmp(childNode->GetValue(), "bottom") == 0)
            LoadPiece(childNode, FDP_BOTTOM);
        else if (strcmp(childNode->GetValue(), "bottom_right") == 0)
            LoadPiece(childNode, FDP_BOTTOM_RIGHT);
    }

}
开发者ID:garinh,项目名称:planeshift,代码行数:58,代码来源:pawsframedrawable.cpp

示例4: AddBatch

void csTextureList::AddBatch (csRef<iTextureLoaderIterator> itr, bool precache)
{
  CS::Threading::ScopedWriteLock lock(texLock);
  while(itr->HasNext())
  {
    iTextureWrapper* tex = itr->Next();
    Push(tex);
    if(precache && tex->GetTextureHandle())
    {
      tex->GetTextureHandle()->Precache();
    }
  }
}
开发者ID:garinh,项目名称:cs,代码行数:13,代码来源:texture.cpp

示例5: CopyXMLNode

void CopyXMLNode(csRef<iDocumentNode> source, csRef<iDocumentNode> target, int mode)
{
    if (mode == 0)
    {
        target->RemoveNodes();
        target->RemoveAttributes();
    }
    
    // copy nodes
    csRef<iDocumentNodeIterator> nodeIter = source->GetNodes();
    while (nodeIter->HasNext())
    {
        csRef<iDocumentNode> child = nodeIter->Next();
        csRef<iDocumentNode> targetChild = target->GetNode(child->GetValue());
        if (targetChild==NULL || mode==3)  // Mode 3 means don't merge tags but just insert multiples, so we create a new one here every time
        {
            targetChild = target->CreateNodeBefore(child->GetType());
            if (targetChild == NULL)
                assert(!"failed to create XML node, you are probably using wrong XML parser (xmlread instead of xmltiny)");
            targetChild->SetValue(child->GetValue());
        }
        CopyXMLNode(child, targetChild, mode);
    }
    
    // copy attributes
    csRef <iDocumentAttributeIterator> attrIter = source->GetAttributes();
    while (attrIter->HasNext())
    {
        csRef<iDocumentAttribute> attr = attrIter->Next();
        const char* attrName = attr->GetName();
        if (mode==1  ||  !target->GetAttribute(attrName))
            target->SetAttribute(attrName, attr->GetValue());
    }
}
开发者ID:Chettie,项目名称:Eulora-client,代码行数:34,代码来源:psxmlparser.cpp

示例6: AddBatch

void csMeshList::AddBatch (csRef<iMeshLoaderIterator> itr)
{
  CS::Threading::ScopedWriteLock lock(meshLock);
  while(itr->HasNext())
  {
    iMeshWrapper* obj = itr->Next();
    PrepareMesh (obj);
    const char* name = obj->QueryObject ()->GetName ();
    if (name)
      meshes_hash.Put (name, obj);
    obj->QueryObject ()->AddNameChangeListener (listener);
    list.Push (obj);
  }
}
开发者ID:garinh,项目名称:cs,代码行数:14,代码来源:meshobj.cpp

示例7: CS_ASSERT

void psCharAppearance::ProcessAttach(csRef<iMeshWrapper> meshWrap, csRef<iSpriteCal3DSocket> socket)
{
    if(!socket.IsValid())
        return;
    CS_ASSERT(socket.IsValid());
    
    meshWrap->GetFlags().Set(CS_ENTITY_NODECAL);
    const char* socketName = socket->GetName();

    // Given a socket name of "righthand", we're looking for a key in the form of "socket_righthand"
    csString keyName = "socket_";
    keyName += socketName;

    // Variables for transform to be specified
    float trans_x = 0, trans_y = 0.0, trans_z = 0, rot_x = -PI/2, rot_y = 0, rot_z = 0;
    csRef<iObjectIterator> it = meshWrap->GetFactory()->QueryObject()->GetIterator();

    while ( it->HasNext() )
    {
        csRef<iKeyValuePair> key ( scfQueryInterface<iKeyValuePair> (it->Next()));
        if (key && keyName == key->GetKey())
        {
            sscanf(key->GetValue(),"%f,%f,%f,%f,%f,%f",&trans_x,&trans_y,&trans_z,&rot_x,&rot_y,&rot_z);
        }
    }

    meshWrap->QuerySceneNode()->SetParent( baseMesh->QuerySceneNode ());
    socket->SetMeshWrapper( meshWrap );
    socket->SetTransform( csTransform(csZRotMatrix3(rot_z)*csYRotMatrix3(rot_y)*csXRotMatrix3(rot_x), csVector3(trans_x,trans_y,trans_z)) );

    usedSlots.PushSmart(socketName);
}
开发者ID:garinh,项目名称:planeshift,代码行数:32,代码来源:charapp.cpp

示例8: scfImplementationType

pawsImageDrawable::pawsImageDrawable(csRef<iDocumentNode> node)
                 : scfImplementationType (this)
{
    debugImageErrors = true;
    defaultTransparentColourBlue  = -1;
    defaultTransparentColourGreen = -1;
    defaultTransparentColourRed   = -1;

    defaultAlphaValue = 0;

    // Read off the image and file vars
    imageFileLocation = node->GetAttributeValue( "file" );
    resourceName = node->GetAttributeValue( "resource" );

    tiled = node->GetAttributeValueAsBool("tiled");

    csRef<iDocumentNodeIterator> iter = node->GetNodes();
    while ( iter->HasNext() )
    {
        csRef<iDocumentNode> childNode = iter->Next();       

        // Read the texture rectangle for this image.
        if ( strcmp( childNode->GetValue(), "texturerect" ) == 0 )
        {
            textureRectangle.xmin = childNode->GetAttributeValueAsInt("x");
            textureRectangle.ymin = childNode->GetAttributeValueAsInt("y");

            int width = childNode->GetAttributeValueAsInt("width");
            int height = childNode->GetAttributeValueAsInt("height");

            textureRectangle.SetSize(width, height);
        }

        // Read the default alpha value.
        if ( strcmp( childNode->GetValue(), "alpha" ) == 0 )
        {
            defaultAlphaValue = childNode->GetAttributeValueAsInt("level");            
        }

        // Read the default transparent colour.
        if ( strcmp( childNode->GetValue(), "trans" ) == 0 )
        {
            defaultTransparentColourRed   = childNode->GetAttributeValueAsInt("r");            
            defaultTransparentColourGreen = childNode->GetAttributeValueAsInt("g");            
            defaultTransparentColourBlue  = childNode->GetAttributeValueAsInt("b");                                    
        }
    }

    PreparePixmap();
}
开发者ID:garinh,项目名称:planeshift,代码行数:50,代码来源:pawsimagedrawable.cpp

示例9: GetTiNodeChildren

void csTinyXmlNode::RemoveNodes (csRef<iDocumentNodeIterator> children)
{
  if ((node->Type() != TiDocumentNode::ELEMENT)
    && (node->Type() != TiDocumentNode::DOCUMENT)) return;
  TiDocumentNodeChildren* node_children = GetTiNodeChildren ();

  while (children->HasNext ())
  {
    csRef<iDocumentNode> n = children->Next ();
    csTinyXmlNode* tiNode = static_cast<csTinyXmlNode*>((iDocumentNode*)n);
    node_children->RemoveChild (tiNode->GetTiNode ());
  }
  lastChild = 0;
}
开发者ID:GameLemur,项目名称:Crystal-Space,代码行数:14,代码来源:xmltiny.cpp

示例10: PlaySound

bool PawsManager::PlaySound(csRef<iSndSysData> sounddata)
{
    if(!useSounds)
        return true;

    // If there is no sound loader or renderer, sound loading and playing will not be performed
    if (!sounddata.IsValid() || !soundrenderer.IsValid() )
        return false;

    // Create a stream for this sound
    csRef<iSndSysStream> sndstream=soundrenderer->CreateStream(sounddata,CS_SND3D_DISABLE);
    if (!sndstream.IsValid())
      return false;

    // This stream should unregister (and all sources) automatically when it's done playing
    sndstream->SetAutoUnregister(true);

    // Create a source just for this sound.
    csRef<iSndSysSource> source=soundrenderer->CreateSource(sndstream);
    if (!source.IsValid())
    {
      soundrenderer->RemoveStream(sndstream);
      return false;
    }

      source->SetVolume(volume);
    sndstream->Unpause();

    // Although we lose the reference, the CS sound renderer holds a reference to the source until playback is complete
    return true;
}
开发者ID:garinh,项目名称:planeshift,代码行数:31,代码来源:pawsmanager.cpp

示例11: csScanPluginDirs

csRef<iStringArray> csScanPluginDirs (csPathsList* dirs, 
				    csRef<iStringArray>& plugins)
{
  iStringArray* messages = 0;

  if (!plugins)
    plugins.AttachNew (new scfStringArray ());

  for (size_t i = 0; i < dirs->Length (); i++)
  {
    iStringArray* dirMessages = 0;
    InternalScanPluginDir (dirMessages, (*dirs)[i].path, plugins, 
      (*dirs)[i].scanRecursive);
    
    if (dirMessages != 0)
    {
      csString tmp;
      tmp.Format ("The following error(s) occured while scanning '%s':",
	(*dirs)[i].path.GetDataSafe ());

      AppendStrVecString (messages, tmp);

      for (size_t i = 0; i < dirMessages->GetSize(); i++)
      {
	tmp.Format (" %s", dirMessages->Get (i));
	AppendStrVecString (messages, tmp);
      }
      dirMessages->DecRef();
    }
  }
	 
  return csPtr<iStringArray> (messages);
}
开发者ID:garinh,项目名称:cs,代码行数:33,代码来源:scanplugins.cpp

示例12: UpdateInstancingParams

static void UpdateInstancingParams (bool allDataDirty,
                                    const DataArray& array,
                                    csRef<iRenderBuffer>& buffer,
                                    csShaderVariable* sv)
{
  bool updateData = allDataDirty;
  if (!buffer
    || (buffer->GetElementCount() != array.Capacity()))
  {
    buffer = csRenderBuffer::CreateRenderBuffer (array.Capacity(),
                                                 CS_BUF_STREAM, CS_BUFCOMP_FLOAT,
                                                 sizeof (typename DataArray::ValueType) / sizeof(float));
    sv->SetValue (buffer);
    updateData = true;
  }
  if (updateData) buffer->SetData (array.GetArray());
}
开发者ID:Tank-D,项目名称:Shards,代码行数:17,代码来源:meshgen.cpp

示例13: SendStatDRMessage

bool psServerVitals::SendStatDRMessage(uint32_t clientnum, EID eid, int flags, csRef<PlayerGroup> group)
{
    bool backup=0;
    if (flags)
    {
        backup = statsDirty ? true : false;
        statsDirty = flags;
    }
    else if (version % 10 == 0)  // every 10th msg to this person, send everything
        statsDirty = DIRTY_VITAL_ALL;

    if (!statsDirty)
        return false;

    csArray<float> fVitals;
    csArray<uint32_t> uiVitals;

    if (statsDirty & DIRTY_VITAL_HP)
        fVitals.Push(PERCENT_VALUE(VITAL_HITPOINTS));

    if (statsDirty & DIRTY_VITAL_HP_RATE)
        fVitals.Push(PERCENT_RATE(VITAL_HITPOINTS));

    if (statsDirty & DIRTY_VITAL_MANA)
        fVitals.Push(PERCENT_VALUE(VITAL_MANA));

    if (statsDirty & DIRTY_VITAL_MANA_RATE)
        fVitals.Push(PERCENT_RATE(VITAL_MANA));

    // Physical Stamina
    if (statsDirty & DIRTY_VITAL_PYSSTAMINA)
        fVitals.Push(PERCENT_VALUE(VITAL_PYSSTAMINA));

    if (statsDirty & DIRTY_VITAL_PYSSTAMINA_RATE)
        fVitals.Push(PERCENT_RATE(VITAL_PYSSTAMINA));

    // Mental Stamina
    if (statsDirty & DIRTY_VITAL_MENSTAMINA)
        fVitals.Push(PERCENT_VALUE(VITAL_MENSTAMINA));

    if (statsDirty & DIRTY_VITAL_MENSTAMINA_RATE)
        fVitals.Push(PERCENT_RATE(VITAL_MENSTAMINA));

    if (statsDirty & DIRTY_VITAL_EXPERIENCE)
        uiVitals.Push(GetExp());

    if (statsDirty & DIRTY_VITAL_PROGRESSION)
        uiVitals.Push(GetPP());

    psStatDRMessage msg(clientnum, eid, fVitals, uiVitals, ++version, statsDirty);
    if (group == NULL)
        msg.SendMessage();
    else
        group->Broadcast(msg.msg);

    statsDirty = backup;
    return true;
}
开发者ID:garinh,项目名称:planeshift,代码行数:58,代码来源:servervitals.cpp

示例14: GetNodeXML

csString GetNodeXML(csRef<iDocumentNode> node, bool childrenOnly)
{
    psString xml;
    csRef<iDocumentNodeIterator> nodes;
    csRef<iDocumentAttributeIterator> attrs;
    
    if (!childrenOnly)
        xml.Format("<%s", node->GetValue());
    
    attrs = node->GetAttributes();
    while (attrs->HasNext())
    {
        csRef<iDocumentAttribute> attr = attrs->Next();
    csString escpxml = EscpXML(attr->GetValue());
        xml.AppendFmt(" %s=\"%s\"", attr->GetName(), escpxml.GetData() );
    }
    if (!childrenOnly)
        xml += ">";
    

    nodes = node->GetNodes();
    if (nodes->HasNext())
    {
        while (nodes->HasNext())
        {
            csRef<iDocumentNode> child = nodes->Next();
            if (child->GetType() == CS_NODE_TEXT)
            {
                // add the node-content to the string..but escape special XML chars in it
                xml += EscpXML(child->GetContentsValue());
            }
            else
            {
                xml += GetNodeXML(child);
            }
        }
    }
    if (!childrenOnly)
    {
        // add the node-content to the string..but escape special XML chars in it
        xml += EscpXML(node->GetContentsValue());
        xml.AppendFmt("</%s>", node->GetValue());
    }
    return xml;
}
开发者ID:Chettie,项目名称:Eulora-client,代码行数:45,代码来源:psxmlparser.cpp

示例15: SetFont

void G2DTestSystemDriver::BlitTest ()
{
  int w = myG2D->GetWidth ();
  int h = myG2D->GetHeight ();
  myG2D->SetClipRect(0,0,w,h);
  myG2D->DrawBox(0,0,w,h, dsteel);
  
  SetFont (fontItalic);
  WriteCentered (0,-16*8, white, -1, "BLIT() TEST");

  SetFont (fontLarge);
  WriteCentered (0,-16*7, black, dsteel, "This will test whether iGraphics2D->Blit() works correctly");
  WriteCentered (0,-16*6, black, dsteel, "on this canvas.");

  WriteCentered (0,-16*4, black, dsteel, "You should see an image of an arrow and the word %s.",
		 CS::Quote::Double ("up"));
  WriteCentered (0,-16*3, black, dsteel, "It is surrounded by a green rectangle, and the image");
  WriteCentered (0,-16*2, black, dsteel, "itself has a black border. No red should be visible");
  WriteCentered (0,-16*1, black, dsteel, "and the border has to be complete, too.");

  if (blitTestImage.IsValid ())
  {
    const int imW = blitTestImage->GetWidth ();
    const int imH = blitTestImage->GetHeight ();
    const int bx = (w - imW) / 2;
    const int by = h / 2;
    DrawClipRect (bx, by, imW + 1, imH + 1);
    myG2D->Blit (bx + 1, by + 1, imW, imH, 
      (unsigned char*)blitTestImage->GetImageData ());
  }
}
开发者ID:crystalspace,项目名称:CS,代码行数:31,代码来源:g2dtest.cpp


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