Changeset 1602 for trunk/tools/neercs/neercs.cpp
- Timestamp:
- Jul 8, 2012, 10:54:49 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/neercs/neercs.cpp
r1585 r1602 54 54 } 55 55 56 int Neercs::hex_color(float r, float g, float b) 57 { 58 return ((int)(r * 15.99f) << 8) | ((int)(g * 15.99f) << 4) | (int)(b * 15.99f); 59 } 60 56 61 void Neercs::TickGame(float seconds) 57 62 { … … 61 66 62 67 /* 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); 64 73 caca_clear_canvas(m_caca); 65 74 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); 68 76 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); 75 100 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, x 1, 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); 78 103 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); 82 114 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) 84 136 caca_set_color_ansi(m_caca, CACA_YELLOW, CACA_RED); 85 137 caca_put_str(m_caca, x4, 25, "Le Caca C'Est Surpuissant \\:D/"); 138 */ 139 } 86 140 87 caca_put_str(m_caca, 0, 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");88 caca_put_str(m_caca, 0, 1, " !\"#$%&'()*+,-./0123456789");89 }90 141 91 142 void Neercs::TickDraw(float seconds)
Note: See TracChangeset
for help on using the changeset viewer.