Exemplo n.º 1
0
Arquivo: app.c Projeto: Mojofreem/flub
int appUpdate(uint32_t ticks) {
    gfxUpdate(ticks);
    inputUpdate(ticks);
    consoleUpdate(ticks);

    videoUpdate();

    return 1;
}
Exemplo n.º 2
0
/******************************************************************************
FUNCTIONS
******************************************************************************/
void showTutorial()
{
	BNX_GAME tutGame;

	tutGame.score[ cPlayer1 ]		= 0;
	tutGame.score[ cPlayer2 ]		= 0;
	tutGame.scroll					= cMaxScroll;
	tutGame.speed					= cMaxScroll;
	tutGame.message					= cTextIngameScore;
	tutGame.level					= cLevelInactive;
	tutGame.level_count				= cLevelInactive;
	tutGame.lines					= 0;
	tutGame.moment					= 0;
	tutGame.clears					= cClearInit;
	tutGame.ingame					= BNX_TRUE;
	tutGame.mode					= cModeRealtime;
	tutGame.best[ cModeRealtime ]	= 0;

	tutGame.player[ 0 ].e			= 1;
	tutGame.player[ cPlayer1 ].x	= 0;
	tutGame.player[ cPlayer1 ].y	= 0;

	tutGame.grid[0][0]=0;tutGame.grid[1][0]=0;tutGame.grid[2][0]=0;tutGame.grid[3][0]=0;tutGame.grid[4][0]=0;
	tutGame.grid[0][1]=0;tutGame.grid[1][1]=0;tutGame.grid[2][1]=0;tutGame.grid[3][1]=0;tutGame.grid[4][1]=0;
	tutGame.grid[0][2]=0;tutGame.grid[1][2]=0;tutGame.grid[2][2]=0;tutGame.grid[3][2]=0;tutGame.grid[4][2]=0;
	tutGame.grid[0][3]=(1<<4)+2;tutGame.grid[1][3]=(3<<4)+2;tutGame.grid[2][3]=0;tutGame.grid[3][3]=(3<<4)+1;tutGame.grid[4][3]=(1<<4)+2;
	tutGame.grid[0][4]=(2<<4)+3;tutGame.grid[1][4]=0;tutGame.grid[2][4]=4<<1+1;tutGame.grid[3][4]=(1<<4)+2;tutGame.grid[4][4]=(1<<4)+2;
	tutGame.grid[0][5]=(2<<4)+3;tutGame.grid[1][5]=(3<<4)+2;tutGame.grid[2][5]=0;tutGame.grid[3][5]=(3<<4)+1;tutGame.grid[4][5]=(3<<4)+1;
	tutGame.grid[0][6]=(3<<4)+1;tutGame.grid[1][6]=0;tutGame.grid[2][6]=4<<1+1;tutGame.grid[3][6]=(1<<4)+2;tutGame.grid[4][6]=(4<<4)+3;

	gfxRenderGame( &tutGame );

	while ( inpKeyUp() == BNX_FALSE )
	{
		gfxRenderGame( &tutGame );
		gfxUpdate();
		inpUpdate();
	}

	tutGame.grid;
}
Exemplo n.º 3
0
void hofView()
{
	BNX_INT32	startTime;

	inpInit();
	do
	{
		startTime = sysGetTime();

		inpUpdate();
		gfxGetHelpPen( inpDirect() );
		gfxRenderHof( &Hof, cGfxHofNoKeyboard );
		gfxUpdate();
		sndUpdate();
		sysUpdate();

		// Synchronize with the clock
		while ( sysGetTime() - startTime < cDeltaTime )
		{
			sysUpdate();
		}
	}
	while ( inpKeyA() == BNX_FALSE );
}
Exemplo n.º 4
0
BNX_BOOL hofEnter( BNX_GAME *game )
{
	BNX_INT32		startTime;
	BNX_INT16		viewoption = cGfxHofNoKeyboard;
	BNX_INT16		curPos = 0;
	BNX_INT16		i, j;
	char			cChar = 0;
	BNX_HALL_ENTRY	*recEntry = 0;

	switch ( game->mode )
	{
		case cModeRealtime:
			for ( i = 0; i < cHofEntries; ++i )
			{
				if ( Hof.arcade[ i ].score < game->score[ cPlayer1 ] )
				{
					recEntry = &Hof.arcade[ i ];
					viewoption = cGfxHofKeyboardDn;
					break;
				}
			}
			for ( j = cHofEntries-1; j > i; --j )
			{
				strcpy( Hof.arcade[ j ].name, Hof.arcade[ j-1 ].name );
				Hof.arcade[ j ].score = Hof.arcade[ j-1 ].score;
			}
			break;
		case cModeTurn:
			for ( i = 0; i < cHofEntries; ++i )
			{
				if ( Hof.tactic[ i ].score < game->score[ cPlayer1 ] )
				{
					recEntry = &Hof.tactic[ i ];
					viewoption = cGfxHofKeyboardUp;
					break;
				}
			}
			for ( j = cHofEntries-1; j > i; --j )
			{
				strcpy( Hof.tactic[ j ].name, Hof.tactic[ j-1 ].name );
				Hof.arcade[ j ].score = Hof.tactic[ j-1 ].score;
			}
			break;
		default:
			return BNX_TRUE;
	}

	if ( recEntry == 0 )
	{
		return BNX_FALSE;
	}

	strcpy( recEntry->name, "                             " );
	recEntry->score = game->score[ cPlayer1 ];
	inpInit();
	do
	{
		startTime = sysGetTime();

		gfxGetVirtualChar( game, inpDirect() );
		cChar = inpGetChar();
		if ( cChar > 0 )
		{
			hofAddLetter( curPos, cChar, recEntry->name );
			if ( curPos < cHofNameLen - 1 )
			{
				curPos++;
			}
		}
		if ( inpKeyDel() == BNX_TRUE )
		{
			hofResetCursor( curPos, recEntry->name );
			if ( curPos > 0 )
			{
				curPos--;
			}
		}
		hofBlinkCursor( curPos, recEntry->name );

		inpUpdate();
		gfxRenderHof( &Hof, viewoption );
		gfxUpdate();
		sndUpdate();
		sysUpdate();

		// Synchronize with the clock
		while ( sysGetTime() - startTime < cDeltaTime )
		{
			sysUpdate();
		}
	}
	while ( inpKeyA() == BNX_FALSE && inpKeyB() == BNX_FALSE );
	hofResetCursor( curPos, recEntry->name );

	return BNX_TRUE;
}