Click here to Skip to main content
14,243,524 members

Managed C++/CLI

 
GeneralRe: AES code implementation in C++ Pin
Member 122163806-Jun-16 2:33
memberMember 122163806-Jun-16 2:33 
GeneralRe: AES code implementation in C++ Pin
Jochen Arndt6-Jun-16 2:42
mveJochen Arndt6-Jun-16 2:42 
GeneralRe: AES code implementation in C++ Pin
Jochen Arndt6-Jun-16 3:41
mveJochen Arndt6-Jun-16 3:41 
QuestionHow to perform Expression Evaluation in C++ Pin
Member 1239950317-Mar-16 8:22
memberMember 1239950317-Mar-16 8:22 
AnswerRe: How to perform Expression Evaluation in C++ Pin
Sascha Lefèvre17-Mar-16 10:50
professionalSascha Lefèvre17-Mar-16 10:50 
AnswerRe: How to perform Expression Evaluation in C++ Pin
Richard MacCutchan17-Mar-16 23:04
protectorRichard MacCutchan17-Mar-16 23:04 
AnswerRe: How to perform Expression Evaluation in C++ Pin
Super Lloyd5-Jul-16 19:51
memberSuper Lloyd5-Jul-16 19:51 
QuestionHow to move a 3D object along X and Y axis by the keyboard? Pin
Member 1226818327-Feb-16 5:20
memberMember 1226818327-Feb-16 5:20 
I use Visual Studio 2012 and Microsoft DirectX SDK (June 2010). I created an applicatin with a 3d cube as an object. In the example that I use it is moved the point of view of the camera.
In my case I would like to move the object by the keaboard along X and Y axis without moving the camera view.
Could you please help?

Here is my code:

...
CubeDemo::CubeDemo(HINSTANCE hInstance, std::string winCaption,
D3DDEVTYPE devType, DWORD requestedVP)
: D3DApp(hInstance, winCaption, devType, requestedVP), MAX_SPEED(1500.0f), ACCELE(1000.0f)
{
// 5 units off the ground.
mCameraHeight = 5.0f;
buildVertexBuffer();
buildIndexBuffer();
onResetDevice();
InitAllVertexDeclarations();
}
...
void CubeDemo::updateScene(float dt)
{
// One cube has 8 vertices and 12 triangles.
gDInput->poll();
// Check input.
if( gDInput->keyDown(DIK_W) )
{
// Code for moving the 3D object along X axis???
}
if( gDInput->keyDown(DIK_S) )
{
// Code for moving the 3D object along Y axis???
}
buildViewMtx();
}

void CubeDemo::buildViewMtx()
{
D3DXVECTOR3 pos(10, 0, 10);
D3DXVECTOR3 target(0.0f, 0.0f, 0.0f);
D3DXVECTOR3 up(0.0f, 1.0f, 0.0f);
D3DXMatrixLookAtLH(&mView, &pos, &target, &up);
}

void CubeDemo::drawScene()
{
HR(gd3dDevice->Clear(0, 0,
D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffffff, 1.0f, 0));
HR(gd3dDevice->BeginScene());

HR(gd3dDevice->SetStreamSource(0, mVB, 0, sizeof(VertexPos)));
HR(gd3dDevice->SetIndices(mIB));
HR(gd3dDevice->SetVertexDeclaration(VertexPos::Decl));

D3DXMATRIX W;
D3DXMatrixIdentity(&W);
HR(gd3dDevice->SetTransform(D3DTS_WORLD, &W));
HR(gd3dDevice->SetTransform(D3DTS_VIEW, &mView));
HR(gd3dDevice->SetTransform(D3DTS_PROJECTION, &mProj));
HR(gd3dDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME));

HR(gd3dDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, 8, 0, 12));

HR(gd3dDevice->EndScene());
HR(gd3dDevice->Present(0, 0, 0, 0));
}



Reagards
SuggestionRe: How to move a 3D object along X and Y axis by the keyboard? Pin
Richard MacCutchan27-Feb-16 21:13
protectorRichard MacCutchan27-Feb-16 21:13 
GeneralRe: How to move a 3D object along X and Y axis by the keyboard? Pin
Member 1226818327-Feb-16 22:15
memberMember 1226818327-Feb-16 22:15 
GeneralRe: How to move a 3D object along X and Y axis by the keyboard? Pin
Richard MacCutchan28-Feb-16 1:53
protectorRichard MacCutchan28-Feb-16 1:53 
GeneralRe: How to move a 3D object along X and Y axis by the keyboard? Pin
Member 1226818328-Feb-16 3:23
memberMember 1226818328-Feb-16 3:23 
GeneralRe: How to move a 3D object along X and Y axis by the keyboard? Pin
Richard MacCutchan28-Feb-16 3:28
protectorRichard MacCutchan28-Feb-16 3:28 
AnswerRe: How to move a 3D object along X and Y axis by the keyboard? Pin
The_Inventor28-Jun-16 21:02
memberThe_Inventor28-Jun-16 21:02 
QuestionI want find intersection point between two ellipse or ellipse and circle, can someone please give me useful links or any suggestions. Pin
Member 113286205-Jan-16 18:25
memberMember 113286205-Jan-16 18:25 
AnswerRe: I want find intersection point between two ellipse or ellipse and circle, can someone please give me useful links or any suggestions. Pin
Beginner Luck5-Jan-16 19:19
professionalBeginner Luck5-Jan-16 19:19 
GeneralRe: I want find intersection point between two ellipse or ellipse and circle, can someone please give me useful links or any suggestions. Pin
Member 113286205-Jan-16 19:41
memberMember 113286205-Jan-16 19:41 
GeneralRe: I want find intersection point between two ellipse or ellipse and circle, can someone please give me useful links or any suggestions. Pin
Beginner Luck6-Jan-16 14:26
professionalBeginner Luck6-Jan-16 14:26 
Questionto use next and previous button of axwindowsmediaplayer with c++ Pin
Member 121466795-Jan-16 6:57
memberMember 121466795-Jan-16 6:57 
AnswerRe: to use next and previous button of axwindowsmediaplayer with c++ Pin
John Schroedl19-Feb-16 5:25
professionalJohn Schroedl19-Feb-16 5:25 
QuestionShipping multiple architecture Pin
Super Lloyd4-Dec-15 14:52
memberSuper Lloyd4-Dec-15 14:52 
AnswerRe: Shipping multiple architecture Pin
Brisingr Aerowing4-Dec-15 15:58
professionalBrisingr Aerowing4-Dec-15 15:58 
AnswerRe: Shipping multiple architecture Pin
Brisingr Aerowing4-Dec-15 16:53
professionalBrisingr Aerowing4-Dec-15 16:53 
GeneralRe: Shipping multiple architecture Pin
Garth J Lancaster4-Dec-15 17:00
professionalGarth J Lancaster4-Dec-15 17:00 
GeneralRe: Shipping multiple architecture Pin
Brisingr Aerowing6-Dec-15 5:43
professionalBrisingr Aerowing6-Dec-15 5:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.