|
dev.gamez.lv Latvian Game Developers Community
|
View previous topic :: View next topic |
Author |
Message |
Lynx Indago Uzvarētājs
Joined: 20 Jan 2003 Posts: 70 Location: Rīga
|
Posted: Fri Oct 06, 2006 12:09 am Post subject: Taimeris |
|
Strādājot pie vienas programmas, nonācu strupceļā un nevaru noteikt, kur ir problēma. Teoretiski viss ir pēc manuāļa http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_CWnd.3a3a.SetTimer.asp un nekādi kompilācijas errori nav. Es palaižu sākuma procesā taimeri, testa nolūkā uz 1 sekundi. Ar domu, lai ik pēc sekundes tiktu izpildīts void CALLBACK TimerProc. Lieki piebilst, ka tā nenotiek.
Te izgriezums no koda:
Code: | void CALLBACK TimerProc(HWND hWnd, UINT nMsg, UINT nIDEvent, DWORD dwTime)
{
//daram savas lietas
}
int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil)
{
MSG msg;
HWND hWnd;
SetTimer(hWnd, 0, 1000, TimerProc);
} |
|
|
Back to top |
|
|
bubu Indago Uzvarētājs
Joined: 23 Mar 2004 Posts: 3223 Location: Riga
|
|
Back to top |
|
|
Lynx Indago Uzvarētājs
Joined: 20 Jan 2003 Posts: 70 Location: Rīga
|
Posted: Mon Oct 09, 2006 10:06 pm Post subject: |
|
Galvenā ideja lietot taimeri idle loopa vietā bija, ka taimeri var killot un lietot paralēli galvenajam loopam, ja jaapreiķina uz laiku bāzēti eventi. Kamēr ar Sleep(), jagaida kad tas beigsies.
Rezultātā tāpat nepalaidu to taimeri, izgatavoju vienkārši mainīgo time galvenajā loopā, kas katru sekundi updeitojas. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|