src/video/cocoa_v.m
branchcustombridgeheads
changeset 5648 1608018c5ff2
parent 5643 3778051e8095
child 5650 aefc131bf5ce
equal deleted inserted replaced
5647:cbde85c8c878 5648:1608018c5ff2
   335 
   335 
   336 		case QZ_TAB: _cocoa_video_data.tab_is_down = down; break;
   336 		case QZ_TAB: _cocoa_video_data.tab_is_down = down; break;
   337 
   337 
   338 		case QZ_RETURN:
   338 		case QZ_RETURN:
   339 		case QZ_f:
   339 		case QZ_f:
   340 			if (down && (
   340 			if (down && (_cocoa_video_data.current_mods & NSCommandKeyMask)) {
   341 						(_cocoa_video_data.current_mods & NSControlKeyMask) ||
       
   342 						(_cocoa_video_data.current_mods & NSCommandKeyMask)
       
   343 					)) {
       
   344 				CocoaVideoFullScreen(!_fullscreen);
   341 				CocoaVideoFullScreen(!_fullscreen);
   345 			}
   342 			}
   346 			break;
   343 			break;
   347 	}
   344 	}
   348 
   345 
   653 }
   650 }
   654 
   651 
   655 
   652 
   656 static void QZ_GameLoop(void)
   653 static void QZ_GameLoop(void)
   657 {
   654 {
   658 	uint32 next_tick = GetTick() + 30;
   655 	uint32 cur_ticks = GetTick();
   659 	uint32 cur_ticks;
   656 	uint32 next_tick = cur_ticks + 30;
   660 	uint32 pal_tick = 0;
   657 	uint32 pal_tick = 0;
   661 #ifdef _DEBUG
   658 #ifdef _DEBUG
   662 	uint32 et0, et, st0, st;
   659 	uint32 et0, et, st0, st;
   663 #endif
   660 #endif
   664 	int i;
   661 	int i;
   681 	QZ_CheckPaletteAnim();
   678 	QZ_CheckPaletteAnim();
   682 	QZ_Draw();
   679 	QZ_Draw();
   683 	CSleep(1);
   680 	CSleep(1);
   684 
   681 
   685 	for (;;) {
   682 	for (;;) {
       
   683 		uint32 prev_cur_ticks; // to check for wrapping
   686 		InteractiveRandom(); // randomness
   684 		InteractiveRandom(); // randomness
   687 
   685 
   688 		while (QZ_PollEvent()) {}
   686 		while (QZ_PollEvent()) {}
   689 
   687 
   690 		if (_exit_game) break;
   688 		if (_exit_game) break;
   699 		} else if (_fast_forward & 2) {
   697 		} else if (_fast_forward & 2) {
   700 			_fast_forward = 0;
   698 			_fast_forward = 0;
   701 		}
   699 		}
   702 
   700 
   703 		cur_ticks = GetTick();
   701 		cur_ticks = GetTick();
   704 		if ((_fast_forward && !_pause) || cur_ticks > next_tick)
   702 		if (cur_ticks >= next_tick || (_fast_forward && !_pause) || cur_ticks < prev_cur_ticks) {
   705 			next_tick = cur_ticks;
   703 			next_tick = cur_ticks + 30;
   706 
       
   707 		if (cur_ticks == next_tick) {
       
   708 			next_tick += 30;
       
   709 
   704 
   710 			_ctrl_pressed = !!(_cocoa_video_data.current_mods & NSControlKeyMask);
   705 			_ctrl_pressed = !!(_cocoa_video_data.current_mods & NSControlKeyMask);
   711 			_shift_pressed = !!(_cocoa_video_data.current_mods & NSShiftKeyMask);
   706 			_shift_pressed = !!(_cocoa_video_data.current_mods & NSShiftKeyMask);
   712 #ifdef _DEBUG
   707 #ifdef _DEBUG
   713 			_dbg_screen_rect = !!(_cocoa_video_data.current_mods & NSAlphaShiftKeyMask);
   708 			_dbg_screen_rect = !!(_cocoa_video_data.current_mods & NSAlphaShiftKeyMask);