Changeset 1686


Ignore:
Timestamp:
Aug 1, 2012, 1:57:26 AM (7 years ago)
Author:
rez
Message:

added delay to key repeat (float timer_key_repeat)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/neercs/video/render.cpp

    r1685 r1686  
    5151float farplane = 1000.0f;  // farplane
    5252int polygon_fillmode = GL_FILL; // fill mode
    53 bool key_state = 0;        // key state
     53/* timer variable */
     54float timer = 0;           // timer
     55float timer_key = 0;       // key timer
     56float timer_key_repeat = 0.25f;// key repeat delay
    5457/* window variable */
    5558ivec2 screen_size;         // screen size
     
    303306    //if (Input::GetButtonState(282/*SDLK_F1*/))
    304307    //    LEAULE();
    305     if (Input::GetButtonState(283/*SDLK_F2*/))
    306         {
    307         m_polygon=!m_polygon;
    308         polygon_fillmode=(m_polygon)?GL_FILL:GL_LINE;
    309         glPolygonMode(GL_FRONT,polygon_fillmode);
    310         }
    311     if (Input::GetButtonState(284/*SDLK_F3*/)&&key_state!=284)
    312         {
    313         m_shader=!m_shader;
    314         key_state=284;
    315         }
    316     if (Input::GetButtonState(285/*SDLK_F4*/))
    317         m_shader_postfx=!m_shader_postfx;
    318     if (Input::GetButtonState(286/*SDLK_F5*/))
     308    if (Input::GetButtonState(283/*SDLK_F2*/)&&(timer-timer_key>timer_key_repeat))
     309        {
     310        m_polygon = !m_polygon;
     311        polygon_fillmode = (m_polygon)?GL_FILL:GL_LINE;
     312        glPolygonMode(GL_FRONT, polygon_fillmode);
     313        timer_key = timer;
     314        }
     315    if (Input::GetButtonState(284/*SDLK_F3*/)&&(timer-timer_key>timer_key_repeat))
     316        {
     317        m_shader = !m_shader;
     318        timer_key = timer;
     319        }
     320    if (Input::GetButtonState(285/*SDLK_F4*/)&&(timer-timer_key>timer_key_repeat))
     321        {
     322        m_shader_postfx = !m_shader_postfx;
     323        timer_key = timer;
     324        }
     325    if (Input::GetButtonState(286/*SDLK_F5*/)&&(timer-timer_key>timer_key_repeat))
     326        {
    319327        Pause();
     328        timer_key = timer;
     329        }
    320330
    321331    Entity::TickDraw(seconds);
     
    330340    // timer
    331341    if (!m_pause)
    332         main_angle += seconds * 100.0f * PID;
     342    {
     343        timer += seconds;
     344        main_angle = timer * 100.0f * PID;
     345    }
    333346    if (sync_flag)
    334347    {
Note: See TracChangeset for help on using the changeset viewer.