소스 검색

scrollable option list in setup

master
부모
커밋
831211da35
4개의 변경된 파일76개의 추가작업 그리고 43개의 파일을 삭제
  1. +1
    -2
      neercs/neercs.cpp
  2. +6
    -7
      neercs/term/term.cpp
  3. +4
    -5
      neercs/video/copper.lolfx
  4. +65
    -29
      neercs/video/render.cpp

+ 1
- 2
neercs/neercs.cpp 파일 보기

@@ -87,5 +87,4 @@ int main(int argc, char **argv)
app.Run();

return EXIT_SUCCESS;
}

}

+ 6
- 7
neercs/term/term.cpp 파일 보기

@@ -94,7 +94,7 @@ void Term::DrawFancyShit()
int logo_x = (w - 46) / 2;
int logo_y = h / 2 - 2;

caca_set_color_argb(m_caca, 0x8ac, bg_color);
caca_set_color_argb(m_caca, 0xbac, bg_color);
//caca_set_color_argb(m_caca, hex_color(0.5f + 0.5f * lol::cos(m_time * 3 ), 0.5f, 0.5f + 0.25f * lol::sin(m_time * 3 )), bg_color);
caca_put_str(m_caca, logo_x + 3, logo_y ,"__ _________ ______ ______ ______ ______");
//caca_set_color_argb(m_caca, hex_color(0.5f + 0.5f * lol::cos(m_time * 3 + M_PI / 4 * 1), 0.5f, 0.5f + 0.25f * lol::sin(m_time * 3 + M_PI / 4 * 1)), bg_color);
@@ -103,10 +103,10 @@ void Term::DrawFancyShit()
caca_put_str(m_caca, logo_x + 1, logo_y + 2, "/ / ____/ ____/ __ < <____\\___ \\");
//caca_set_color_argb(m_caca, hex_color(0.5f + 0.5f * lol::cos(m_time * 3 + M_PI / 4 * 3), 0.5f, 0.5f + 0.25f * lol::sin(m_time * 3 + M_PI / 4 * 3)), bg_color);
caca_put_str(m_caca, logo_x , logo_y + 3, "/__/\\__/\\_______________/ \\________________\\");
caca_set_color_argb(m_caca, 0xdef, bg_color);
caca_set_color_argb(m_caca, 0x269, bg_color);
caca_put_str(m_caca, logo_x + 5, logo_y + 5, "ALL YOUR TERMINALS ARE BELONG TO US");

caca_set_color_argb(m_caca, 0x666, bg_color);
caca_set_color_argb(m_caca, 0x777, bg_color);
caca_printf(m_caca, 2, h - 3, "W=%i", w);
caca_printf(m_caca, 2, h - 2, "H=%i", h);

@@ -125,7 +125,7 @@ void Term::DrawFancyShit()
int lolcube_x = w / 2 - 5 + (w - 10) * lol::cos(m_time / 2);
int lolcube_y = h - 5 - abs ((h - 5) * lol::sin(m_time * 4));

caca_set_color_argb(m_caca, hex_color(0.75f + 0.25f * lol::sin(m_time * 2), 0.75f + 0.25f * lol::cos(m_time * 3), 0.75f + 0.25f * lol::sin(m_time * 5)), bg_color);
caca_set_color_argb(m_caca, hex_color(0.5f + 0.5f * lol::sin(m_time * 2), 0.5f + 0.5f * lol::cos(m_time * 3), 0.5f + 0.5f * lol::sin(m_time * 5)), bg_color);
caca_put_str(m_caca, lolcube_x + 2, lolcube_y , "_______");
caca_put_str(m_caca, lolcube_x + 1, lolcube_y + 1, "/ /|");
caca_put_str(m_caca, lolcube_x , lolcube_y + 2, "/______/ |");
@@ -133,11 +133,10 @@ void Term::DrawFancyShit()
caca_put_str(m_caca, lolcube_x , lolcube_y + 4, "| :D | /");
caca_put_str(m_caca, lolcube_x , lolcube_y + 5, "|______|/");

