Nimbin[12]?Games / Entropie / entropie/src/world/daycycle.h

Entropie git · main

Entropie festival game; first steps

sdl c game entropie cmake · first commit 2026-10-10 · last commit 2026-11-02 (18 hours ago) · synced 10 hours ago

C 88.5% Markdown 9.1% GLSL 2.3%
git clone https://git.christianimmanuel.de/games/Entropie.gitwget https://git.christianimmanuel.de/games/Entropie/archive/Entropie.tar.gz
entropie/src/world/daycycle.h 711 B · 24 lines raw
#ifndef WORLD_DAYCYCLE_H
#define WORLD_DAYCYCLE_H

/* In-game clock driving sun position and light colors. */

#include <stddef.h>

#include "render/renderer.h"

typedef struct {
    float    seconds;     /* seconds since midnight, 0..86400 */
    float    time_scale;  /* game seconds per real second */
    float    day_start;   /* sunrise hour */
    float    day_end;     /* sunset hour */
    Lighting light;       /* derived from the time of day */
} DayCycle;

void DayCycle_init(DayCycle *dc, float start_hour, float time_scale);
void DayCycle_update(DayCycle *dc, float dt);

/* Writes "HH:MM:SS". */
void DayCycle_format(const DayCycle *dc, char *out, size_t out_size);

#endif /* WORLD_DAYCYCLE_H */