summaryrefslogtreecommitdiff
path: root/src/ui.c
blob: 4d09584b9eb9bccc676b9d748e6aacb063ccaa8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <ui.h>

#include "uiLibrary.h"
#include "widget/widget.h"

// -----------------------------------------------------------------------------
// Library.

bool uiInit(void) {
  // TODO: Embed the font into the library instead.
  const char* font_path = "../ui/fontbaker/NK57.bin";
  if (!(g_ui.font = LoadFontAtlas(font_path))) {
    return false;
  }

  // TODO: Remove.
  const FontHeader* header     = &g_ui.font->header;
  const int         glyph_size = header->glyph_width * header->glyph_height;
  const int         atlas_size = header->num_glyphs * glyph_size;
  printf("Loaded font: %s\n", font_path);
  printf(
      "Glyph: %dx%d (%d bytes)\n", header->glyph_width, header->glyph_height,
      glyph_size);
  printf(
      "Atlas: %dx%d (%d bytes)\n", header->num_glyphs * header->glyph_width,
      header->glyph_height, atlas_size);

  return true;
}

void uiShutdown(void) {}