Example #1
0
void TitleBar::InitializeComponent()
{
	MouseDown += MouseEventHandler(this, &TitleBar::TitleBar_OnMouseDown);
	MouseMove += MouseEventHandler(this, &TitleBar::TitleBar_OnMouseMove);
	MouseUp	+= MouseEventHandler(this, &TitleBar::TitleBar_OnMouseUp);
	Paint += PaintEventHandler(this, &TitleBar::TitleBar_OnPaint);
	Leave += EventHandler<>(this, &TitleBar::TitleBar_OnLeave);
}
Example #2
0
static DWORD
WINAPI
PumpConsoleInput(LPVOID Parameter)
{
    HANDLE ConsoleInput = (HANDLE)Parameter;
    INPUT_RECORD InputRecord;
    DWORD Count;

    while (VdmRunning)
    {
        /* Make sure the task event is signaled */
        WaitForSingleObject(VdmTaskEvent, INFINITE);

        /* Wait for an input record */
        if (!ReadConsoleInput(ConsoleInput, &InputRecord, 1, &Count))
        {
            DWORD LastError = GetLastError();
            DPRINT1("Error reading console input (0x%p, %lu) - Error %lu\n", ConsoleInput, Count, LastError);
            return LastError;
        }

        ASSERT(Count != 0);

        /* Check the event type */
        switch (InputRecord.EventType)
        {
            /*
             * Hardware events
             */
            case KEY_EVENT:
                KeyboardEventHandler(&InputRecord.Event.KeyEvent);
                break;

            case MOUSE_EVENT:
                MouseEventHandler(&InputRecord.Event.MouseEvent);
                break;

            case WINDOW_BUFFER_SIZE_EVENT:
                ScreenEventHandler(&InputRecord.Event.WindowBufferSizeEvent);
                break;

            /*
             * Interface events
             */
            case MENU_EVENT:
                MenuEventHandler(&InputRecord.Event.MenuEvent);
                break;

            case FOCUS_EVENT:
                FocusEventHandler(&InputRecord.Event.FocusEvent);
                break;

            default:
                break;
        }
    }

    return 0;
}
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
pascal OSStatus wxMacWindowEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
{
    OSStatus result = eventNotHandledErr ;

    switch ( GetEventClass( event ) )
    {
        case kEventClassKeyboard :
            result = KeyboardEventHandler( handler, event , data ) ;
            break ;
        case kEventClassTextInput :
            result = TextInputEventHandler( handler, event , data ) ;
            break ;
        case kEventClassWindow :
            result = WindowEventHandler( handler, event , data ) ;
            break ;
        case kEventClassMouse :
            result = MouseEventHandler( handler, event , data ) ;
            break ;
        default :
            break ;
    }
    return result ;
}
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;

}
Example #7
0
static DWORD
WINAPI
ConsoleEventThread(LPVOID Parameter)
{
    HANDLE ConsoleInput = (HANDLE)Parameter;
    HANDLE WaitHandles[2];
    DWORD  WaitResult;

    /*
     * For optimization purposes, Windows (and hence ReactOS, too, for
     * compatibility reasons) uses a static buffer if no more than five
     * input records are read. Otherwise a new buffer is used.
     * The client-side expects that we know this behaviour.
     * See consrv/coninput.c
     *
     * We exploit here this optimization by also using a buffer of 5 records.
     */
    INPUT_RECORD InputRecords[5];
    ULONG NumRecords, i;

    WaitHandles[0] = VdmTaskEvent;
    WaitHandles[1] = GetConsoleInputWaitHandle();

    while (VdmRunning)
    {
        /* Make sure the task event is signaled */
        WaitResult = WaitForMultipleObjects(ARRAYSIZE(WaitHandles),
                                            WaitHandles,
                                            TRUE,
                                            INFINITE);
        switch (WaitResult)
        {
            case WAIT_OBJECT_0 + 0:
            case WAIT_OBJECT_0 + 1:
                break;
            default:
                return GetLastError();
        }

        /* Wait for an input record */
        if (!ReadConsoleInputExW(ConsoleInput,
                                 InputRecords,
                                 ARRAYSIZE(InputRecords),
                                 &NumRecords,
                                 CONSOLE_READ_CONTINUE))
        {
            DWORD LastError = GetLastError();
            DPRINT1("Error reading console input (0x%p, %lu) - Error %lu\n", ConsoleInput, NumRecords, LastError);
            return LastError;
        }

        // ASSERT(NumRecords != 0);
        if (NumRecords == 0)
        {
            DPRINT1("Got NumRecords == 0!\n");
            continue;
        }

        /* Dispatch the events */
        for (i = 0; i < NumRecords; i++)
        {
            /* Check the event type */
            switch (InputRecords[i].EventType)
            {
                /*
                 * Hardware events
                 */
                case KEY_EVENT:
                    KeyboardEventHandler(&InputRecords[i].Event.KeyEvent);
                    break;

                case MOUSE_EVENT:
                    MouseEventHandler(&InputRecords[i].Event.MouseEvent);
                    break;

                case WINDOW_BUFFER_SIZE_EVENT:
                    ScreenEventHandler(&InputRecords[i].Event.WindowBufferSizeEvent);
                    break;

                /*
                 * Interface events
                 */
                case MENU_EVENT:
                    MenuEventHandler(&InputRecords[i].Event.MenuEvent);
                    break;

                case FOCUS_EVENT:
                    FocusEventHandler(&InputRecords[i].Event.FocusEvent);
                    break;

                default:
                    DPRINT1("Unknown input event type 0x%04x\n", InputRecords[i].EventType);
                    break;
            }
        }

        /* Let the console subsystem queue some new events */
        Sleep(10);
    }

    return 0;
}