int rotate = 0;
static void Handle_events	(	unsigned char *stop	)	{	unsigned long last_repaint = 0;		// For insuring animation repaints.	/*	 *	Main event loop.	 */	while (!*stop)		{		int rotate = 0;		// 1 to rotate colors.		Delay();		// Wait a fraction of a second.		Mouse::mouse->hide();		// Turn off mouse.		Mouse::mouse_update = false;		SDL_Event event;		while (!*stop && SDL_PollEvent(&event))			Handle_event(event);					// Get current time.		unsigned long ticks = SDL_GetTicks();					// Animate unless dormant.		if (gwin->have_focus() && !dragging)			gwin->get_tqueue()->activate(ticks);					// Show animation every 1/20 sec.		if (ticks > last_repaint + 50 || gwin->was_painted())					// This avoids jumpy walking:			{			gwin->paint_dirty();			last_repaint = ticks;			rotate = 1;			int x, y;// Check for 'stuck' Avatar.			if (!gwin->is_moving() &&			    !gwin->was_teleported())				{				int ms = SDL_GetMouseState(&x, &y);				if ((SDL_BUTTON(3) & ms) &&				    gwin->get_usecode()->get_global_flag(				    Usecode_machine::did_first_scene))					gwin->start_actor(x >> scale, 							  y >> scale, 							  avatar_speed);				}			}		if (show_mouse)			Mouse::mouse->show();	// Re-display mouse.		if (rotate)			{		// (Blits in simulated 8-bit mode.)			gwin->get_win()->rotate_colors(0xf0, 4, 0);			gwin->get_win()->rotate_colors(0xe8, 8, 0);			gwin->get_win()->rotate_colors(0xe0, 8, 1);			}		if (!gwin->show() &&	// Blit to screen if necessary.		    Mouse::mouse_update)	// If not, did mouse change?			Mouse::mouse->blit_dirty();		}	}