void CSkyBox::Initialize(LPDIRECT3DDEVICE9 pDevice, float fWidth, float fRotSpeed, D3DXVECTOR3 vecPos) { m_pDevice = pDevice; m_fRotateSpeed = fRotSpeed; SetXScale(fWidth); SetYScale(fWidth); SetZScale(fWidth); SetXPosition(vecPos.x); SetYPosition(vecPos.y); SetZPosition(vecPos.z); SKYBOXVERTEX skyboxVertex[] = { {0.5f, -0.5f, 0.5f, 0.0f, 1.0f}, //Right {0.5f, 0.5f, 0.5f, 0.0f, 0.0f}, {0.5f, -0.5f, -0.5f, 1.0f, 1.0f}, {0.5f, 0.5f, -0.5f, 1.0f, 0.0f}, {0.5f, -0.5f, -0.5f, 0.0f, 1.0f}, //Back {0.5f, 0.5f, -0.5f, 0.0f, 0.0f}, {-0.5f, -0.5f, -0.5f, 1.0f, 1.0f}, {-0.5f, 0.5f, -0.5f, 1.0f, 0.0f}, {-0.5f, -0.5f, -0.5f, 0.0f, 1.0f}, //Left {-0.5f, 0.5f, -0.5f, 0.0f, 0.0f}, {-0.5f, -0.5f, 0.5f, 1.0f, 1.0f}, {-0.5f, 0.5f, 0.5f, 1.0f, 0.0f}, {-0.5f, -0.5f, 0.5f, 0.0f, 1.0f}, //Front {-0.5f, 0.5f, 0.5f, 0.0f, 0.0f}, {0.5f, -0.5f, 0.5f, 1.0f, 1.0f}, {0.5f, 0.5f, 0.5f, 1.0f, 0.0f}, {0.5f, 0.5f, 0.5f, 0.0f, 0.0f}, //up {-0.5f, 0.5f, 0.5f, 1.0f, 0.0f}, {0.5f, 0.5f, -0.5f, 0.0f, 1.0f}, {-0.5f, 0.5f, -0.5f, 1.0f, 1.0f}, {-0.5f, -0.5f, 0.5f, 0.0f, 0.0f}, //down {0.5f, -0.5f, 0.5f, 0.0f, 1.0f}, {-0.5f, -0.5f, -0.5f, 1.0f, 0.0f}, {0.5f, -0.5f, -0.5f, 1.0f, 1.0f}, }; m_pDevice->CreateVertexBuffer(sizeof(skyboxVertex), 0, D3DFVF_SKYBOX, D3DPOOL_MANAGED, &m_pVertexBuffer,NULL); void * pVertices; m_pVertexBuffer->Lock(0, 0, &pVertices, 0); memcpy(pVertices,(void *)skyboxVertex,sizeof(skyboxVertex)); m_pVertexBuffer->Unlock(); }
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Summary: Renders the terrain. Parameters: [in] pDevice - D3D Device * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ void CArrow::Render( LPDIRECT3DDEVICE9 pDevice ) { SetZPosition(pos[0] * 0.5f); SetXPosition(pos[1] * 0.5f); SetYPosition(pos[2] * 0.01f); RotateAbs(-pos[4], pos[5], -pos[3]); pDevice->SetTransform( D3DTS_WORLD, GetTransform() ); pDevice->SetStreamSource( 0, m_vb, 0, sizeof(Vertex) ); pDevice->SetFVF( D3DFVF_XYZ | D3DFVF_DIFFUSE ); pDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, 6 ); }
CTestPlayer::CTestPlayer( std::string spriteName/* = "naruto"*/, std::string playerName/* = "noname"*/, float startPosX/* = 0.0F*/, float startPosY/* = 0.0F*/, float runForce/* = 250.0F*/, float jumpForce/* = 450.0F*/, int playerHP/* = 100*/, int playerDMG/* = 10*/) : log("TestPlayer", CXmlSettings::Inst()->GetLoggerSettings()->logLevel), CBaseCharacter(spriteName) { CMovable::SetXVelocity(0); CMovable::SetYVelocity(0); CMovable::SetXForce(runForce); CMovable::SetYForce(jumpForce); SetXPosition(200); SetYPosition(200); }