framer

Slide-show application for nerds ☝️🤓

NameSizeMode
..
src/plug.c 1500B -rw-r--r--
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include "raylib.h"
#include "frames.h"

#define BACKGROUND BLACK
#define FOREGROUND WHITE
#define ACCENT     (Color){ 0x00, 0xcc, 0x46, 0xff }

void title_frame(float time, float scale)
{
  (void)time;
  int height = GetScreenHeight();

  int title_size = (int)(50.0 * scale);
  Line title = line("introdução a assemply", FOREGROUND, title_size);

  int subtitle_size = (int)(30.0 * scale);
  Line subtitle = line("cripto goma 2020", ACCENT, subtitle_size);

  int title_spacing = (int)(10.0 * scale);
  int title_height = title_size + title_spacing + subtitle_size;

  int title_y = (height - title_height)/2;
  int subtitle_y = title_y + title_size + title_spacing;

  ClearBackground(BACKGROUND);
  line_draw_centered(&title,    title_y);
  line_draw_centered(&subtitle, subtitle_y);
}

void oq_frame(float time, float scale)
{
  int height = GetScreenHeight();
  int font_size = (int)(50.0 * scale);

  Line line = {0};
  line.font_size = font_size;

  line_append(&line, "o quê é ", FOREGROUND);
  line_append(&line, "assembly", ACCENT);

  const float animation_speed = .5;
  Color color = FOREGROUND;
  if ((int)(time / animation_speed) % 2 == 0) color = BACKGROUND;
  line_append(&line, " ?", color);

  int y = (height - font_size)/2;

  ClearBackground(BACKGROUND);
  line_draw_centered(&line, y);
}

void plug_load_frames(Frames *fs)
{
  frames_append(fs, title_frame, FRAMES_EMPTY_TICK, FRAMES_EMPTY_STATE);
  frames_append(fs, oq_frame,    FRAMES_EMPTY_TICK, FRAMES_EMPTY_STATE);
}