aboutsummaryrefslogtreecommitdiff
path: root/src/render.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/render.c')
-rw-r--r--src/render.c47
1 files changed, 44 insertions, 3 deletions
diff --git a/src/render.c b/src/render.c
index e3ed98f..ba9c845 100644
--- a/src/render.c
+++ b/src/render.c
@@ -104,7 +104,7 @@ static void update_single_animation(saver_state_t *state, animation_t *anim)
// Spinner animation
else if (anim->type == ASpinnerAnimation) {
- anim->anim.spinner_anim.rotation += 0.07;
+ anim->anim.spinner_anim.rotation += 0.27;
}
}
@@ -281,6 +281,39 @@ void draw_logo(saver_state_t *state)
set_layer_needs_draw(state, LAYER_LOGO, false);
}
+void draw_date_field(saver_state_t *state)
+{
+ const double cursor_height = 40.0;
+ const double cursor_width = 30.0;
+ const double field_x = kLogoBackgroundWidth + 50.0;
+ const double field_y = (state->canvas_height - cursor_height) / 2.0;
+ const double field_padding = 10.0;
+
+ cairo_t *cr = state->ctx;
+
+ // Common color for status and password field
+ cairo_set_source_rgba(cr, 1.0, 1.0, 1.0, state->password_opacity);
+
+ char date[256] = "";
+ char datePrompt[256] = "";
+ time_t nowInstant = time(NULL);
+ struct tm* now = localtime(&nowInstant);
+
+ strftime(date, 256, "%T %a %d/%m/%y", now);
+ sprintf(datePrompt, "%s/%s", date, state->password_prompt);
+
+ // Measure status text
+ const char *prompt = datePrompt;
+ pango_layout_set_font_description(state->pango_layout, state->status_font);
+ pango_layout_set_text(state->pango_layout, prompt, -1);
+
+ int t_width, t_height;
+ pango_layout_get_size(state->pango_layout, &t_width, &t_height);
+ double line_height = t_height / PANGO_SCALE;
+
+
+
+}
void draw_password_field(saver_state_t *state)
{
const double cursor_height = 40.0;
@@ -288,14 +321,22 @@ void draw_password_field(saver_state_t *state)
const double field_x = kLogoBackgroundWidth + 50.0;
const double field_y = (state->canvas_height - cursor_height) / 2.0;
const double field_padding = 10.0;
-
+
cairo_t *cr = state->ctx;
// Common color for status and password field
cairo_set_source_rgba(cr, 1.0, 1.0, 1.0, state->password_opacity);
+ char date[256] = "";
+ char datePrompt[256] = "";
+ time_t nowInstant = time(NULL);
+ struct tm* now = localtime(&nowInstant);
+
+ strftime(date, 256, "%T %a %d/%m/%y", now);
+ sprintf(datePrompt, "%s\n%s", date, state->password_prompt);
+
// Measure status text
- const char *prompt = state->password_prompt;
+ const char *prompt = datePrompt;
pango_layout_set_font_description(state->pango_layout, state->status_font);
pango_layout_set_text(state->pango_layout, prompt, -1);