ptk/include/ptk.h
jacekpoz 935ca0e340
improve header guards
the following names are reserved to the language implementation:
  - (C and C++) starting with an underscore and a capital letter
  - (C++) containing any amount of double underscores

https://en.wikipedia.org/wiki/Include_guard#Discussion
2024-08-09 11:45:00 +02:00

69 lines
1.6 KiB
C

#ifndef PTK_PTK_H_
#define PTK_PTK_H_
#include <ptk_vec.h>
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
typedef struct {
uint32_t major;
uint32_t minor;
uint32_t patch;
} PtkVersion;
bool ptk_init(size_t width, size_t height, const char *title, PtkVersion application_version);
typedef struct PtkComponent *PtkHandle;
#define PTK_NULL_HANDLE (void *)0
typedef enum {
PTK_COMPONENT_TYPE_BOX = 0,
PTK_COMPONENT_TYPE_TRIANGLE = 1,
PTK_COMPONENT_TYPE_RECT = 2,
PTK_COMPONENT_TYPE_ELLIPSE = 3,
} PtkComponentType;
typedef struct PtkComponent {
PtkComponentType type;
} PtkComponent;
typedef struct PtkBox {
PtkComponentType type;
size_t child_count;
PtkHandle *children;
} PtkBox;
typedef struct PtkTriangle {
PtkComponentType type;
PtkPos vertices[3];
PtkColor color;
} PtkTriangle;
typedef struct PtkRect {
PtkComponentType type;
PtkPos top_left;
PtkSize size;
PtkColor color;
} PtkRect;
typedef struct PtkEllipse {
PtkComponentType type;
PtkPos center;
PtkSize radii;
PtkColor color;
} PtkEllipse;
PtkHandle ptk_box(size_t child_count, PtkHandle *children);
PtkHandle ptk_triangle(PtkPos vertices[3], PtkColor color);
PtkHandle ptk_rect(PtkPos top_left, PtkSize size, PtkColor color);
PtkHandle ptk_square(PtkPos top_left, float size, PtkColor color);
PtkHandle ptk_ellipse(PtkPos center, PtkSize radii, PtkColor color);
PtkHandle ptk_circle(PtkPos center, float radius, PtkColor color);
#define PTK_BOX(...) ptk_box(sizeof((PtkHandle []){ __VA_ARGS__ }) / sizeof(PtkHandle), (PtkHandle []) { __VA_ARGS__ })
int ptk_run(PtkHandle root);
#endif // PTK_PTK_H_