caca_set_color_argb(m_caca, 0xdef, bg_color);
caca_set_color_argb(m_caca, 0x777, bg_color);
caca_put_str(m_caca, 0, 0, "rez@lol:~/ sudo -s");
caca_put_str(m_caca, 0, 1, "[sudo] password for rez:");
caca_put_str(m_caca, 0, 2, "root@lol:~/ echo LOL");
caca_put_str(m_caca, 0, 3, "LOL");
caca_put_str(m_caca, 0, 4, "root@lol:~/");
}

}

+ 4
- 5
neercs/video/copper.lolfx 파일 보기

@@ -23,16 +23,15 @@ void main(void)
vec3 color=texture2D(texture,p).xyz;

vec3 copper=vec3(0.5);

copper.x+=0.5*cos(p.y*float(screen_size.y/64)+time*2.0);
copper.z+=0.5*sin(p.y*float(screen_size.y/64)+time*2.0);

copper*=0.75+0.375*cos(p.y*float(screen_size.y/6)-time*2.0);
copper*=0.75+0.375*cos(p.y*float(screen_size.x/8)-time*2.0);

/*
copper.x=float(int(copper.x*8.0)*32)/256.0;
copper.y=float(int(copper.y*8.0)*32)/256.0;
copper.z=float(int(copper.z*8.0)*32)/256.0;
*/

gl_FragColor=vec4((dot(color,color)==1.0)?copper:color,1.0);
}
gl_FragColor=vec4((color==1.0)?copper:color,1.0);
}

+ 65
- 29
neercs/video/render.cpp 파일 보기

