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


C++ PlayerEntity::SetPosition方法代码示例

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


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

示例1: main

int main(int argc, char *argv[])
{
    srand ( time(NULL) );
    int running = GL_TRUE;
    int mousebtn, lastmousebtn;

    //Did the init not succeed?
    if(!SceneHandler::Init())
    {
        //quit.
        return 0;
    }

    Light *moon = SceneHandler::CreateLight();
    moon->setPosition(-2000.0,0.0,1000.0);
    moon->setDiffuse(0.3,0.3,0.4);
    moon->setAmbient(0.2,0.2,0.3);
    moon->setSpecular(1.0,1.0,1.0);
    moon->setRadius(20000.0);

    int numLights=4;

    Light *lights[numLights];
    ParticleSystem *ps[numLights];

    ps[0] = SceneHandler::CreateParticleSystem();
    ps[0]->SetPosition(-307.0,-10.0,90.0);
    ps[0]->scale = 2.0;

    lights[0] = SceneHandler::CreateLight();
    lights[0]->setPosition(-307.0,-10.0,90.0);
    lights[0]->setDiffuse(1.0,1.0,0.8);
    lights[0]->setAmbient(0.1,0.1,0.1);
    lights[0]->setSpecular(1.0,1.0,1.0);
    lights[0]->setRadius(200.0);

    ps[1] = SceneHandler::CreateParticleSystem();
    ps[1]->SetPosition(-307.0,-188.0,90.0);
    ps[1]->scale = 2.0;

    lights[1] = SceneHandler::CreateLight();
    lights[1]->setPosition(-307.0,-188.0,90.0);
    lights[1]->setDiffuse(1.0,1.0,0.8);
    lights[1]->setAmbient(0.1,0.1,0.1);
    lights[1]->setSpecular(1.0,1.0,1.0);
    lights[1]->setRadius(200.0);

    ps[2] = SceneHandler::CreateParticleSystem();
    ps[2]->SetPosition(178.0,-45.0,64.0);
    ps[2]->scale = 2.0;

    lights[2] = SceneHandler::CreateLight();
    lights[2]->setPosition(178.0,-45.0,64.0);
    lights[2]->setDiffuse(1.0,1.0,0.8);
    lights[2]->setAmbient(0.1,0.1,0.1);
    lights[2]->setSpecular(1.0,1.0,1.0);
    lights[2]->setRadius(200.0);

    ps[3] = SceneHandler::CreateParticleSystem();
    ps[3]->SetPosition(178.0,-131.0,64.0);
    ps[3]->scale = 2.0;

    lights[3] = SceneHandler::CreateLight();
    lights[3]->setPosition(178.0,-131.0,64.0);
    lights[3]->setDiffuse(1.0,1.0,0.8);
    lights[3]->setAmbient(0.1,0.1,0.1);
    lights[3]->setSpecular(1.0,1.0,1.0);
    lights[3]->setRadius(200.0);

    mousebtn = lastmousebtn = GLFW_RELEASE;

    Camera camera;
    camera.setDirection(90.0,0.0,0.0);
    camera.setPosition(0.0,0.0,100.0);

    PlayerEntity *player;

    player = SceneHandler::CreatePlayerEntity();
    player->SetPosition(-400.0,-100.0,50.0);
    player->minBox=glm::vec4(-12.0,-12.0,-30.0,1.0f);
    player->maxBox=glm::vec4(12.0,12.0,30.0,1.0f);
    player->eyeHeight=25.0;

    PlayerEntity::SetCamera(&camera);

    StaticEntity *scene;
    StaticEntity *beast;
    StaticEntity *box;

    scene = SceneHandler::CreateStaticEntity("media/ny.ase",1.0);
    beast = SceneHandler::CreateStaticEntity("media/beast/beast1.ase",0.5);
    box = SceneHandler::CreateStaticEntity("media/box/box.ase",1.0);

    MD5Model *bob;

    bob = SceneHandler::CreateMD5Entity("models/monsters/hellknight/hellknight.md5mesh","models/monsters/hellknight/idle2.md5anim");
    bob->scale=0.7;
    bob->SetPosition(300.0,100.0,0.0);
	bob->SetRotation(0.0,0.0,-90.0);

//.........这里部分代码省略.........
开发者ID:scanberg,项目名称:engine,代码行数:101,代码来源:main.cpp


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