Changeset 1701


Ignore:
Timestamp:
Aug 7, 2012, 2:47:15 AM (7 years ago)
Author:
rez
Message:

added items to setup menu (unfinished)

Location:
trunk/tools/neercs
Files:
2 edited

Legend:

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

    r1685 r1701  
    132132    caca_put_str(m_caca, w - 12, h - 2, "CACA RULEZ");
    133133
     134/*
     135  _______
     136 /      /|
     137/______/ |
     138|      | |
     139|  :D  | /
     140|______|/
     141*/
     142
    134143    int lolcube_x = w / 2 - 5 + (w - 10) * lol::cos(m_time / 2);
    135144    int lolcube_y = h - 5 - abs ((h - 5) * lol::sin(m_time * 4));
  • trunk/tools/neercs/video/render.cpp

    r1700 r1701  
    5454float timer = 0;           // timer
    5555float timer_key = 0;       // key timer
    56 float timer_key_repeat = 0.125f;// key repeat delay
     56float timer_key_repeat = 0.25f;// key repeat delay
    5757/* window variable */
    5858ivec2 screen_size;         // screen size
     
    9494ivec2 canvas_size(0,0);    // caca size
    9595/* setup variable */
    96 int setup_option=4;             // selected option
     96int setup_option=0;             // selected option
     97int setup_option_n=6;           // option number
     98int setup_item=-1;              // selected item
     99int setup_item_n=8;             // item number
    97100ivec2 setup_p(1,1);             // position [x,y]
    98 ivec2 setup_size(32,0);         // size [w,h]
     101ivec3 setup_size(30,0,12);      // size [w,h,split]
    99102ivec2 setup_color(0x678,0x234); // size [w,h]
    100 char const *setup_text[]={"remanency","blur","glow","deform","color","retrace","offset","noise","aberration","scanline"};
     103char const *setup_text[] = {
     104    "remanency",
     105        "buffer new frame",
     106        "buffer old frame",
     107        "source",
     108        "buffer",
     109        "",
     110        "",
     111        "",
     112        "",
     113    "blur/glow",
     114        "blur center",
     115        "blur corner",
     116        "glow large center",
     117        "glow large corner",
     118        "glow small center",
     119        "glow small corner",
     120        "",
     121        "",
     122    "color",
     123        "filter red",
     124        "filter green",
     125        "filter blue",
     126        "brightness",
     127        "contrast",
     128        "grayscale",
     129        "",
     130        "",
     131    "modifier",
     132        "deform ratio",
     133        "retrace color",
     134        "retrace length",
     135        "retrace speed",
     136        "offset h",
     137        "offset v",
     138        "noise",
     139        "aberration",
     140    "moire",
     141        "h base",
     142        "h variable",
     143        "h repeat x",
     144        "h repeat y",
     145        "v base",
     146        "v variable",
     147        "v repeat x",
     148        "v repeat y",
     149    "scanline",
     150        "h base",
     151        "h variable",
     152        "h repeat x",
     153        "h repeat y",
     154        "v base",
     155        "v variable",
     156        "v repeat x",
     157        "v repeat y"
     158    };
    101159/* common variable */
    102160float value, angle, radius, scale, speed;
     
    104162vec2 buffer(0.75f,0.25f);       // [new frame mix,old frame mix]
    105163vec2 remanency(0.25f,0.75f);    // remanency [source mix,buffer mix]
    106 vec2 blur(0.25f,0.75f);         // glow radius [normal,deform]
     164vec2 blur(0.25f,0.75f);         // glow radius [center,corner]
    107165vec2 glow_mix(0.5f,0.5f);       // glow mix [source mix,glow mix]
    108 vec2 glow_large(2.0f,2.0f);     // large glow radius [normal,deform]
    109 vec2 glow_small(1.0f,1.0f);     // small glow radius [normal,deform]
     166vec2 glow_large(2.0f,2.0f);     // large glow radius [center,corner]
     167vec2 glow_small(1.0f,1.0f);     // small glow radius [center,corner]
    110168//vec3 radial(2.0f,0.8f,0);     // radial [mix,strength,color mode]
    111169//------------------------------// [IDEAS] http://www.youtube.com/watch?v=d1qEP2vMe-I
    112170float postfx_deform = 0.625f;   // deformation ratio
    113171vec3 postfx_filter(0.875f,0.75f,1.0f);// color filter [red,green,blue]
    114 vec3 postfx_color(1.75f,1.75f,0.5f);  // color modifier [brightness,contrast,gray]
     172vec3 postfx_color(1.75f,1.75f,0.5f);  // color modifier [brightness,contrast,grayscale]
    115173vec3 postfx_retrace(0.025f,2.0f,4.0f);// retrace [color,length,speed]
    116174vec2 postfx_offset(3.0f,3.0f);  // random line [horizontal,vertical]
     
    275333    caca_set_canvas_size(m_caca, canvas_char.x, canvas_char.y);
    276334
    277     setup_size.y = 10;//sizeof setup_text;
    278     setup_p = (canvas_char - setup_size) / 2;
     335    setup_size.y = ((setup_option_n > setup_item_n) ? setup_option_n : setup_item_n) + 1;
     336    setup_p = (canvas_char - setup_size.xy) / 2;
    279337
    280338    InitDraw();
     
    315373        Ticker::Shutdown();
    316374    if (Input::GetButtonState(282/*SDLK_F1*/) && (timer - timer_key > timer_key_repeat))
    317         {
     375    {
    318376        m_setup = !m_setup;
    319377        timer_key = timer;
    320         }
     378    }
    321379    if (Input::GetButtonState(283/*SDLK_F2*/) && (timer - timer_key > timer_key_repeat))
    322         {
     380    {
    323381        /*
    324382        m_polygon = !m_polygon;
     
    327385        */
    328386        timer_key = timer;
    329         }
     387    }
    330388    if (Input::GetButtonState(284/*SDLK_F3*/) && (timer - timer_key > timer_key_repeat))
    331         {
     389    {
    332390        m_shader_blur = !m_shader_blur;
    333391        m_shader_glow = !m_shader_glow;
    334392        timer_key = timer;
    335         }
     393    }
    336394    if (Input::GetButtonState(285/*SDLK_F4*/)&&(timer-timer_key>timer_key_repeat))
    337         {
     395    {
    338396        m_shader_postfx = !m_shader_postfx;
    339397        timer_key = timer;
    340         }
     398    }
    341399    if (Input::GetButtonState(286/*SDLK_F5*/))
    342         {
     400    {
    343401        Pause();
    344         }
     402    }
    345403    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;
     404    {
     405        if (setup_item == -1)
     406        {
     407            setup_option--;
     408            if (setup_option < 0) setup_option = setup_option_n - 1;
     409        }
     410        else
     411        {
     412            setup_item--;
     413            if (setup_item < 0) setup_item = setup_item_n - 1;
     414        }
    349415        timer_key = timer;
    350         }
     416    }
    351417    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;
     418    {
     419        if (setup_item == -1)
     420        {
     421            setup_option++;
     422            if (setup_option > setup_option_n - 1) setup_option = 0;
     423        }
     424        else
     425        {
     426            setup_item++;
     427            if (setup_item > setup_item_n - 1) setup_item = 0;
     428        }
    355429        timer_key = timer;
    356         }
     430    }
     431    if (Input::GetButtonState(276/*SDLK_LEFT*/)&&(timer-timer_key>timer_key_repeat))
     432    {
     433        setup_item = -1;
     434        timer_key = timer;
     435    }
     436    if (Input::GetButtonState(275/*SDLK_RIGHT*/)&&(timer-timer_key>timer_key_repeat))
     437    {
     438        setup_item = 0;
     439        timer_key = timer;
     440    }
    357441
    358442    Entity::TickDraw(seconds);
     
    414498    if (m_setup)
    415499    {
     500        /* background */
     501        caca_set_color_argb(m_caca, setup_color.x, setup_color.y);
     502        caca_fill_box(m_caca, setup_p.x, setup_p.y, setup_size.x + 1, setup_size.y,' ');
     503        caca_draw_line(m_caca, setup_p.x + setup_size.z - 1, setup_p.y + 1, setup_p.x + setup_size.z - 1, setup_p.y + setup_size.y - 1,'|');
    416504        /* title */
    417505        caca_set_color_argb(m_caca, setup_color.y, setup_color.x);
    418506        caca_draw_line(m_caca, setup_p.x, setup_p.y, setup_p.x + setup_size.x, setup_p.y,' ');
    419507        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++)
     508        /* display option */
     509        for (int i = 0; i < setup_option_n; i++)
    424510        {
    425511            int y = setup_p.y + 1 + i;
     512            int k = i * (setup_item_n + 1);
    426513            if (setup_option != i)
    427514            {
    428515                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]);
     516                caca_put_str(m_caca, setup_p.x + 1, y, setup_text[k]);
    430517            }
    431518            else
    432519            {
    433520                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]);
     521                caca_draw_line(m_caca, setup_p.x, y, setup_p.x + setup_size.z - 2, y,' ');
     522                caca_put_str(m_caca, setup_p.x + 1, y, setup_text[k]);
     523            }
     524        }
     525        /* display item */
     526        for (int i = 0; i < setup_item_n; i++)
     527        {
     528            int y = setup_p.y + 1 + i;
     529            int k = setup_option * (setup_item_n + 1) + 1;
     530            if (setup_option != i)
     531            {
     532                caca_set_color_argb(m_caca, setup_color.x, setup_color.y);
     533                caca_put_str(m_caca, setup_p.x + setup_size.z + 1, y, setup_text[k + i]);
     534            }
     535            else
     536            {
     537                caca_set_color_argb(m_caca, setup_color.y, setup_color.x);
     538                caca_draw_line(m_caca, setup_p.x + setup_size.z + 1, y, setup_p.x + setup_size.x, y,' ');
     539                caca_put_str(m_caca, setup_p.x + setup_size.z + 1, y, setup_text[k + i]);
    436540            }
    437541        }
Note: See TracChangeset for help on using the changeset viewer.