예제 #1
0
파일: setup.c 프로젝트: simX/opentyrian
void JE_textMenuWait( JE_word *waitTime, JE_boolean doGamma )
{
	set_mouse_position(160, 100);
	
	do
	{
		JE_showVGA();
		
		push_joysticks_as_keyboard();
		service_SDL_events(true);
		
		inputDetected = newkey | mousedown;
		
		if (lastkey_sym == SDLK_SPACE)
		{
			lastkey_sym = SDLK_RETURN;
		}
		
		if (mousedown)
		{
			newkey = true;
			lastkey_sym = SDLK_RETURN;
		}
		
		if (mouseInstalled && input_grabbed)
		{
			if (abs(mouse_y - 100) > 10)
			{
				inputDetected = true;
				if (mouse_y - 100 < 0)
				{
					lastkey_sym = SDLK_UP;
				} else {
					lastkey_sym = SDLK_DOWN;
				}
				newkey = true;
			}
			if (abs(mouse_x - 160) > 10)
			{
				inputDetected = true;
				if (mouse_x - 160 < 0)
				{
					lastkey_sym = SDLK_LEFT;
				} else {
					lastkey_sym = SDLK_RIGHT;
				}
				newkey = true;
			}
		}
		
		NETWORK_KEEP_ALIVE();
		
		SDL_Delay(16);
		
		if (*waitTime > 0)
		{
			(*waitTime)--;
		}
	} while (!(inputDetected || *waitTime == 1 || haltGame));
}
예제 #2
0
void JE_outTextGlow( SDL_Surface * screen, int x, int y, const char *s )
{
	int16_t z;
	uint8_t c = 15;

	if (warningRed)
	{
		c = 7;
	}

	JE_outTextAdjust(screen, x - 1, y,     s, 0, -12, textGlowFont, false);
	JE_outTextAdjust(screen, x,     y - 1, s, 0, -12, textGlowFont, false);
	JE_outTextAdjust(screen, x + 1, y,     s, 0, -12, textGlowFont, false);
	JE_outTextAdjust(screen, x,     y + 1, s, 0, -12, textGlowFont, false);
	if (frameCountMax > 0)
		for (z = 1; z <= 12; z++)
		{
			setjasondelay(frameCountMax);
			JE_outTextAdjust(screen, x, y, s, c, z - 10, textGlowFont, false);
			if (JE_anyButton())
			{
				frameCountMax = 0;
			}

			NETWORK_KEEP_ALIVE();

			JE_showVGA();

			wait_delay();
		}
	for (z = (frameCountMax == 0) ? 6 : 12; z >= textGlowBrightness; z--)
	{
		setjasondelay(frameCountMax);
		JE_outTextAdjust(screen, x, y, s, c, z - 10, textGlowFont, false);
		if (JE_anyButton())
		{
			frameCountMax = 0;
		}

		NETWORK_KEEP_ALIVE();

		JE_showVGA();

		wait_delay();
	}
	textGlowBrightness = 6;
}
예제 #3
0
void JE_playAnim( const char *animfile, uint8_t startingframe, uint8_t speed )
{
	uint32_t i;
	int pageNum;

	if (JE_loadAnim(animfile) != 0)
	{
		return; /* Failed to open or process file */
	}

	/* Blank screen */
	JE_clr256(VGAScreen);
	JE_showVGA();


	/* re FileHeader.nRecords-1: It's -1 in the pascal too.
	 * The final frame is a delta of the first, and we don't need that.
	 * We could also, if we ever ended up needing to loop anis, check
	 * the bools in the header to see if we should render the last
	 * frame.  But that's never going to be encessary :)
	 */
    for (i = startingframe; i < FileHeader.nRecords-1; i++)
    {
    	/* Handle boring crap */
    	setjasondelay(speed);

		/* Load required frame.  The loading function is smart enough to not re-load an already loaded frame */
		pageNum = JE_findPage(i);
		if(pageNum == -1) { break; }
		if (JE_loadPage(pageNum) != 0) { break; }

		/* render frame. */
    	if (JE_renderFrame(i) != 0) { break; }
    	JE_showVGA();


		/* Return early if user presses a key */
		service_SDL_events(true);
		if (newkey)
		{
			break;
		}

		/* Wait until we need the next frame */
		NETWORK_KEEP_ALIVE();
		wait_delay();
    }

	JE_closeAnim();
}