Ignore:
Timestamp:
May 15, 2011, 6:22:13 AM (11 years ago)
Author:
Sam Hocevar
Message:

imlib: move generic code back into the platform-agnostic imlib.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • abuse/trunk/src/imlib/event.cpp

    r652 r656  
    3535{
    3636    CHECK(screen && pal);
    37     last_keystat = get_key_flags();
    3837    m_pending = 0;
    3938
     
    6261
    6362    m_sprite = new sprite(screen, im, 100, 100);
    64     m_pos = m_lastpos = screen->Size() / 2;
    65     m_button = m_lastbutton = 0;
     63    m_pos = screen->Size() / 2;
    6664    m_center = vec2i(0, 0);
     65    m_button = 0;
    6766
    6867    // Platform-specific stuff
     
    7675{
    7776    ;
     77}
     78
     79void EventHandler::Get(Event &ev)
     80{
     81    // Sleep until there are events available
     82    while(!m_pending)
     83    {
     84        Timer tmp;
     85        IsPending();
     86
     87        if (!m_pending)
     88            tmp.WaitMs(1);
     89    }
     90
     91    // Return first queued event if applicable
     92    Event *ep = (Event *)m_events.first();
     93    if(ep)
     94    {
     95        ev = *ep;
     96        m_events.unlink(ep);
     97        delete ep;
     98        m_pending = m_events.first() != NULL;
     99        return;
     100    }
     101
     102    // Return an event from the platform-specific system
     103    SysEvent(ev);
    78104}
    79105
Note: See TracChangeset for help on using the changeset viewer.