@@ -119,14 +119,18 @@ ivec2 canvas_char(0,0); // canvas char number
ivec2 canvas_size(0,0); // caca size
/* setup variable */
bool setup_switch = false; // switch [option/item]
int setup_option = 0; // selected option
int setup_n = 0; // item/option number
int setup_h = 6; // height
int setup_cursor = 0; // cursor position
int setup_option_i = 0; // selected option
int setup_option_n = 10; // option number
int setup_item = 0; // selected item
int setup_option_p = 0; // option position
int setup_item_i = 0; // selected item
int setup_item_n = 8; // item number
int setup_item_p = 0; // item position
int setup_item_key = 0; // item array key
int setup_n = 0; // contextual option/item number
ivec2 setup_p(1,1); // position [x,y]
ivec3 setup_size(30,0,12); // size [w,h,split]
ivec3 setup_size(30,7,12); // size [w,h,split]
ivec2 setup_color(0x678,0x234); // color [foreground,background]
char const *setup_text[] = {
"theme",
@@ -359,7 +363,7 @@ int calc_item_length()
int n = !setup_switch ? setup_option_n : setup_item_n;
for (int i = 0; i < n; i++)
{
int k = !setup_switch ? (i * (setup_item_n + 1)) : (setup_option * (setup_item_n + 1) + 1 + i);
int k = !setup_switch ? (i * (setup_item_n + 1)) : (setup_option_i * (setup_item_n + 1) + 1 + i);
if (setup_text[k] == "") return i - 1;
}
return n - 1;
@@ -530,9 +534,7 @@ int Render::CreateGLWindow()

caca_set_canvas_size(m_caca, canvas_char.x, canvas_char.y);

setup_size.y = ((setup_option_n > setup_item_n) ? setup_option_n : setup_item_n) + 1;
setup_p = (canvas_char - setup_size.xy) / 2;

setup_n = calc_item_length();

InitDraw();
@@ -600,14 +602,30 @@ void Render::TickDraw(float seconds)
{
if (!setup_switch)
{
setup_option--;
if (setup_option < 0) setup_option = setup_n;
setup_item = 0;
if (setup_cursor > 0)
{
setup_cursor--;
}
else
{
if ((setup_option_p > 0) && setup_cursor == 0) setup_option_p--;
}
if (setup_option_i > 0)
{
setup_option_i--;
}
else
{
setup_option_i = setup_option_n - 1;
setup_option_p = setup_option_n - setup_h;
setup_cursor = setup_h - 1;
}
setup_item_i = 0;
}
else
{
setup_item--;
if (setup_item < 0) setup_item = setup_n;
setup_item_i--;
if (setup_item_i < 0) setup_item_i = setup_n;
}
}
}
@@ -617,14 +635,30 @@ void Render::TickDraw(float seconds)
{
if (!setup_switch)
{
setup_option++;
if (setup_option > setup_n) setup_option = 0;
setup_item = 0;
if (setup_cursor < setup_h - 1)
{
setup_cursor++;
}
else
{
if ((setup_option_p + setup_h < setup_option_n) && setup_cursor == setup_h - 1) setup_option_p++;
}
if (setup_option_i < setup_option_n - 1)
{
setup_option_i++;
}
else
{
setup_option_i = 0;
setup_option_p = 0;
setup_cursor = 0;
}
setup_item_i = 0;
}
else
{
setup_item++;
if (setup_item > setup_n) setup_item = 0;
setup_item_i++;
if (setup_item_i > setup_n) setup_item_i = 0;
}
}
}
@@ -634,11 +668,12 @@ void Render::TickDraw(float seconds)
{
if (!setup_switch)
{
setup_option = 0;
setup_option_i -= setup_cursor;
setup_cursor = 0;
setup_item_i = 0;
}
else
{
setup_item = 0;
}
}
}
@@ -648,12 +683,13 @@ void Render::TickDraw(float seconds)
{
if (!setup_switch)
{
setup_option = setup_n;
setup_item = 0;
setup_option_i += setup_h - setup_cursor - 1;
setup_cursor = setup_h - 1;
setup_item_i = 0;
}
else
{
setup_item = setup_n;
setup_item_i = setup_n;
}
}
}
@@ -764,11 +800,11 @@ void Render::TickDraw(float seconds)
caca_draw_line(m_caca, setup_p.x, setup_p.y, setup_p.x + setup_size.x, setup_p.y,' ');
caca_put_str(m_caca, setup_p.x + setup_size.x / 2 - 3, setup_p.y, "SETUP");
/* display option */
for (int i = 0; i < setup_option_n; i++)
for (int i = 0; i < setup_h; i++)
{
int y = setup_p.y + 1 + i;
int k = i * (setup_item_n + 1);
if (setup_option != i || setup_switch)
int k = (setup_option_p + i) * (setup_item_n + 1);
if (setup_option_i != setup_option_p + i || setup_switch)
{
caca_set_color_argb(m_caca, setup_color.x, setup_color.y);
caca_put_str(m_caca, setup_p.x + 1, y, setup_text[k]);
@@ -781,11 +817,11 @@ void Render::TickDraw(float seconds)
}
}
/* display item */
for (int i = 0; i < setup_item_n; i++)
for (int i = 0; i < setup_h; i++)
{
int y = setup_p.y + 1 + i;
int k = setup_option * (setup_item_n + 1) + 1 + i;
if (setup_item != i || !setup_switch)
int k = setup_option_i * (setup_item_n + 1) + 1 + setup_item_p + i;
if (setup_item_i != i || !setup_switch)
{
caca_set_color_argb(m_caca, setup_color.x, setup_color.y);
caca_put_str(m_caca, setup_p.x + setup_size.z + 1, y, setup_text[k]);
@@ -799,7 +835,7 @@ void Render::TickDraw(float seconds)
}
/* display variable */
int y = setup_p.y + setup_size.y;
setup_item_key = setup_option * (setup_item_n + 1) + 1 + setup_item;
setup_item_key = setup_option_i * (setup_item_n + 1) + 1 + setup_item_i;
caca_set_color_argb(m_caca, setup_color.y, setup_color.x);
caca_draw_line(m_caca, setup_p.x, y, setup_p.x + setup_size.x, y,' ');
if (setup_switch)


불러오는 중...
취소
저장