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


C++ MovingObject::SetTexScale方法代码示例

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


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

示例1: loadRoom


//.........这里部分代码省略.........

            if (strcmp(placement, "wall") == 0)
            {
                tempWall->xLength *= 0.1f;
            }
        }
        if (strcmp(dir, "left") == 0)
        {
            if (strcmp(placement, "") == 0)
            {
                tempWall->centerX += 0.4f;
                tempWall->xRotation = -3.14f / 2.0f;
            }

            if (strcmp(placement, "wall") == 0)
            {
                tempWall->xLength *= 0.1f;
                //tempWall->yLength = 1.0f;
            }
        }

        tempWall->centerY = tempWall->centerY + tempWall->yLength / 2;

        crestVector.push_back(tempWall);
    }

    // Create walls and add to GameObject vector
    for (unsigned int i = 0; i < wallRowCol.size(); i++)
    {
        for (unsigned int j = 0; j < wallRowCol[i].size(); j++)
        {
            GameObject* wallObj = new GameObject("Cube", wallRowCol[i][j]->texture, physicsMan->createRigidBody("Cube", wallRowCol[i][j]->centerX + xPos, wallRowCol[i][j]->yLength / 2 + wallRowCol[i][j]->centerY, wallRowCol[i][j]->centerZ + zPos), physicsMan, WORLD);
            wallObj->scale(wallRowCol[i][j]->xLength, wallRowCol[i][j]->yLength, wallRowCol[i][j]->zLength);
            wallObj->SetTexScale(max(wallRowCol[i][j]->xLength, wallRowCol[i][j]->zLength), wallRowCol[i][j]->yLength, 0.0f, 1.0f);
            gameObjs.push_back(wallObj);
        }
    }

    for (unsigned int i = 0; i < floorVector.size(); i++)
    {
        GameObject* floorObj = new GameObject("Cube", floorVector[i]->texture, physicsMan->createRigidBody("Cube", floorVector[i]->centerX + xPos, floorVector[i]->centerY - 0.5f, floorVector[i]->centerZ + zPos), physicsMan, WORLD);
        floorObj->scale(floorVector[i]->xLength, 1.0f, floorVector[i]->zLength);
        floorObj->SetTexScale(floorVector[i]->xLength, floorVector[i]->zLength, 0.0f, 1.0f);
        gameObjs.push_back(floorObj);
    }

    for (unsigned int i = 0; i < cubeVector.size(); i++)
    {
        MovingObject* cubeObj = new MovingObject("Cube", cubeVector[i]->texture, physicsMan->createRigidBody("Cube", cubeVector[i]->centerX + xPos, cubeVector[i]->centerY + cubeVector[i]->yLength / 2, cubeVector[i]->centerZ + zPos), physicsMan);
        cubeObj->scale(cubeVector[i]->xLength, cubeVector[i]->yLength, cubeVector[i]->zLength);
        cubeObj->SetTexScale(cubeVector[i]->xLength, cubeVector[i]->zLength, 0.0f, 1.0f);
        cubeObj->AddPosition(XMFLOAT3(cubeVector[i]->centerX + xPos, cubeVector[i]->centerY + cubeVector[i]->yLength / 2, cubeVector[i]->centerZ + zPos));
        cubeObj->AddPosition(XMFLOAT3(cubeVector[i]->centerX + xPos + cubeVector[i]->translateX, cubeVector[i]->centerY + (cubeVector[i]->yLength / 2) + cubeVector[i]->translateY, cubeVector[i]->centerZ + zPos + cubeVector[i]->translateZ));

        float rowId = cubeVector[i]->row - mapOffsetZ;
        float colId = cubeVector[i]->col - mapOffsetX;

        char rowChar[30];
        char colChar[30];

        itoa((int)rowId, rowChar, 10);
        itoa((int)colId, colChar, 10);

        strcat(rowChar, "|");
        strcat(rowChar, colChar);
开发者ID:JonathanPalmerGD,项目名称:PVGame,代码行数:66,代码来源:Room.cpp


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