Exemplo n.º 1
0
int PDC_get_key(void)
{
    switch (event.type)
    {
    case SDL_QUIT:
        exit(1);
    case SDL_WINDOWEVENT:
        switch (event.window.event)
        {
        case SDL_WINDOWEVENT_SIZE_CHANGED:
            pdc_sheight = event.window.data2;
            pdc_swidth = event.window.data1;

            pdc_screen = SDL_GetWindowSurface(pdc_window);
            touchwin(curscr);
            wrefresh(curscr);

            if (!SP->resized)
            {
                SP->resized = TRUE;
                SP->key_code = TRUE;
                return KEY_RESIZE;
            }
            break;
        case SDL_WINDOWEVENT_RESTORED:
        case SDL_WINDOWEVENT_EXPOSED:
            SDL_UpdateWindowSurface(pdc_window);
            break;
        }
        break;
    case SDL_MOUSEMOTION:
        SDL_ShowCursor(SDL_ENABLE);
    case SDL_MOUSEBUTTONUP:
    case SDL_MOUSEBUTTONDOWN:
    case SDL_MOUSEWHEEL:
        oldkey = SDLK_SPACE;
        if (SP->_trap_mbe)
            return _process_mouse_event();
        break;
    case SDL_KEYUP:
    case SDL_KEYDOWN:
    case SDL_TEXTINPUT:
        PDC_mouse_set();
        return _process_key_event();
    case SDL_USEREVENT:
        PDC_blink_text();
    }

    return -1;
}
Exemplo n.º 2
0
int PDC_set_blink(bool blinkon)
{
    if (pdc_color_started)
        COLORS = 256;

    if (blinkon)
    {
        if (!(SP->termattrs & A_BLINK))
        {
            SP->termattrs |= A_BLINK;
            PDC_blink_text();
        }
    }
    else
    {
        if (SP->termattrs & A_BLINK)
        {
            SP->termattrs &= ~A_BLINK;
            PDC_blink_text();
        }
    }

    return OK;
}