mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-04 22:14:20 +01:00
56f4dc00a2
The builtin logo, or a text file in logo syntax, drawn as an extruded slab: the front is the art as it is, the back is the art mirrored, and the side walls are shaded with block glyphs. Rendering is pure: no terminal, no input, no timer. `--logo-type spin` hands every frame to the normal logo pipeline, so the modules are laid out beside it exactly as they are for any other type, and the first frame without --watch is byte-identical to the same art printed as a builtin logo. The rotation is driven by the `--watch` loop: `ffSpinTick()` runs once per refresh and `ffLogoPrint()` is called only when it reports a step, so the logo and the modules can never drift apart, and a build that never uses the type costs one comparison per refresh. Speed is set either as degrees per frame (--logo-spin-speed-per-frame, default 10) or as seconds per revolution (--logo-spin-speed-per-round, read from the clock and winning over the former when both are given). Both take negative values to turn the other way, and --logo-spin-angle picks the frame to start from.
58 lines
1.5 KiB
C
58 lines
1.5 KiB
C
#pragma once
|
|
|
|
#include "fastfetch_config.h"
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
#include "common/arrutil.h"
|
|
#include "common/FFstrbuf.h"
|
|
#include "common/FFlist.h"
|
|
#include "common/FFPlatform.h"
|
|
#include "common/unused.h"
|
|
|
|
#include "options/logo.h"
|
|
#include "options/display.h"
|
|
#include "options/general.h"
|
|
|
|
typedef struct FFconfig {
|
|
FFOptionsLogo logo;
|
|
FFOptionsDisplay display;
|
|
FFOptionsGeneral general;
|
|
} FFconfig;
|
|
|
|
typedef struct FFLogoLineCacheState {
|
|
FFlist lines;
|
|
uint32_t nextLine;
|
|
uint32_t rightOffset;
|
|
} FFLogoLineCacheState;
|
|
|
|
// `--logo-type spin`: kept here instead of in a file-static block so that the
|
|
// state lives with the rest of the run and starts clean on every invocation.
|
|
typedef struct FFLogoSpinState {
|
|
float degrees; // rotation of the frame drawn last
|
|
double lastDrawMs; // when that frame was drawn
|
|
bool started; // `logo.spin.angle` has been applied
|
|
bool printed; // a frame was drawn, so `ffSpinTick` has work to do
|
|
uint32_t printedWidth;
|
|
uint32_t printedHeight;
|
|
} FFLogoSpinState;
|
|
|
|
typedef struct FFstate {
|
|
uint32_t logoWidth;
|
|
uint32_t logoHeight;
|
|
uint32_t keysHeight;
|
|
bool titleFqdn;
|
|
uint32_t dynamicInterval;
|
|
FFPlatform platform;
|
|
FFLogoLineCacheState logoLineCache;
|
|
FFLogoSpinState logoSpin;
|
|
} FFstate;
|
|
|
|
typedef struct FFinstance {
|
|
FFconfig config;
|
|
FFstate state;
|
|
} FFinstance;
|
|
extern FFinstance instance; // Defined in `common/init.c`
|
|
extern FFModuleBaseInfo** ffModuleInfos[];
|