Archived

This topic is now archived and is closed to further replies.

Alpha_ProgDes

my Timer is screwy

Recommended Posts

i''m trying to use timeBeginTime(), timeGetTime(), and timeEndTime() in my game. i included the windows.h, windowsx.h, and mmsystem.h files. unfortunately i keep getting an error.
//globals

#ifndef GLOBALS_H
#define GLOBALS_H

#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN  //keeps unnecessary code/MFC out of the App

#endif

#define DIRECTDRAW_VERSION	0x0600
#define DIRECTINPUT_VERSION 0x0600


#include <windows.h>  //file necessary for ...Windows

#include <windowsx.h> //file necessary for ...Windows

#include <time.h>
#include <mmsystem.h>
#include <mmreg.h>
#include <stdio.h>    //input and output ex: scanf(), printf()

#include <stdlib.h>   //for the system() feature. keeps Dev-C++ from closing instanteously and NULL

#include <string.h>   //for string manipulation




#include <ddraw.h>
#include <dinput.h>

....
#endif
//init code

#include "Globals.h"

int Game_Init()
{
...

timeBeginPeriod(1);

return 0;
}
//game code

int Game_Main()
{
	
	WORD *video_buffer = NULL;
	long lPitch;
	int x, y;
	DDSURFACEDESC ddsd;
	DDBLTFX ddbltfx;
	HRESULT hRet;
	RECT sRect, dRect = {0, 0, 0, 0};
	sRect = dRect;

	// Timing    

	static DWORD lastTickCount   = timeGetTime();    
	DWORD        thisTickCount;

...

return 0;
}
//termination code

#include "Globals.h"


int Game_Shutdown ()
{
	
	timeEndPeriod(1);

...

return 0;
}
these are the errors i keep getting:
Deleting intermediate files and output files for project ''Tetris - Win32 Debug''.
--------------------Configuration: Tetris - Win32 Debug--------------------
Compiling...
Execution.cpp
c:\program files\microsoft visual studio\myprojects\tetris\execution.cpp(12) : warning C4101: ''ddbltfx'' : unreferenced local variable
c:\program files\microsoft visual studio\myprojects\tetris\execution.cpp(19) : warning C4101: ''thisTickCount'' : unreferenced local variable
Fun_Functions.cpp
Initialize.cpp
New_Beginning.cpp
Termination.cpp
Utility.cpp
Linking...
Execution.obj : error LNK2001: unresolved external symbol __imp__timeGetTime@0
Initialize.obj : error LNK2001: unresolved external symbol __imp__timeBeginPeriod@4
Termination.obj : error LNK2001: unresolved external symbol __imp__timeEndPeriod@4
Debug/Tetris.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.

Tetris.exe - 4 error(s), 2 warning(s)
 
can anyone give a clue, hint, an answer on how i fix this? thanks.

Share this post


Link to post
Share on other sites