void Game::start(int w, int h){
	Game main_game(w,h);
	// Här gör vi en init
	main_game.init();
	while(main_game.isPlaying()){
		main_game.printMaze();			// skriv ut den färdigrenderade mazen med items props och karaktärer
		main_game.checkEvents();		// skapa en event funktion(kanske ett objekt event inuti klassen beroende på hur komplext det blir)
	}
}
Esempio n. 2
0
int main() {
    int nb_players, i;
    char **names = NULL;

    init();

    nb_players = get_nb_players();

    names = malloc(sizeof(char *) * nb_players);
    for (i=0; i<nb_players; i++)
        names[i] = malloc(sizeof(char) * 8);

    get_players_name(nb_players, names);

    main_game(nb_players, names);

    return 0;
}
Esempio n. 3
0
// Main Function
void _main(void)
{
signed char STATUS, a;
int plinkos;
unsigned char *Home = malloc(LCD_SIZE); // Allocate the SAVE_SCREEN buffer
if (Home == NULL) {
	Error_Memory();
	return;
}
LCD_save(Home);  // Save LCD HomeScreen Contents

virtual_dark = malloc ( LCD_SIZE );  // Allocate the dark buffer
if (virtual_dark == NULL) {Error_Memory(); return; }
virtual_light=malloc ( LCD_SIZE );  // Allocate the light buffer
if (virtual_light == NULL)	{
	free(virtual_dark);
	Error_Memory();
	return;
}

randomize();

if (Gray_prep() == QUIT) {
	Error_Memory();
	goto end;
}

if (makefile() == QUIT)  // Tests whether or not we need a default save file and installs one if the 
// user doesn't already have one on their calc
	goto end;

for(a = 10; a--;)
	FADE_LIGHTER();
// Clears both Hidden Gray planes
ClearGrayScreen2B(Hiddenl, Hiddend);

GraySpriteX8_OR(52, 37, 27, titlel, titled, 7, Hiddenl, Hiddend);

FontSetSys (F_4x6);
GrayDBufSetHiddenAMSPlane (DARK_PLANE); 
	DrawStr(122, 94, "-- By Fisch", A_NORMAL);
GrayDBufSetHiddenAMSPlane (LIGHT_PLANE); 
	DrawStr(123, 95, "-- By Fisch", A_NORMAL);
GrayDBufToggleSync(); // switches two sets of planes

for(a = 10; a--;)
	FADE_DARKER();
Waitkey();

NEW_GAME:

if ((STATUS = MENU()) == QUIT)
	goto end;

if ((plinkos = PRODUCTS()) == QUIT)
	goto end;

if ((STATUS = INTRO()) == QUIT)
	goto end;

if ((STATUS = main_game(plinkos)) == QUIT)
	goto end;

goto NEW_GAME;

end:
// Clean up at end of Program
Cleanup();
if (Home) {
	LCD_restore(Home);
	free(Home);
	
	GKeyFlush();
	ST_helpMsg("Plinko  --By Travis Fischer");
}
}