Ejemplo n.º 1
0
/// Loop run while idle
static void main_loop_init(void)
{
	// Run next frame, do not auto-reload
	static struct loop_timer frame_timer = {
		.timer_cb = megawifi_init_cb,
		.frames = 1
	};
	static struct loop_func megawifi_loop = {
		.func_cb = idle_cb
	};

	loop_init(MW_MAX_LOOP_FUNCS, MW_MAX_LOOP_TIMERS);
	loop_timer_add(&frame_timer);
	loop_func_add(&megawifi_loop);
}

/// Global initialization
static void init(void)
{
	// Initialize memory pool
	mp_init(0);
	// Initialize VDP
	VdpInit();
	// Initialize game loop
	main_loop_init();
	// Initialize MegaWiFi
	mw_init(cmd_buf, MW_BUFLEN);
}
Ejemplo n.º 2
0
/* the loop itself */
void wait_for_players ()
{
    SDL_Event event;

    mw_init ();

    do {
        if (s_fetchevent (&event) != 0)
            switch (event.type) {
            case (SDL_QUIT):
                bman.state = GS_quit;
                break;
            }

        /*
         * check some little things and do the network stuff
         */
        network_loop ();

        /*
         * the drawing stuff
         */
        if (mw_check_screenredraw()) {
            d_printf ("Draw Status\n");
            gfx_blitdraw ();
            draw_logo ();
            if (bman.gametype==GT_team) mw_draw_all_teams();
            else mw_draw_all_player ();
        }
        gfx_blitdraw ();

        /*
         *	input handling
         */
        keyb_loop (&event);
        mw_keys_loop ();

        chat_loop (&event);
        chat.active = 1;

        s_calctimesync ();
    } while (bman.state == GS_wait && bman.sock != -1);

    mw_shutdown ();
};