8#define WINDOW_WIDTH 500
9#define WINDOW_HEIGHT 500
15static point_t hourHand[] = {{-8, 15}, {8, 15}, {6, -50}, {3, -75}, {0, -85}, {-3, -75}, {-6, -50}};
17static point_t minuteHand[] = {{-6, 15}, {6, 15}, {4, -120}, {2, -145}, {0, -155}, {-2, -145}, {-4, -120}};
19static point_t secondHand[] = {{-2, 30}, {2, 30}, {2, 0}, {1, -165}, {0, -175}, {-1, -165}, {-2, 0}};
24 point_t rotatedMarker[pointCount];
25 memcpy(rotatedMarker, markerPoints,
sizeof(
point_t) * pointCount);
29 rotatedMarker[i].
x += center.
x;
30 rotatedMarker[i].
y += center.
y - radius;
40 point_t rotatedHand[pointCount];
41 memcpy(rotatedHand, handPoints,
sizeof(
point_t) * pointCount);
42 for (
uint64_t i = 0; i < pointCount; i++)
44 rotatedHand[i].
x += center.
x;
45 rotatedHand[i].
y += center.
y;
87 for (
int i = 0; i < 12; i++)
89 double angle = i * (
M_PI / 6);
94 for (
int i = 0; i < 60; i++)
98 double angle = i * (
M_PI / 30);
void display_disconnect(display_t *disp)
Disconnect the display connection.
uint64_t display_next(display_t *disp, event_t *event, clock_t timeout)
Retrieve the next event from the display connection.
uint64_t display_dispatch(display_t *disp, const event_t *event)
Dispatch an event to the appropriate surface.
void display_free(display_t *disp)
Free a display connection.
display_t * display_new(void)
Create a new display connection.
void draw_polygon(drawable_t *draw, const point_t *points, uint64_t pointCount, pixel_t pixel)
Draw a filled polygon.
void draw_rect(drawable_t *draw, const rect_t *rect, pixel_t pixel)
Draw a filled rectangle.
theme_t * element_get_theme(element_t *elem)
Get the theme of an element.
void element_draw_end(element_t *elem, drawable_t *draw)
End drawing to an element.
rect_t element_get_content_rect(element_t *elem)
Get the element's rectangle in local coordinates.
void element_draw_begin(element_t *elem, drawable_t *draw)
Begin drawing to an element.
void polygon_rotate(point_t *points, uint64_t pointCount, double angle, point_t center)
Rotate a polygon around a center point.
uint64_t window_set_visible(window_t *win, bool isVisible)
Set the visibility of the window.
uint64_t window_set_timer(window_t *win, timer_flags_t flags, clock_t timeout)
Set the window timer.
window_t * window_new(display_t *disp, const char *name, const rect_t *rect, surface_type_t type, window_flags_t flags, procedure_t procedure, void *private)
Allocate and initialize a new window.
void window_free(window_t *win)
Free a window.
display_t * window_get_display(window_t *win)
Get the display associated with the window.
@ WINDOW_DECO
Enable decorations (titlebar, close/minimize buttons, etc).
#define NULL
Pointer error value.
#define PIXEL_ARGB(a, r, g, b)
static uint64_t procedure(window_t *win, element_t *elem, const event_t *event)
static point_t hourMarker[]
static point_t minuteHand[]
static void draw_hand(drawable_t *draw, point_t center, const point_t *handPoints, uint64_t pointCount, double angle, pixel_t pixel)
static void draw_marker(drawable_t *draw, point_t center, int64_t radius, const point_t *markerPoints, uint64_t pointCount, double angle, pixel_t pixel)
static point_t minuteMarker[]
static point_t secondHand[]
static point_t hourHand[]
#define RECT_INIT_DIM(x, y, width, height)
#define RECT_HEIGHT(rect)
_PUBLIC void * memcpy(void *_RESTRICT s1, const void *_RESTRICT s2, size_t n)
Opaque display structure.
Opaque element structure.
_PUBLIC time_t time(time_t *timer)
_PUBLIC struct tm * localtime(const time_t *timer)
long long unsigned time_t