Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 |
D3DXMATRIX matView; Bewegen(0.05f, matView); D3DXMATRIX matProjection; D3DXMatrixPerspectiveFovLH(&matProjection, D3DXToRadian(45), (FLOAT)fnk_Width(0, 'N') / (FLOAT)fnk_Height(0, 'n'), 0.0f, 0.0f); d3ddev->SetTransform(D3DTS_PROJECTION, &matProjection); |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
void Bewegen(float geschwindigkeit, D3DXMATRIX mView) { if(keystate[DIK_A]) { D3DXMatrixLookAtLH(&mView, &D3DXVECTOR3 (-geschwindigkeit, 0.0f, 0.0f), &D3DXVECTOR3 (0.0f, 0.0f, 0.0f), &D3DXVECTOR3 (0.0f, 1.0f, 0.0f)); d3ddev->SetTransform(D3DTS_VIEW, &mView); } else if(keystate[DIK_W]) { D3DXMatrixTranslation(&mView, 0.0f, 0.0f, geschwindigkeit); // dachte es liegt an der D3DXMatrixLookAtLH Funktion d3ddev->SetTransform(D3DTS_VIEW, &mView); } else if(keystate[DIK_S]) { D3DXMatrixLookAtLH(&mView, &D3DXVECTOR3 (0.0f, 0.0f, -geschwindigkeit), &D3DXVECTOR3 (0.0f, 0.0f, 0.0f), &D3DXVECTOR3 (0.0f, 1.0f, 0.0f)); d3ddev->SetTransform(D3DTS_VIEW, &mView); } else if(keystate[DIK_D]) { D3DXMatrixLookAtLH(&mView, &D3DXVECTOR3 (geschwindigkeit, 0.0f, 0.0f), &D3DXVECTOR3 (0.0f, 0.0f, 0.0f), &D3DXVECTOR3 (0.0f, 1.0f, 0.0f)); d3ddev->SetTransform(D3DTS_VIEW, &mView); } } |
C-/C++-Quelltext |
|
1 2 |
D3DXMATRIX matView; D3DXMatrixIdentity ( matView ); |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
void Bewegen(float geschwindigkeit, D3DXMATRIX m_TransMatrix, D3DXMATRIX matView) { D3DXMatrixIdentity(&matView); if(keystate[DIK_A]) { D3DXMatrixTranslation(&m_TransMatrix, -geschwindigkeit, position.y, position.z); } else if(keystate[DIK_W]) { D3DXMatrixTranslation(&m_TransMatrix, position.x, position.y, geschwindigkeit); } else if(keystate[DIK_S]) { D3DXMatrixTranslation(&m_TransMatrix, position.x, position.y, -geschwindigkeit); } else if(keystate[DIK_D]) { D3DXMatrixTranslation(&m_TransMatrix, geschwindigkeit, position.y, position.z); } D3DXMatrixMultiply(&matView, &matView, &m_TransMatrix); D3DXMatrixLookAtLH(&matView, &position, &lookat, &up); d3ddev->SetTransform(D3DTS_VIEW, &matView); } |
Werbeanzeige