示例#1
0
文件: window.c 项目: NunyaOS/Nunya
void window_set_border_color(struct window *w, struct graphics_color border_color) {
    w->border_color = border_color;

    // Draw the new border
    window_draw_line(w, 0, 0, 0, w->height, border_color);
    window_draw_line(w, 0, 0, w->width, 0, border_color);
    window_draw_line(w, 0, w->height, w->width, w->height, border_color);
    window_draw_line(w, w->width, 0, w->width, w->height, border_color);
}
示例#2
0
void analog_clock_update(struct aquarium *aquarium)
{
        int dhx, dhy;
        int dmx, dmy;
        int dsx, dsy;
        float lx, ly;

        time_t now;
        struct tm *mt;

        if(aquarium->no_analog_clock)
                return;

	now = time(NULL);
	mt = localtime(&now);

        lx = (float)aquarium->w /2.0;
        ly = (float)aquarium->h /2.0;

        analog_clock_loc(mt->tm_hour, mt->tm_min,
                         12.0,
                         HOUR_ARM_LEN * lx,
                         HOUR_ARM_LEN * ly,
                         &dhx, &dhy);
        analog_clock_loc(mt->tm_min, mt->tm_sec,
                         60.0,
                         MIN_ARM_LEN * lx,
                         MIN_ARM_LEN * ly,
                         &dmx, &dmy);
        if(!aquarium->no_analog_clock_seconds)
                analog_clock_loc(mt->tm_sec, 0,
                                 60.0,
                                 SEC_ARM_LEN * lx,
                                 SEC_ARM_LEN * ly,
                                 &dsx, &dsy);

        window_draw_line((int)lx + dhx, (int)ly + dhy , (int)lx, (int)ly, 1, HOUR_COLOR, 80);
        window_draw_line((int)lx + dmx, (int)ly + dmy , (int)lx, (int)ly, 1, MIN_COLOR,  80);

        if(!aquarium->no_analog_clock_seconds)
                window_draw_line((int)lx + dsx, (int)ly + dsy , (int)lx, (int)ly, 1, SEC_COLOR,  80);

}