Changeset 1699


Ignore:
Timestamp:
Aug 6, 2012, 2:51:36 AM (7 years ago)
Author:
rez
Message:

setup menu - basic option listing (F1/key_up/key_down)

Location:
trunk/tools/neercs/video
Files:
2 edited

Legend:

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

    r1694 r1699  
    9393ivec2 canvas_char(0,0);    // canvas char number
    9494ivec2 canvas_size(0,0);    // caca size
     95/* setup variable */
     96int setup_option=4;             // selected option
     97ivec2 setup_p(1,1);             // position [x,y]
     98ivec2 setup_size(32,0);         // size [w,h]
     99ivec2 setup_color(0x678,0x234); // size [w,h]
     100char const *setup_text[]={"remanency","blur","glow","deform","color","retrace","offset","noise","aberration","scanline"};
    95101/* common variable */
    96102float value, angle, radius, scale, speed;
     
    103109vec2 glow_small(1.0f,1.0f);     // small glow radius [normal,deform]
    104110//vec3 radial(2.0f,0.8f,0);     // radial [mix,strength,color mode]
    105 //---------------------------------[IDEAS] http://www.youtube.com/watch?v=d1qEP2vMe-I
     111//------------------------------// [IDEAS] http://www.youtube.com/watch?v=d1qEP2vMe-I
    106112float postfx_deform = 0.625f;   // deformation ratio
    107113vec3 postfx_filter(0.875f,0.75f,1.0f);// color filter [red,green,blue]
     
    269275    caca_set_canvas_size(m_caca, canvas_char.x, canvas_char.y);
    270276
     277    setup_size.y = 10;//sizeof setup_text;
     278    setup_p = (canvas_char - setup_size) / 2;
     279
    271280    InitDraw();
    272281    return true;
     
    278287    m_pause(false),
    279288    m_polygon(true),
     289    m_setup(true),
    280290    m_shader(true),
    281291    m_shader_remanency(true),
     
    304314    if (Input::GetButtonState(27/*SDLK_ESCAPE*/))
    305315        Ticker::Shutdown();
    306     //if (Input::GetButtonState(282/*SDLK_F1*/))
    307     //    LEAULE();
    308     if (Input::GetButtonState(283/*SDLK_F2*/)&&(timer-timer_key>timer_key_repeat))
    309         {
     316    if (Input::GetButtonState(282/*SDLK_F1*/) && (timer - timer_key > timer_key_repeat))
     317        {
     318        m_setup = !m_setup;
     319        timer_key = timer;
     320        }
     321    if (Input::GetButtonState(283/*SDLK_F2*/) && (timer - timer_key > timer_key_repeat))
     322        {
     323        /*
    310324        m_polygon = !m_polygon;
    311325        polygon_fillmode = (m_polygon)?GL_FILL:GL_LINE;
    312326        glPolygonMode(GL_FRONT, polygon_fillmode);
     327        */
    313328        timer_key = timer;
    314329        }
    315     if (Input::GetButtonState(284/*SDLK_F3*/)&&(timer-timer_key>timer_key_repeat))
    316         {
    317         m_shader = !m_shader;
     330    if (Input::GetButtonState(284/*SDLK_F3*/) && (timer - timer_key > timer_key_repeat))
     331        {
     332        m_shader_blur = !m_shader_blur;
     333        m_shader_glow = !m_shader_glow;
    318334        timer_key = timer;
    319335        }
     
    326342        {
    327343        Pause();
     344        }
     345    if (Input::GetButtonState(273/*SDLK_UP*/)&&(timer-timer_key>timer_key_repeat))
     346        {
     347        setup_option--;
     348        if (setup_option < 0) setup_option = setup_size.y - 1;
     349        timer_key = timer;
     350        }
     351    if (Input::GetButtonState(274/*SDLK_DOWN*/)&&(timer-timer_key>timer_key_repeat))
     352        {
     353        setup_option++;
     354        if (setup_option > setup_size.y - 1) setup_option = 0;
     355        timer_key = timer;
    328356        }
    329357
     
    383411        }
    384412    }
     413    /* draw setup */
     414    if (m_setup)
     415    {
     416        /* title */
     417        caca_set_color_argb(m_caca, setup_color.y, setup_color.x);
     418        caca_draw_line(m_caca, setup_p.x, setup_p.y, setup_p.x + setup_size.x, setup_p.y,' ');
     419        caca_put_str(m_caca, setup_p.x + setup_size.x / 2 - 3, setup_p.y, "SETUP");
     420        /* entries */
     421        caca_set_color_argb(m_caca, setup_color.x, setup_color.y);
     422        caca_fill_box(m_caca, setup_p.x, setup_p.y + 1, setup_size.x + 1, setup_size.y,' ');
     423        for (int i = 0; i < setup_size.y; i++)
     424        {
     425            int y = setup_p.y + 1 + i;
     426            if (setup_option != i)
     427            {
     428                caca_set_color_argb(m_caca, setup_color.x, setup_color.y);
     429                caca_put_str(m_caca, setup_p.x + 1, y, setup_text[i]);
     430            }
     431            else
     432            {
     433                caca_set_color_argb(m_caca, setup_color.y, setup_color.x);
     434                caca_draw_line(m_caca, setup_p.x, y, setup_p.x + setup_size.x, y,' ');
     435                caca_put_str(m_caca, setup_p.x + 1, y, setup_text[i]);
     436            }
     437        }
     438    }
    385439
    386440    Draw2D();
    387441    Draw3D();
     442
    388443}
    389444
  • trunk/tools/neercs/video/render.h

    r1644 r1699  
    3131    bool m_pause;
    3232    bool m_polygon;
     33    bool m_setup;
    3334    bool m_shader;
    3435    bool m_shader_blur;
Note: See TracChangeset for help on using the changeset viewer.