コード例 #1
0
ファイル: main.c プロジェクト: gitustc/d2imdev
int main(){

	game g;
	game_init( &g );
	game_run ( &g );
	game_over( &g );

	return 0;
}
コード例 #2
0
static void
play_game(struct rnd *rnd)
{
    struct game *game = game_alloc_or_die(rnd);
    struct result result = game_show(game);
    if (result_is_success(result)) result = game_run(game);
    game_hide(game);
    if (!result_is_success(result)) result_print_error(result);
    game_free_or_die(game);
}
コード例 #3
0
ファイル: game.c プロジェクト: devmabbott/Invaders
int main(int argc, char *argv[]) {
    /* Signal handlers */
    sigaction_wrapper(SIGINT, sigint_handler);

    /* Start the game */
    g = game_init();
    game_run(g);
    game_free(g);

    return 0;
}
コード例 #4
0
ファイル: xrick.c プロジェクト: HerbFargus/xrick
/*
 * main
 */
int
main(int argc, char *argv[])
{
	sys_init(argc, argv);
	if (sysarg_args_data)
		data_setpath(sysarg_args_data);
	else
		data_setpath("data.zip");
	game_run();
	data_closepath();
	sys_shutdown();
	return 0;
}
コード例 #5
0
ファイル: xrick.c プロジェクト: carstene1ns/xrick-playbook
/*
 * main
 */
int
main(int argc, char *argv[])
{
	sys_init(argc, argv);
#ifdef __QNXNTO__
	data_setpath("app/native/assets");
#else
	if (sysarg_args_data)
		data_setpath(sysarg_args_data);
	else
		data_setpath("data.zip");
#endif
	game_run();
	data_closepath();
	sys_shutdown();
	return 0;
}
コード例 #6
0
ファイル: main.c プロジェクト: dvdhrm/airhockey
int main()
{
	int ret = 0;
	struct e3d_window *wnd;
	struct shaders shaders;
	struct ulog_dev *log;

	ulog_flog(NULL, ULOG_INFO, "Starting\n");

	ret = init_subsystems();
	if (ret)
		goto err;

	wnd = e3d_window_new();
	if (!wnd) {
		ret = -1;
		goto err_subs;
	}

	ret = init_shaders(&shaders);
	if (ret)
		goto err_wnd;

	log = debug_log("Game: ");
	if (!log) {
		ret = -ENOMEM;
		goto err_shader;
	}

	ret = game_run(log, wnd, &shaders);

	ulog_unref(log);
err_shader:
	destroy_shaders(&shaders);
err_wnd:
	e3d_window_free(wnd);
err_subs:
	destroy_subsystems();
err:
	if (ret)
		ulog_flog(NULL, ULOG_ERROR, "Abort\n");
	else
		ulog_flog(NULL, ULOG_INFO, "Exiting\n");
	return -ret;
}
コード例 #7
0
ファイル: main.c プロジェクト: rnestler/heligame
int main (void)
{    
	DPRINT("Starting...\n");
	
	hardwareInit();
	DPRINT("Hardware Initialized!\n");
	int i;
	for(i=0; i<10; i++) {
		MIODispWriteText("testg", i, i);
	}
	//DelayMs(3000);

	Game* game = game_init();
	DPRINT("Game Initialized!\n");
	while(1) {
		game_run(game);
	}
}
コード例 #8
0
ファイル: gridfire.c プロジェクト: AlexsJones/gridfire_c
int main(int argc, char **argv)
{
	
	/*-----------------------------------------------------------------------------
	 *  Very important to note that XInitThreads is a linux implementation only
	 *-----------------------------------------------------------------------------*/
	XInitThreads();
	JNX_LOG(NULL,"Starting game setup\n");	

	jnx_hashmap *config = create_configuration();
	
	if(game_setup(config) == 0)
	{
		game_run();
	}
	else{
		return 1;
	}	
	return 0;
}
コード例 #9
0
ファイル: xrick.c プロジェクト: uli/xrick-spmp8000
/*
 * main
 */
