for my game timer i am using TimeGetTime , i know there is other methods but i want to try this way for a chance, here is the code...
before i enter the MSG loop
MSG msg;
static float lastTime = (float)timeGetTime();
while(TRUE)
{
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
if (msg.message == WM_QUIT)
break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
render_frame();
// check the 'escape' key
if(KEY_DOWN(VK_ESCAPE))
PostMessage(hWnd, WM_DESTROY, 0, 0);
float currTime = (float)timeGetTime();
float timeDelta = (currTime - lastTime)*0.001f; //0.001f;
gDelta = timeDelta;
}
and when i go to render the d3d object
static float z = 0.0f;
D3DXMATRIX matRotateY,matTrans; // a matrix to store the rotation for each triangle
D3DXMatrixTranslation(&matTrans,0.0f,0.0f,z*gDelta*1.0f);
d3ddev->SetTransform(D3DTS_WORLD, &(matTrans)); // set the world transform
making object move by fps
Started by Anddos, Mar 21 2012 02:32 PM
3 replies to this topic
#1
Posted 21 March 2012 - 02:32 PM
#2
Posted 21 March 2012 - 03:21 PM
I think you forgot to actually ask something. Do you have a question?
#3
Posted 21 March 2012 - 05:17 PM
hehe you are right, i forgot to add how to calculate the fps now
#4
Posted 21 March 2012 - 05:58 PM
ive got this sorted now, so no need to help now
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












