void Monster::JudegeAttack() { srand((UINT)GetCurrentTime()); int x = rand()%100; if(x>98) { this->AttackAnimation("monster_attack",5,MonsterDirecton); } }
/* * Function: RunEnqueueDequeueTrial * -------------------------------- * Runs the enqueue & dequeue time trials for the specified * pqueue size. Reports results to cout. * Note that we just randomly choose numbers to insert. * The amount of time it takes to do one enqueue/dequeue is * too small to be accurately measured, so we do many iterations in * a loop and time that. */ void RunEnqueueDequeueTrial(int size) { PQueue pq; for (int i = 0; i < size; i++) pq.enqueue(RandomInteger(1,size)); cout << "Time to enqueue into " << size << "-element pqueue: " << flush; double start = GetCurrentTime(); for (int j = 0; j < NumRepetitions; j++) pq.enqueue(RandomInteger(1, 2*size)); cout << 1000*(GetCurrentTime() - start)/NumRepetitions << " usecs" << endl; cout << "Time to dequeue from " << size << "-element pqueue: " << flush; start = GetCurrentTime(); for (int k = 0; k < NumRepetitions; k++) pq.dequeueMax(); cout << 1000*(GetCurrentTime() - start)/NumRepetitions << " usecs" << endl; }
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) { static int iKeep [NUM][4] ; HDC hdcScr, hdcMem ; int cx, cy ; HBITMAP hBitmap ; HWND hwnd ; int i, j, x1, y1, x2, y2 ; if (LockWindowUpdate (hwnd = GetDesktopWindow ())) { hdcScr = GetDCEx (hwnd, NULL, DCX_CACHE | DCX_LOCKWINDOWUPDATE) ; hdcMem = CreateCompatibleDC (hdcScr) ; cx = GetSystemMetrics (SM_CXSCREEN) / 10 ; cy = GetSystemMetrics (SM_CYSCREEN) / 10 ; hBitmap = CreateCompatibleBitmap (hdcScr, cx, cy) ; SelectObject (hdcMem, hBitmap) ; srand ((int) GetCurrentTime ()) ; for (i = 0 ; i < 2 ; i++) for (j = 0 ; j < NUM ; j++) { if (i == 0) { iKeep [j] [0] = x1 = cx * (rand () % 10) ; iKeep [j] [1] = y1 = cy * (rand () % 10) ; iKeep [j] [2] = x2 = cx * (rand () % 10) ; iKeep [j] [3] = y2 = cy * (rand () % 10) ; } else { x1 = iKeep [NUM - 1 - j] [0] ; y1 = iKeep [NUM - 1 - j] [1] ; x2 = iKeep [NUM - 1 - j] [2] ; y2 = iKeep [NUM - 1 - j] [3] ; } BitBlt (hdcMem, 0, 0, cx, cy, hdcScr, x1, y1, SRCCOPY) ; BitBlt (hdcScr, x1, y1, cx, cy, hdcScr, x2, y2, SRCCOPY) ; BitBlt (hdcScr, x2, y2, cx, cy, hdcMem, 0, 0, SRCCOPY) ; Sleep (10) ; } DeleteDC (hdcMem) ; ReleaseDC (hwnd, hdcScr) ; DeleteObject (hBitmap) ; LockWindowUpdate (NULL) ; } return FALSE ; }
/*======================================================================* kernel_main *======================================================================*/ PUBLIC int kernel_main() { Init8259A(); Init8253(); SetIRQ(); k_reenter = -1; ticks = 0; get_boot_params(&BootParam); GetCurrentTime(&systime); //?áè?RTCê±?? int i, j, eflags, prio; u8 rpl; u8 priv; TASK * t; PROCESS * p = proc_table; char * stk = task_stack + STACK_SIZE_TOTAL + 0x4000; for (i = 0; i < NR_TASKS + NR_PROCS; i++,p++,t++) { if (i >= NR_TASKS + NR_NATIVE_PROCS) { p->p_flags = FREE_SLOT; p->ldt_sel = SELECTOR_LDT_FIRST + (i << 3); //空槽也要给LDT赋值否则调度任务会#GP异常 continue; } if (i < NR_TASKS) { t = task_table + i; priv = PRIVILEGE_TASK; rpl = RPL_TASK; eflags = 0x1202; prio = 1; } else { t = user_proc_table + (i - NR_TASKS); priv = PRIVILEGE_USER; rpl = RPL_USER; eflags = 0x202; prio = 1; } strcpy(p->name, t->name); p->p_parent = NO_TASK; if (strcmp(t->name, "INIT") != 0) { p->ldts[INDEX_LDT_C] = gdt[SELECTOR_KERNEL_CS >> 3]; p->ldts[INDEX_LDT_RW] = gdt[SELECTOR_KERNEL_DS >> 3]; p->ldts[INDEX_LDT_C].attr1 = DA_C | priv << 5; p->ldts[INDEX_LDT_RW].attr1 = DA_DRW | priv << 5; } else {
// https://w3c.github.io/web-animations/#finish-an-animation void Animation::Finish(ErrorResult& aRv) { if (mPlaybackRate == 0 || (mPlaybackRate > 0 && EffectEnd() == TimeDuration::Forever())) { aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); return; } AutoMutationBatchForAnimation mb(*this); // Seek to the end TimeDuration limit = mPlaybackRate > 0 ? TimeDuration(EffectEnd()) : TimeDuration(0); bool didChange = GetCurrentTime() != Nullable<TimeDuration>(limit); SilentlySetCurrentTime(limit); // If we are paused or play-pending we need to fill in the start time in // order to transition to the finished state. // // We only do this, however, if we have an active timeline. If we have an // inactive timeline we can't transition into the finished state just like // we can't transition to the running state (this finished state is really // a substate of the running state). if (mStartTime.IsNull() && mTimeline && !mTimeline->GetCurrentTime().IsNull()) { mStartTime.SetValue(mTimeline->GetCurrentTime().Value() - limit.MultDouble(1.0 / mPlaybackRate)); didChange = true; } // If we just resolved the start time for a pause or play-pending // animation, we need to clear the task. We don't do this as a branch of // the above however since we can have a play-pending animation with a // resolved start time if we aborted a pause operation. if (!mStartTime.IsNull() && (mPendingState == PendingState::PlayPending || mPendingState == PendingState::PausePending)) { if (mPendingState == PendingState::PausePending) { mHoldTime.SetNull(); } CancelPendingTasks(); didChange = true; if (mReady) { mReady->MaybeResolve(this); } } UpdateTiming(SeekFlag::DidSeek, SyncNotifyFlag::Sync); if (didChange && IsRelevant()) { nsNodeUtils::AnimationChanged(this); } PostUpdate(); }
void Animation::SilentlySetPlaybackRate(double aPlaybackRate) { Nullable<TimeDuration> previousTime = GetCurrentTime(); mPlaybackRate = aPlaybackRate; if (!previousTime.IsNull()) { ErrorResult rv; SilentlySetCurrentTime(previousTime.Value()); MOZ_ASSERT(!rv.Failed(), "Should not assert for non-null time"); } }
void AnimationPlayer::SetSource(Animation* aSource) { if (mSource) { mSource->SetParentTime(Nullable<TimeDuration>()); } mSource = aSource; if (mSource) { mSource->SetParentTime(GetCurrentTime()); } }
void Logger::LogEvent(const String &sMessage) { long lThread = _GetThreadID(); String sTime = GetCurrentTime(); String sData; sData.Format(_T("%d\t\"%s\"\t\"%s\"\r\n"), lThread, sTime, sMessage); _WriteData(sData, Events); }
void Clock::Pause () { //printf ("clock %p (%s) paused\n", this, GetName ()); if (is_paused) return; is_paused = true; begin_pause_time = GetCurrentTime(); }
/** * Performs a robust accept, restarting when interrupted. * Requires a valid socket (se->fd >= 0). */ extern int SH_RobustAccept(SockEntry se) { int timeout = se->base->robustTimeout; uint64_t start = GetCurrentTime(); for (;;) { int connRes = accept(se->fd, NULL, NULL); if (connRes >= 0) { se->lastUsed = GetCurrentTime(); return connRes; } int e = errno; if (e != EAGAIN && e != EINTR) break; MilliSleep(RobustMillis); uint64_t now = GetCurrentTime(); double dt = DeltaTime(start, now); if (dt > timeout) break; } se->errCount++; return -1; }
// ProcessEvents // called by the Process at interrupt time to see if there are // any events that have timed out // void STREAM::ProcessEvents(void) { if (qhEvent.IsElements()) { PEVENT pnextevent = (PEVENT)qhEvent.Head(); ULONG time = GetCurrentTime(); ULONG eventtime = pnextevent->GetEventTime(); if (eventtime <= time) pnextevent->Report(time); } }
/** * Performs a robust connect, restarting when interrupted. * Requires a valid socket (se->fd >= 0). */ extern int SH_RobustConnect(SockEntry se, struct sockaddr *sap) { int timeout = se->base->robustTimeout; uint64_t start = GetCurrentTime(); for (;;) { int connRes = connect(se->fd, sap, SockAddrLen(sap)); if (connRes >= 0) { se->lastUsed = GetCurrentTime(); return connRes; } int e = errno; if (e != EAGAIN && e != EINTR) break; MilliSleep(RobustMillis); uint64_t now = GetCurrentTime(); double dt = DeltaTime(start, now); if (dt > timeout) break; } se->errCount++; return -1; }
/****************************************************************************** * GetDeviceState : returns the "state" of the mouse. * * For the moment, only the "standard" return structure (DIMOUSESTATE) is * supported. */ static HRESULT WINAPI SysMouseAImpl_GetDeviceState( LPDIRECTINPUTDEVICE8A iface,DWORD len,LPVOID ptr ) { SysMouseImpl *This = (SysMouseImpl *)iface; if(This->acquired == 0) return DIERR_NOTACQUIRED; EnterCriticalSection(&(This->crit)); TRACE("(this=%p,0x%08lx,%p):\n", This, len, ptr); TRACE("(X: %ld - Y: %ld - Z: %ld L: %02x M: %02x R: %02x)\n", This->m_state.lX, This->m_state.lY, This->m_state.lZ, This->m_state.rgbButtons[0], This->m_state.rgbButtons[2], This->m_state.rgbButtons[1]); /* Copy the current mouse state */ fill_DataFormat(ptr, &(This->m_state), This->wine_df); /* Initialize the buffer when in relative mode */ if (This->absolute == 0) { This->m_state.lX = 0; This->m_state.lY = 0; This->m_state.lZ = 0; } /* Check if we need to do a mouse warping */ if (This->need_warp == WARP_NEEDED && (GetCurrentTime() - This->last_warped > 10)) { dinput_window_check(This); TRACE("Warping mouse to %ld - %ld\n", This->mapped_center.x, This->mapped_center.y); SetCursorPos( This->mapped_center.x, This->mapped_center.y ); This->last_warped = GetCurrentTime(); #ifdef MOUSE_HACK This->need_warp = WARP_DONE; #else This->need_warp = WARP_STARTED; #endif } LeaveCriticalSection(&(This->crit)); return DI_OK; }
//------------------------------------------------------------------------------ // Purpose : Update weapon //------------------------------------------------------------------------------ void CWeaponSDKMelee::ItemPostFrame( void ) { CSDKPlayer *pPlayer = GetPlayerOwner(); if ( pPlayer == NULL ) return; if (IsThrowingGrenade()) { if (MaintainGrenadeToss()) return; } else if ((pPlayer->m_nButtons & IN_ALT2) && !IsThrowingGrenade() && pPlayer->GetAmmoCount(GetAmmoDef()->Index("grenades")) && pPlayer->CanAttack()) { bool bAllow = (m_flNextPrimaryAttack < GetCurrentTime()); if (m_bInReload) bAllow = true; if (bAllow) { StartGrenadeToss(); return; } } if (GetSwingTime() > 0 && GetSwingTime() <= GetCurrentTime()) { Swing(); } else if ( (pPlayer->m_nButtons & IN_ATTACK) && (m_flNextPrimaryAttack <= GetCurrentTime()) && pPlayer->CanAttack() ) { PrimaryAttack(); } else if ( (pPlayer->m_nButtons & IN_ATTACK2) && (m_flNextSecondaryAttack <= GetCurrentTime()) && pPlayer->CanAttack() ) { SecondaryAttack(); } else { WeaponIdle(); } }
static SockEntry SH_NewSockEntryNoCheck(SockBase base, int sockFD) { SockEntry ret = ProxyUtil_StructAlloc(1, SockEntryStruct); ret->base = base; ret->next = base->list; ret->fd = sockFD; ret->startTime = GetCurrentTime(); ret->lastUsed = ret->startTime; base->list = ret; base->nSocks++; return ret; }
/** * Performs a robust sendmsg, restarting when interrupted. * Requires a connection. */ extern ssize_t SH_RobustSendmsg(SockEntry se, struct msghdr *mp) { int timeout = se->base->robustTimeout; uint64_t start = GetCurrentTime(); for (;;) { ssize_t nb = sendmsg(se->fd, mp, 0); if (nb >= 0) { se->writeActive = 1; se->lastUsed = GetCurrentTime(); return nb; } int e = errno; if (e != EAGAIN && e != EINTR) break; MilliSleep(RobustMillis); uint64_t now = GetCurrentTime(); double dt = DeltaTime(start, now); if (dt > timeout) break; } se->errCount++; return -1; }
ULONG WAVESTREAM::StopStream(PCONTROL_PARM pControl) { if(ulStreamState == STREAM_STOPPED) { dprintf(("WAVESTREAM::StopStream %lx (already stopped)", ulStreamId)); fUnderrun = FALSE; pControl->ulTime = GetCurrentTime(); return NO_ERROR; } pahw->Stop(this); //Reset cleans up waveout instance OSS16_StreamReset(this); ulStreamState = STREAM_STOPPED; fUnderrun = FALSE; dprintf(("WAVESTREAM::StopStream %lx", ulStreamId)); ReturnBuffers(); pControl->ulTime = GetCurrentTime(); _ulTimeBase = GetCurrentTime(); return NO_ERROR; }
int Timer::DelayIsComplete (const Time& delay, bool reset) { float currentTime = GetCurrentTime ().GetValue (); int factor = static_cast<int> ( currentTime / delay.GetValue ()); if (reset && factor > 0) Reset (Time (currentTime - factor * delay.GetValue ())); return factor; }
int CAppLoger::Init(const std::string& strPath, const std::string& strLogFileName, const int& iLogLevel) { if(strPath.empty()) { m_strLogPath = "."; } else { //暂时不支持路径处理,待后期维护 //这是一个坑吗? // m_strLogPath = strPath; } //待完成 //以时间戳和pid作为默认文件名 if(strLogFileName.empty()) { char szTmp[128] = {'0'}; sprintf(szTmp, "%d", getpid()); std::string strTmp(szTmp); //m_strLogFileName = strTmp+"_"+GetCurrentTime().replace(10,1, "_")+".log"; std::string strTmpTime = GetCurrentTime(); std::string strFromatTime=""; for(std::string::iterator it = strTmpTime.begin(); it != strTmpTime.end(); it++) { if(*it == '_' || *it == '-' || *it == ' ' || *it == ':') { continue; } strFromatTime.push_back((*it)); } m_strLogFileName = strTmp +"-"+strFromatTime + ".log"; } else { m_strLogFileName = strLogFileName; } if(iLogLevel > INF) { std::cout<<"this level "<< iLogLevel << "is so large"<<std::endl; return RUN_ERROR; } else { m_iLogLevel = iLogLevel; } return RUN_OK; }
void CPerformanceAnalysis::StartTiming() { int hour, minute, second, msecond; GetCurrentTime(hour, minute, second); GetPreciseCurrentTime(msecond); m_Functions[m_CurrentFunction].ExecutionTime.Hour = hour; m_Functions[m_CurrentFunction].ExecutionTime.Minute = minute; m_Functions[m_CurrentFunction].ExecutionTime.Second = second; m_Functions[m_CurrentFunction].ExecutionTime.Millisecond = msecond; }
void CExactMethodForDGP::Execute() { if (fComputationCompleted) return; if (!fLocked) { fLocked = true; nCountOfWindows = 0; nMaxLenOfWindowQueue = 0; depthOfResultingTree = 0; InitContainers(); nTotalMilliSeconds = GetCurrentTime(); BuildSequenceTree(); nTotalMilliSeconds = GetCurrentTime() - nTotalMilliSeconds; //FillExperimentalResults(); ClearContainers(); fComputationCompleted = true; fLocked = false; } }
VOID CThread::Initialize() { INT nTimeout; for (m_dwTime = GetCurrentTime(), m_dwTimeout = (SystemParametersInfo(SPI_GETHUNGAPPTIMEOUT, 0, &nTimeout, 0)) ? (DWORD)nTimeout : 0; m_hThread != (HANDLE)NULL; ) { CloseHandle(m_hThread); break; } CommonConstruct(); m_bAutoDelete = FALSE; }
void Clock::Resume () { if (!is_paused) return; is_paused = false; accumulated_pause_time += GetCurrentTime() - begin_pause_time; time_manager->NeedClockTick (); }
bool Animation::IsFinished() const { // Unfortunately there's some weirdness in the spec at the moment where if // you're finished and paused, the playState is paused. This prevents us // from just checking |PlayState() == AnimationPlayState::Finished| here, // and we need this much more messy check to see if we're finished. Nullable<TimeDuration> currentTime = GetCurrentTime(); return !currentTime.IsNull() && ((mPlaybackRate > 0.0 && currentTime.Value() >= EffectEnd()) || (mPlaybackRate < 0.0 && currentTime.Value().ToMilliseconds() <= 0.0)); }
OSStatus FadeToGamma( ScreenRef screen, const RLGammaTable *newGamma, float seconds ) { if( ! newGamma ) return paramErr; DEBUGMESSAGE( "Fading to new gamma over " << seconds << " seconds." ); //Calculate the starting and ending time for out fade double startTime = GetCurrentTime(); double endTime = startTime + seconds; //Determine our starting gamma RLGammaTable oldGamma, currentGamma; OSStatus error = GetGamma( screen, &oldGamma ); if( error ) return error; //Loop until we run out of time, resetting the gamma as fast as possible for( double currentTime = GetCurrentTime(); currentTime < endTime && ! error; currentTime = GetCurrentTime() ) { //The fraction is the percentage of time that we have spend so far in this loop as a value between 0 and 1.0 double fraction = (currentTime - startTime) / seconds; //Calculate the new gamma based on the amount of time spent so far //(1-fraction)startGamma + fraction * endGamma = startGamma + fraction( endGamma - startGamma) for( int i = 0; i < kGammaTableEntryCount; i++ ) { currentGamma.red[i] = oldGamma.red[i] + fraction * (newGamma->red[i] - oldGamma.red[i]); currentGamma.green[i] = oldGamma.green[i] + fraction * (newGamma->green[i] - oldGamma.green[i]); currentGamma.blue[i] = oldGamma.blue[i] + fraction * (newGamma->blue[i] - oldGamma.blue[i]); } error = SetGamma( screen, ¤tGamma ); } if( error ) DEBUGMESSAGE( "Got error # " << error << " doing a gamma fade in FadeToGamma(). Attempting to achieve the final gamma...." ); return SetGamma( screen, newGamma ); }
static void Display_(void) { FrameCount++; ExecutionCount++; uint64_t uiStartTime = GetCurrentTime(); glClearColor (0.0, 0.0, 0.0, 0.0); glClear (GL_COLOR_BUFFER_BIT); if(Animated) { UpdateData(); UpdateVBOs(); } int err = Recompute(); if (err != 0) { printf("Error %d from Recompute!\n", err); exit(1); } if (EnableStideExec && ((ExecutionCount / ExecuteStride) % 2) == 0) { printf("CL only for frame %d\n", ExecutionCount); return; } glDrawArrays(GL_POINTS, 0, DataElemCount / 4); ReportInfo(); glFinish(); // for timing uint64_t uiEndTime = GetCurrentTime(); ReportStats(uiStartTime, uiEndTime); DrawText(TextOffset[0], TextOffset[1], 1, (Animated == 0) ? "Press space to animate" : " "); glutSwapBuffers(); }
/* * Function: RunSortTrial * ---------------------- * Runs the sorting time trial for the specified pqueue size. * Reports results to cout. */ void RunSortTrial(int size) { int *array = new int[size]; for (int i = 0; i < size; i++) // put random data into array array[i] = RandomInteger(1, size); cout << "Time to pqsort random sequence of " << size << " elements: " << flush; double start = GetCurrentTime(); PQSort(array, size); cout << GetCurrentTime() - start << " msecs" << endl; cout << "Time to pqsort sorted sequence of " << size << " elements: " << flush; for (int j = 0; j < size; j++) // put data in array already sorted array[j] = j; start = GetCurrentTime(); PQSort(array, size); cout << GetCurrentTime() - start << " msecs" << endl; cout << "Time to pqsort reverse-sorted sequence of " << size << " elements: " << flush; for (int k = 0; k < size; k++) // put data in array already reverse sorted array[k] = size - k; start = GetCurrentTime(); PQSort(array, size); cout << GetCurrentTime() - start << " msecs" << endl; delete [] array; }
//-------------------------------------------------------------- // Name: DemoInit - global // Description: Initiate the things needed for the demo // Arguments: None // Return Value: A boolean variable: -true: successful initiation // -false: unsuccessful initiation //-------------------------------------------------------------- bool DemoInit( void ) { srand( GetCurrentTime( ) ); g_glApp.Init( 10, 10, g_iScreenWidth, g_iScreenHeight, 16, "Demo 4_3: Slope Lighting", IDI_ICON1, IDR_MENU1 ); g_glApp.CreateTTFont( "Lucida Console", 16 ); //set the clear color (background) to black glClearColor( 0.0f, 0.0f, 0.0f, 0.0f ); glDisable( GL_TEXTURE_2D ); //disable two dimensional texture mapping glDisable( GL_LIGHTING ); //disable lighting glDisable( GL_BLEND ); //disable blending glEnable( GL_DEPTH_TEST ); //enable depth testing glShadeModel( GL_SMOOTH ); //enable smooth shading glClearDepth( 1.0 ); //depth buffer setup glDepthFunc( GL_LEQUAL ); //set the type of depth test glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST ); //the nicest perspective look //load the height map in g_bruteForce.MakeTerrainPlasma( 128, 1.0f ); g_bruteForce.SetHeightScale( 0.25f ); //set the terrain's lighting system up g_bruteForce.SetLightingType( SLOPE_LIGHT ); g_bruteForce.SetLightColor( CVECTOR( 1.0f, 1.0f, 1.0f ) ); g_bruteForce.CustomizeSlopeLighting( 1, 1, 0.2f, 0.9f, 15 ); g_bruteForce.CalculateLighting( ); //load the various terrain tiles g_bruteForce.LoadTile( LOWEST_TILE, "../Data/lowestTile.tga" ); g_bruteForce.LoadTile( LOW_TILE, "../Data/lowTile.tga" ); g_bruteForce.LoadTile( HIGH_TILE, "../Data/highTile.tga" ); g_bruteForce.LoadTile( HIGHEST_TILE, "../Data/highestTile.tga" ); //load the terrain's detail map g_bruteForce.LoadDetailMap( "../Data/detailMap.tga" ); g_bruteForce.DoDetailMapping( g_bDetail, 8 ); //make the texture map, and then save it g_bruteForce.GenerateTextureMap( 256 ); g_bruteForce.DoTextureMapping( g_bTexture ); g_bruteForce.DoMultitexturing( g_glApp.CanMultitexture( ) ); //set the camera's position g_camera.SetPosition( 64.0f, 128.0f, 256.0f ); g_camera.m_fPitch-= 25; //the initiation was successful g_log.Write( LOG_SUCCESS, "INITIATION SUCCESSFUL" ); return true; }
void Animation::SetCurrentTimeAsDouble(const Nullable<double>& aCurrentTime, ErrorResult& aRv) { if (aCurrentTime.IsNull()) { if (!GetCurrentTime().IsNull()) { aRv.Throw(NS_ERROR_DOM_TYPE_ERR); } return; } return SetCurrentTime(TimeDuration::FromMilliseconds(aCurrentTime.Value())); }
/****************************************************************************** * GetDeviceData : gets buffered input data. */ static HRESULT WINAPI SysMouseAImpl_GetDeviceData(LPDIRECTINPUTDEVICE8A iface, DWORD dodsize, LPDIDEVICEOBJECTDATA dod, LPDWORD entries, DWORD flags) { SysMouseImpl *This = (SysMouseImpl *)iface; HRESULT res; res = IDirectInputDevice2AImpl_GetDeviceData(iface, dodsize, dod, entries, flags); if (FAILED(res)) return res; /* Check if we need to do a mouse warping */ if (This->need_warp && (GetCurrentTime() - This->last_warped > 10)) { if(!dinput_window_check(This)) return DIERR_GENERIC; TRACE("Warping mouse to %d - %d\n", This->mapped_center.x, This->mapped_center.y); SetCursorPos( This->mapped_center.x, This->mapped_center.y ); This->last_warped = GetCurrentTime(); This->need_warp = FALSE; } return res; }