int
main(int argc, char *argv[])
{
	libgame_init();
	FILE *fp;
	if ((fp = fopen("xrick_stderr.txt", "w"))) {
		stderr = fp;
		setbuf(fp, NULL);
		//*_diag_putc = my_putc;
	}
	sys_init(argc, argv);
	if (sysarg_args_data)
		data_setpath(sysarg_args_data);
	else
		data_setpath("/fat20a2/hda2/GAME/xrick_data.zip");
	game_run();
	data_closepath();
	sys_shutdown();
	return 0;
}
コード例 #10
0
ファイル: main.cpp プロジェクト: Luminoth/eblocks
int main(int argc, char* argv[])
{
    const int width=450;
    const int height=560;
    const int bpp=16;

    Video video;
    if(!video.is_good()) {
        std::cerr << "Video initialization failed: " << SDL_GetError() << std::endl;
        SDL_Quit();
        return 1;
    }

    Audio audio;
    if(!audio.is_good()) {
        std::cerr << "Audio initialization failed: " << SDL_GetError() << std::endl;
        SDL_Quit();
        return 1;
    }

    struct State game_state;
    if(!game_init(&video, &audio, &game_state, width, height, bpp)) {
        std::cerr << "Game initialization failed: " << SDL_GetError() << std::endl;
        SDL_Quit();
        return 1;
    }

    process_arguments(argc, argv, &game_state);

#if defined DEBUG
    std::cout << "Block size: " << Block::width << "x" << Block::height << std::endl;
    std::cout << "Tetrion dimensions: " << Tetrion::NUM_ROWS << "x" << Tetrion::NUM_COLS << std::endl;
#endif

    game_run(&video, &audio, &game_state);

    game_shutdown(&audio, &game_state);
    return 0;
}
コード例 #11
0
ファイル: game_kern_main.c プロジェクト: harthur/lights-out
/** @brief Kernel entrypoint.
 *  
 *  This is the entrypoint for the kernel.  It simply sets up the
 *  drivers and passes control off to game_run().
 *
 * @return Does not return
 */
int kernel_main()
{
    /*
     * Tell the kernel memory allocator which memory it can't use.
     * It already knows not to touch kernel image.
     */

    /* Everything above 16M */
    lmm_remove_free( &malloc_lmm, (void*)USER_MEM_START, -8 - USER_MEM_START );
    
    /* Everything below 1M  */
    lmm_remove_free( &malloc_lmm, (void*)0, 0x100000 );

    /*
     * Install interrupt handlers here.
     */

    handler_install(tick);

    /*
     * initialize the PIC so that IRQs and
     * exception handlers don't overlap in the IDT.
     */
    pic_init( BASE_IRQ_MASTER_BASE, BASE_IRQ_SLAVE_BASE );

    /*
     * allow all interrupts
     */
    enable_interrupts();

    /* 
     * run the game
     */
    game_run();
    
    return 0;
}
コード例 #12
0
ファイル: main.c プロジェクト: LightWind/netqi
/*!
 * Main function 
 * @param ac  argcount
 * @param av  argvalue
 * \version 1.0
 * \date    Sept 2007
 * \author Elie
 */
