Changeset 1602


Ignore:
Timestamp:
Jul 8, 2012, 10:54:49 PM (8 years ago)
Author:
rez
Message:

enhanced test screen

Location:
trunk/tools/neercs
Files:
2 edited

Legend:

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

    r1585 r1602  
    5454}
    5555
     56int Neercs::hex_color(float r, float g, float b)
     57{
     58return ((int)(r * 15.99f) << 8) | ((int)(g * 15.99f) << 4) | (int)(b * 15.99f);
     59}
     60
    5661void Neercs::TickGame(float seconds)
    5762{
     
    6166
    6267    /* draw something */
    63     caca_set_color_argb(m_caca, 0xfff, 0x222);
     68    int bg_color = 0x222;
     69    int w = caca_get_canvas_width(m_caca);
     70    int h = caca_get_canvas_height(m_caca);
     71
     72    caca_set_color_argb(m_caca, 0xfff, bg_color);
    6473    caca_clear_canvas(m_caca);
    6574
    66     caca_fill_ellipse(m_caca, 20+10 * lol::cos(m_time * 1.f), 10+10 * lol::sin(m_time * 1.f), 16+8 * lol::sin(m_time * 6.f), 12+6 * lol::cos(m_time * 5.f), '|');
    67     caca_fill_ellipse(m_caca, 20+10 * lol::cos(m_time * 1.f), 10+10 * lol::sin(m_time * 1.f), 12+8 * lol::sin(m_time * 6.f), 8+6 * lol::cos(m_time * 5.f), ' ');
     75    caca_set_color_argb(m_caca, 0x444, bg_color);
    6876
    69     caca_set_color_argb(m_caca, 0xcef, 0x222);
    70     int x1 = 12 + 10 * lol::cos(m_time * 5.f);
    71     int y1 = 6 + 5 * lol::sin(m_time * 5.f);
    72     int x2 = 30 + 5 * lol::cos(m_time * 8.f);
    73     int y2 = 8 + 5 * lol::sin(m_time * 8.f);
    74     int y3 = 8 + 5 * lol::cos(m_time * 5.f);
     77    int n1 = 8;
     78    int n2 = 6;//w / n1 * h;
     79
     80    for(int i = 0; i < n1; i++)
     81    {
     82        for(int j = 0; j < n2; j++)
     83        {
     84            int p_x = i * w / n1 + w / (n1 * 2);
     85            int p_y = j * h / n2 + h / (n2 * 2);
     86            int r_w = w / (n1 * 2) + w / (n1 * 4) * lol::cos(m_time * 3 + M_PI / n1 * i) + h / (n2 * 4) * lol::sin(m_time * 2 + M_PI / n2 * j);
     87            caca_fill_ellipse(m_caca, p_x, p_y, r_w, r_w, '%');
     88        }
     89    }
     90
     91    int radius = 12;
     92
     93    int x1 = w / 2 + radius * lol::cos(m_time * 2 - M_PI / 20);
     94    int y1 = h / 2 + radius * lol::sin(m_time * 2 - M_PI / 20);
     95    int x2 = w / 2 + radius * lol::cos(m_time * 2 + M_PI * 2 / 3 - M_PI / 20);
     96    int y2 = h / 2 + radius * lol::sin(m_time * 2 + M_PI * 2 / 3 - M_PI / 20);
     97    int x3 = w / 2 + radius * lol::cos(m_time * 2 + M_PI * 2 / 3 * 2 - M_PI / 20);
     98    int y3 = h / 2 + radius * lol::sin(m_time * 2 + M_PI * 2 / 3 * 2 - M_PI / 20);
     99    caca_set_color_argb(m_caca, 0x642, bg_color);
    75100    caca_draw_thin_line(m_caca, x1, y1, x2, y2);
    76     caca_draw_thin_line(m_caca, 40, y3, x2, y2);
    77     caca_draw_thin_line(m_caca, x1, y1, 40, y3);
     101    caca_draw_thin_line(m_caca, x2, y2, x3, y3);
     102    caca_draw_thin_line(m_caca, x3, y3, x1, y1);
    78103
    79     int x3 = 13 + 7 * lol::cos(m_time * 3.f);
    80     caca_set_color_ansi(m_caca, CACA_CYAN, CACA_BLUE);
    81     caca_put_str(m_caca, x3, 3, " LOL WUT ");
     104    x1 = w / 2 + radius * lol::cos(m_time * 2);
     105    y1 = h / 2 + radius * lol::sin(m_time * 2);
     106    x2 = w / 2 + radius * lol::cos(m_time * 2 + M_PI * 2 / 3);
     107    y2 = h / 2 + radius * lol::sin(m_time * 2 + M_PI * 2 / 3);
     108    x3 = w / 2 + radius * lol::cos(m_time * 2 + M_PI * 2 / 3 * 2);
     109    y3 = h / 2 + radius * lol::sin(m_time * 2 + M_PI * 2 / 3 * 2);
     110    caca_set_color_argb(m_caca, 0xea6, bg_color);
     111    caca_draw_thin_line(m_caca, x1, y1, x2, y2);
     112    caca_draw_thin_line(m_caca, x2, y2, x3, y3);
     113    caca_draw_thin_line(m_caca, x3, y3, x1, y1);
    82114
    83     int x4 = 6 + 5 * lol::cos(m_time * 2.f);
     115    int logo_x = -1;
     116    int logo_y = h / 2 - 3;
     117
     118    caca_set_color_argb(m_caca, hex_color(0.5f + 0.25f * lol::cos(m_time * 3               ),0.5f,0.5f + 0.25f * lol::sin(m_time * 3               )), bg_color);
     119    caca_put_str(m_caca, logo_x, logo_y    ," ___  __ _______ _______ _______  ._____ _______. ");
     120    caca_set_color_argb(m_caca, hex_color(0.5f + 0.25f * 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);
     121    caca_put_str(m_caca, logo_x, logo_y + 1, "|   \\|  Y   ____Y   ____Y  ___  \\/  .___Y   ___/  ");
     122    caca_set_color_argb(m_caca, hex_color(0.5f + 0.25f * lol::cos(m_time * 3 + M_PI / 4 * 2),0.5f,0.5f + 0.25f * lol::sin(m_time * 3 + M_PI / 4 * 2)), bg_color);
     123    caca_put_str(m_caca, logo_x, logo_y + 2, "|  . °  >   ____>   ____>  .__  /  <_____\\____  \\ ");
     124    caca_set_color_argb(m_caca, hex_color(0.5f + 0.25f * 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);
     125    caca_put_str(m_caca, logo_x, logo_y + 3, "|__|\\___\\_______\\_______\\__|  \\_\\________________\\");
     126    caca_set_color_argb(m_caca, 0xdef, bg_color);
     127    caca_put_str(m_caca, logo_x + 7, logo_y + 5, "ALL YOUR TERMINALS ARE BELONG TO US!");
     128
     129    caca_set_color_ansi(m_caca, 0x666, bg_color);
     130    caca_printf(m_caca, 1, h - 2, "W=%i H=%i", w, h);
     131    caca_put_str(m_caca, w - 13, h - 2, "CACA RULEZ");
     132
     133    /*
     134
     135    int x4 = 6 + 5 * lol::cos(m_time * 2.f)
    84136    caca_set_color_ansi(m_caca, CACA_YELLOW, CACA_RED);
    85137    caca_put_str(m_caca, x4, 25, "Le Caca C'Est Surpuissant \\:D/");
     138    */
     139}
    86140
    87     caca_put_str(m_caca, 0, 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
    88     caca_put_str(m_caca, 0, 1, " !\"#$%&'()*+,-./0123456789");
    89 }
    90141
    91142void Neercs::TickDraw(float seconds)
  • trunk/tools/neercs/neercs.h

    r1462 r1602  
    2020    char const *GetName() { return "<neercs>"; }
    2121
     22    int hex_color(float r, float g, float b);
     23
    2224protected:
    2325    virtual void TickGame(float seconds);
Note: See TracChangeset for help on using the changeset viewer.