Beispiel #1
0
void WabbitemuApp::OnTimer(wxTimerEvent& event) {
	static int difference;
	static unsigned prevTimer;
	unsigned dwTimer = GetTickCount();
	
	// How different the timer is from where it should be
	// guard from erroneous timer calls with an upper bound
	// that's the limit of time it will take before the
	// calc gives up and claims it lost time
	difference += ((dwTimer - prevTimer) & 0x003F) - TPF;
	prevTimer = dwTimer;

	// Are we greater than Ticks Per Frame that would call for
	// a frame skip?
	if (difference > -TPF) {
		calc_run_all();
		while (difference >= TPF) {
			calc_run_all();
			difference -= TPF;
		}

		int i;
		for (i = 0; i < MAX_CALCS; i++) {
			if (calcs[i].active) {
				frames[i]->gui_draw();
			}
		}
	// Frame skip if we're too far ahead.
	} else {
		difference += TPF;
	}
}
/*
 * Class:     com_Revsoft_Wabbitemu_CalcInterface
 * Method:    RunCalc
 * Signature: ()V
 */
JNIEXPORT void JNICALL Java_com_Revsoft_Wabbitemu_calc_CalcInterface_RunCalcs
  (JNIEnv *env, jclass classObj) {
	checkThread();
	calc_run_all();
}