Example #1
0
void MyUserInterfaceIdleHook(void) { /*94 words*/
    if (UartFill()/*PERIP(UART_STATUS) & UART_ST_RXFULL*/) {
	int cmd = UartGetByte();
	if (cmd == 'C') {
	    cs.cancel = 1;
	    player.pauseOn = 0;
	    putch('c');
	} else if (cmd == '+') {
	    KeyEventHandler(ke_volumeUp2);
	    putch(player.volume);
	} else if (cmd == '-') {
	    KeyEventHandler(ke_volumeDown2);
	    putch(player.volume);
	} else if (cmd == 'p') {
	    /* pause */
	    KeyEventHandler(ke_pauseToggle);
	    putch(player.pauseOn ? 'p' : 'P');
	} else {
	    putch(cmd);
	}
    }
    if (uiTrigger) {
	uiTrigger = 0;
	/* ~16 times per second */
    }
}
Example #2
0
File: rc5.c Project: zbanks/oggvosh
void MyUserInterfaceIdleHook(void) {
    if (uiTrigger) {
	u_int16 key = Rc5GetFIFO();
	register u_int16 t = key;
	if (t && (t & 0x3c0) == RC5_SYS_TVSET) {
	    register struct KeyMapping *k = rc5Keys;
	    t &= 0x7ff;
#if 1
	    /* direct access to songs 0..9 */
	    if (t >= RC5_CMD_0 && t <= RC5_CMD_9 && key != oldRc5) {
		player.nextFile = t - RC5_CMD_0;
		player.pauseOn = 0;
		cs.cancel = 1;
	    }
#endif
	    while (k->event) {
		if (t == (k->key & 0x7ff)) {
		    if ((s_int16)k->key >= 0 || key != oldRc5) {
			KeyEventHandler(k->event);
		    }
		    break;
		}
		k++;
	    }
	    oldRc5 = key;
	}
	UserInterfaceIdleHook();
    }
}
Example #3
0
	TiendaEscena::TiendaEscena() {
		onTimerTick = gcnew EventHandler(this, &TiendaEscena::timerTick);
		onKeyDown = gcnew KeyEventHandler(this, &TiendaEscena::teclaDown);
		onMouseClick = gcnew MouseEventHandler(this, &TiendaEscena::mouseClick);
		modo_comprar = false;
		modo_vender = true;
		crearCartas();
	}
Example #4
0
	CampusEscena::CampusEscena()
	{
		onTimerTick = gcnew EventHandler(this, &CampusEscena::timerTick);
		onKeyDown = gcnew KeyEventHandler(this, &CampusEscena::teclaDown);
		onKeyUp = gcnew KeyEventHandler(this, &CampusEscena::teclaUp);
		onMouseClick = gcnew MouseEventHandler(this, &CampusEscena::mouseClick);

		Mapas::plazuela_mapa = gcnew PlazuelaMapa();
		Mapas::pabellonA_mapa = gcnew PabellonAMapa();
		Mapas::pabellonB_mapa = gcnew PabellonBMapa();
		Mapas::sotano_mapa = gcnew SotanoMapa();
		Mapas::jardin_mapa = gcnew JardinMapa();
		Mapa::mapa_actual = Mapas::plazuela_mapa;

		Marco::marco = gcnew Marco(gcnew Posicion(9, 9, true));
		PROFESORES::Profesor1 = gcnew Profesor(1, Mapas::plazuela_mapa, gcnew Posicion(16, 3, true));
		PROFESORES::Profesor2 = gcnew Profesor(3, Mapas::pabellonB_mapa, gcnew Posicion(16, 11, true));
		PROFESORES::Profesor3 = gcnew Profesor(5, Mapas::sotano_mapa, gcnew Posicion(16, 6, true));
		PROFESORES::Profesor4 = gcnew Profesor(7, Mapas::jardin_mapa, gcnew Posicion(11, 4, true));
		PROFESORES::Profesor5 = gcnew Profesor(9, Mapas::pabellonA_mapa, gcnew Posicion(2, 10, true));
	}
Example #5
0
	IntroduccionEscena::IntroduccionEscena() {
		onTimerTick = gcnew EventHandler(this, &IntroduccionEscena::timerTick);
		onKeyDown = gcnew KeyEventHandler(this, &IntroduccionEscena::teclaDown);
	}
Example #6
0
/*************************************************
Function:start()
Description:游戏界面入口点
Calls:(none)
Input:(none)
Output:(none)
Return:(int)状态正常0,不正常-1
Others:         // 其它说明
*************************************************/
int start()
{



    /* SDL初始化*/
    if( SDL_Init( SDL_INIT_VIDEO|SDL_INIT_TIMER ) < 0 )
    {
        printf( "SDL could not initialize! SDL_Error: %s\n", SDL_GetError() );
        return 1;
    }

    //创建窗口对象
    window = SDL_CreateWindow("F**k Bird", //标题
                              SDL_WINDOWPOS_CENTERED,//横向剧中
                              SDL_WINDOWPOS_CENTERED,//纵向居中
                              SCREEN_WIDTH,//窗口宽度
                              SCREEN_HEIGHT, //窗口高度
                              SDL_WINDOW_SHOWN );//窗口样式:创建后立即显示并全屏
    if( window == NULL )
    {
        printf( "Window could not be created! SDL_Error: %s\n", SDL_GetError() );
        return 1;
    }

    //创建渲染器
    screenRen = SDL_CreateRenderer(window,
                                   -1,
                                   SDL_RENDERER_ACCELERATED| SDL_RENDERER_PRESENTVSYNC);
    if( screenRen == NULL )
    {
        printf( "Render could not be get! SDL_Error: %s\n", SDL_GetError() );
        return 1;
    }

    ScreenInitialize();

    MoveTimer = SDL_AddTimer(1,MainCallBack,NULL);
    //事件处理循环
    while (1)
    {


        SDL_Event e;
        if (SDL_PollEvent(&e))
        {
            if (e.type == SDL_QUIT)
            {
                break;
            }
            else if ( e.type == SDL_KEYDOWN)
            {
              //  printf("KeyDown");
                 KeyEventHandler(&(e.key));

            }
            else if (e.type == SDL_MOUSEBUTTONDOWN)
            {
                MouseEventHandler();
            }
        }


    }



    SDL_UpdateWindowSurface( window );
    // SDL_Delay( 5000 );



    SDL_DestroyWindow( window );
    SDL_Quit();
    return 0;

}