nandi/jolt-nativepublic Fork 0
726f7c6204744da1ec206370a11b6c8d5e00c669
Commits
Clone
git clone https://git.rickub.com/nandi/jolt-native.git
git clone ssh://git@rickub.com/nandi/jolt-native.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

vidya.h · 75 lines · 2.4 KBC Blame HistoryRaw
Build libvidya for the phone, and hold the glue that boots it d942053 nandi 19d ago1#ifndef VIDYA_H
2#define VIDYA_H
3
4#include <stddef.h>
5
6#if defined(_WIN32)
7# if defined(VIDYA_BUILD)
8# define VIDYA_API __declspec(dllexport)
9# else
10# define VIDYA_API __declspec(dllimport)
11# endif
12#elif defined(__GNUC__)
13# define VIDYA_API __attribute__((visibility("default")))
14#else
15# define VIDYA_API
16#endif
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22typedef enum VidyaMode {
23 VIDYA_DARK = 0,
24 VIDYA_LIGHT = 1
25} VidyaMode;
26
27typedef enum VidyaButtonKind {
28 VIDYA_BUTTON_DEFAULT = 0,
29 VIDYA_BUTTON_PRIMARY = 1,
30 VIDYA_BUTTON_DESTRUCTIVE = 2
31} VidyaButtonKind;
32
33/* Window and frame lifecycle. There is one UI context per process for now.
34 * All calls must remain on the window thread. */
35VIDYA_API int vidya_open(int width, int height, const char *title);
36VIDYA_API void vidya_close(void);
37VIDYA_API int vidya_should_close(void);
38VIDYA_API void vidya_set_target_fps(int fps);
39VIDYA_API void vidya_set_mode(int mode);
40VIDYA_API int vidya_get_mode(void);
41/* Replace the UI font. Returns 1 on success. atlas_size is the size the direct
42 * backend bakes its atlas at, which controls then scale down to the semantic
43 * type sizes; 32 is a good default. Call between frames, not inside one. */
44VIDYA_API int vidya_load_font(const char *path, int atlas_size);
45VIDYA_API void vidya_begin_frame(void);
46VIDYA_API void vidya_end_frame(void);
47
48/* A frame is a vertical immediate-mode page. Containers save and restore its
49 * horizontal bounds; every leaf advances the vertical cursor. */
50VIDYA_API void vidya_page_begin(float max_width);
51VIDYA_API void vidya_page_end(void);
52VIDYA_API void vidya_card_begin(void);
53VIDYA_API void vidya_card_end(void);
54VIDYA_API void vidya_gap(float pixels);
55VIDYA_API void vidya_separator(void);
56
57/* Semantic text roles. */
58VIDYA_API void vidya_title(const char *text);
59VIDYA_API void vidya_title_2(const char *text);
60VIDYA_API void vidya_body(const char *text);
61VIDYA_API void vidya_dim_label(const char *text);
62
63/* Controls return 1 only on activation/change during the current frame. */
64VIDYA_API int vidya_button(const char *label, int kind);
65VIDYA_API int vidya_checkbox(const char *label, int *checked);
66/* FFI-friendly checkbox variant: returns the current value after handling input. */
67VIDYA_API int vidya_checkbox_value(const char *label, int checked);
68VIDYA_API void vidya_status(const char *label, int live);
69VIDYA_API int vidya_text_field(char *text, size_t capacity, const char *placeholder);
70
71#ifdef __cplusplus
72}
73#endif
74
75#endif