#include #include #include #include #include #define PI 3.1415926535 uint8_t background_colour = 0x1d; // also 0x1c, 0x14, 0x15, 0x1e are good colours uint8_t foreground_colour = 0xff; int offset_x = 120, offset_y = 70; // not sure if i'll actually need this int center_x = 160, center_y = 110; long ticks = 0; float angles[5] = {0, PI / 12, PI / 6, PI / 4, PI / 3}; float values[5] = {0, 5, 10, 15, 20}; float f(x) { // secret sauce function. // took a week's worth of late-night integrals, R & D, and button-pressing on my TI-84 Plus CE to develop // not a trade secret, because Microsoft already beat me to it. return (PI / 4) * pow(sin(PI * 5 / 48 * x), 2) + (PI / 12); // if you're curious, graph this function. // you'll want these window settings: // Xmin = 0 // Xmax = 13 // Xscl = 1 // Ymin = 0 // Ymax = 1.570796327 (or PI / 2) // Yscl = 0.261799388 (or PI / 12) // for extra points, if you integrate this function // from 0 to (48/5), you get 2 * PI. // why? } #define SPEED 6 void get_angles() { for (int c = 0; c < 5; c++) { angles[c] += f((values[c] + ticks) / SPEED) / SPEED; } } int main() { gfx_Begin(); gfx_SetTextFGColor(foreground_colour); gfx_SetTextBGColor(background_colour); gfx_SetTextTransparentColor(5); gfx_SetTextConfig(gfx_text_noclip); gfx_SetMonospaceFont(8); while (true) { kb_Scan(); if (kb_IsDown(kb_Key6) && kb_IsDown(kb_KeySquare) && kb_IsDown(kb_KeyDiv)) { break; } gfx_SetDrawBuffer(); gfx_FillScreen(background_colour); gfx_PrintStringXY("Updating Windows...", 80, 160); gfx_PrintStringXY("Don't turn off your calculator", 40, 170); gfx_SetColor(foreground_colour); for (int i = 0; i < 5; i++) { int cycle = (int) ((angles[i] - PI) / (2 * PI)); if (cycle % 3 == 2) { continue; } int x = center_x + (int) (sin(angles[i]) * 40); int y = center_y - (int) (cos(angles[i]) * 40); gfx_FillCircle(x, y, 3); } gfx_SwapDraw(); ticks++; get_angles(); } gfx_End(); }