int main (int ac, char **av) {
	
	char c;	
	

	bzero(&option, sizeof(option));
	option.fileout = stdout;	
	while ((c = getopt(ac, av, "lf:r:o:d:t:hg:wpiGCISD:")) != -1)
   	switch (c)
    	{
	case 'S':
		option.mode 	= STRATEGY;
		option.mode_opt	= FULL;
		break;
	case 'I':
		option.mode 	= STRATEGY;
		option.mode_opt = INSTANCE;
		break;
	case 'C':
		option.mode = MODELCHECK;
		break;
	case 'G':
		option.mode = SIMULATION;
		break;
	case 'D':
		option.die = atoi(optarg);
		break;	
	case 'f':
		option.filename = (char *)my_strndup(optarg, strlen(optarg));
		break;
	case 'h':
		help();
		break;
	case 't':
		option.timeout = atoi(optarg);
		break;		
	case 'r':
		option.delay = atoi(optarg);
		break;
	case 'w':
		option.quiet = 1;
		break;
        case 'i':
                option.quiet = LATEX;
                option.debug = 3;
                
        case 'l':
		option.quiet = LATEX;
		break;
	case 'o':
		if (!(option.fileout = fopen(optarg, "w")))
                    die("Option -o:can't open output file:\t%s\n", optarg);
		break;
        case 'g':
                if (!(option.graphfile = fopen(optarg, "w")))
                    die("Option -g:can't open graph file:\t%s\n", optarg);
                break;
                
	case 'd':
		option.debug = atoi(optarg);
		break;
	case 'p':
			option.progress++;
	break;
	default:
		help();
		break;
	}

	if(option.filename == NULL)
		help();

	//init
	init();
	
	//run
	if(!option.mode)
	{
		warning("Please choose an mode: -G for a single game execution or -C for model check a formula or -S for strategy analysis\n");
		help();
	}
	
	game_init();
	
	game_run();
	return 42;
}
コード例 #13
0
ファイル: psxsnake.c プロジェクト: cetygamer/psxsdk
int main()
{
	int c;

// Initialize
	game_init();
	
	printf("PSXsnake\n");
	printf("(c) 2009 Giuseppe Gatta\n");
	printf("Made with PSXSDK\n\n");
	
	load_file_into_buffer("cdrom:FONT.TIM;1");
	GsImageFromTim(&game_image, file_buffer);
	
	GsUploadImage(&game_image);
	
	game_clut[0] = 0x0;
	game_clut[1] = 0x7fff;
	
	LoadImage(game_clut, 640, 24, 16, 1);
	
	GsSetVideoMode(320, 240, EXAMPLES_VMODE);
	
	vmode = pal_or_ntsc_selection();
	
	//printf("vmode = %d\n", vmode);
	
	GsSetVideoMode(320, 240, vmode);
	
	
	load_file_into_buffer("cdrom:BACKGRND.TIM;1");
	GsImageFromTim(&game_image, file_buffer);
	
	GsUploadImage(&game_image);
	
	sample_pos[0] = SPU_DATA_BASE_ADDR;
	c = load_file_into_buffer("cdrom:MUSIC.RAW;1");
	SsUpload(file_buffer, c, sample_pos[0]);
	
	if(c&0x7)
	{
		c|=0x7;
		c++;
	}
	
	sample_pos[1] = c + sample_pos[0];
	c = load_file_into_buffer("cdrom:BOMB.RAW;1");
	SsUpload(file_buffer, c, sample_pos[1]);
	
	/* ... */
	if(c&0x7)
	{
		c|=0x7;
		c++;
	}
	
	sample_pos[2] = c + sample_pos[1];
	c = load_file_into_buffer("cdrom:APPLE.RAW;1");
	SsUpload(file_buffer, c, sample_pos[2]);
	
	SsVoiceStartAddr(0, sample_pos[0]);
	SsVoiceStartAddr(1, sample_pos[1]);
	SsVoiceStartAddr(2, sample_pos[2]);
	
	SsVoiceVol(0, 0x3fff, 0x3fff);
	SsVoiceVol(1, 0x3fff, 0x3fff);
	SsVoiceVol(2, 0x3fff, 0x3fff);
	
	SsVoicePitch(0, 0x1000 / (44100 / 11025));
	SsVoicePitch(1, 0x1000 / (44100 / 11025));
	SsVoicePitch(2, 0x1000);
	
	game_setup();
	
	SetVBlankHandler(game_vblank_handler);
	
	
	while(1)
		game_run();
		
	return 0;
}
コード例 #14
0
ファイル: main.c プロジェクト: valeriangalliat/breakout
static inline void boot()
{
    RECT rect;
    CLOCK clock;

    RECT ball_rect;
    VEL ball_vel;
    BALL ball;

    ball.rect = ball_rect;
    ball.vel = ball_vel;

    RECT bat_rect;
    BAT bat;

    bat.rect = bat_rect;

    char chlives[4];

    chlives[0] = '=';
    chlives[1] = '$';
    chlives[2] = '&';
    chlives[3] = '|';

    BTYPE btypes[NBTYPES];

    btypes[0].lives = 1;
    btypes[0].score = 2;

    btypes[1].lives = 2;
    btypes[1].score = 4;

    btypes[2].lives = 3;
    btypes[2].score = 8;

    btypes[3].lives = 4;
    btypes[3].score = 16;

    BRICK bricks[NBRICKS];

    int konami_keys[10];

    konami_keys[0] = KEY_UP;
    konami_keys[1] = KEY_UP;
    konami_keys[2] = KEY_DOWN;
    konami_keys[3] = KEY_DOWN;
    konami_keys[4] = KEY_LEFT;
    konami_keys[5] = KEY_RIGHT;
    konami_keys[6] = KEY_LEFT;
    konami_keys[7] = KEY_RIGHT;
    konami_keys[8] = 'B';
    konami_keys[9] = 'A';

    KONAMI konami;

    konami.nkeys = 10;
    konami.keys = konami_keys;

    GAME game;

    game.win = stdscr;
    game.rect = rect;
    game.clock = clock;
    game.ball = &ball;
    game.bat = &bat;

    game.nchlives = NCHLIVES;
    game.chlives = chlives;

    game.nbtypes = NBTYPES;
    game.btypes = btypes;

    game.nbricks = NBRICKS;
    game.rbricks = NBRICKS;
    game.bricks = bricks;

    game.title = "Ncurses C Breakout";

#ifdef DEBUG
    game.debug = true;
#else
    game.debug = false;
#endif

    game.konami = &konami;

    game_setup(&game);
    game_run(&game);
}