rename PtkColor to PtkRGB
This commit is contained in:
parent
b8b2698434
commit
60cc86ec41
6 changed files with 19 additions and 19 deletions
|
@ -8,7 +8,7 @@ int main(void) {
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
const PtkColor red = { .r = 1.0f, .g = 0.0f, .b = 0.0f };
|
||||
const PtkRGB red = { .r = 1.0f, .g = 0.0f, .b = 0.0f };
|
||||
|
||||
return ptk_run(PTK_BOX(
|
||||
ptk_rect((PtkPos){ .x = 250.0f, .y = 200.0f }, (PtkSize){ .w = 300.0f, .h = 200.0f }, red),
|
||||
|
@ -16,6 +16,6 @@ int main(void) {
|
|||
ptk_rect((PtkPos){ .x = 450.0f, .y = 400.0f }, (PtkSize){ .w = 100.0f, .h = 100.0f }, red),
|
||||
ptk_circle((PtkPos){ .x = 400.0f, .y = 200.0f }, 150.0f, red),
|
||||
ptk_rect((PtkPos){ .x = 200.0f, .y = 200.0f }, (PtkSize){ .w = 50.0f, .h = 125.0f }, red),
|
||||
ptk_ellipse((PtkPos){ .x = 500.0f, .y = 200.0f }, (PtkSize){ .w = 100.0f, .h = 50.0f }, (PtkColor){ .r = 1.0f, .g = 1.0f, .b = 1.0f }),
|
||||
ptk_ellipse((PtkPos){ .x = 500.0f, .y = 200.0f }, (PtkSize){ .w = 100.0f, .h = 50.0f }, (PtkRGB){ .r = 1.0f, .g = 1.0f, .b = 1.0f }),
|
||||
));
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ int main(void) {
|
|||
r = (PtkRect *)ptk_rect(
|
||||
(PtkPos){ .x = 100.0f, .y = 100.0f },
|
||||
(PtkSize){ .w = 100.0f, .h = 50.0f },
|
||||
(PtkColor){ .r = 1.0f, .g = 1.0f, .b = 1.0f }
|
||||
(PtkRGB){ .r = 1.0f, .g = 1.0f, .b = 1.0f }
|
||||
);
|
||||
|
||||
return ptk_run(
|
||||
|
|
|
@ -42,19 +42,19 @@ PTK_COMPONENT_DEFINE(PtkComponent, );
|
|||
|
||||
PTK_COMPONENT_DEFINE(PtkTriangle,
|
||||
PtkPos vertices[3];
|
||||
PtkColor color;
|
||||
PtkRGB color;
|
||||
);
|
||||
|
||||
PTK_COMPONENT_DEFINE(PtkRect,
|
||||
PtkPos top_left;
|
||||
PtkSize size;
|
||||
PtkColor color;
|
||||
PtkRGB color;
|
||||
);
|
||||
|
||||
PTK_COMPONENT_DEFINE(PtkEllipse,
|
||||
PtkPos center;
|
||||
PtkSize radii;
|
||||
PtkColor color;
|
||||
PtkRGB color;
|
||||
);
|
||||
|
||||
typedef void (*MouseButtonCallback)(const int button, const int mods);
|
||||
|
@ -64,11 +64,11 @@ PTK_COMPONENT_DEFINE(PtkClickable,
|
|||
);
|
||||
|
||||
PtkHandle ptk_box(const size_t child_count, PtkHandle *children);
|
||||
PtkHandle ptk_triangle(const PtkPos vertices[3], const PtkColor color);
|
||||
PtkHandle ptk_rect(const PtkPos top_left, const PtkSize size, const PtkColor color);
|
||||
PtkHandle ptk_square(const PtkPos top_left, const float size, const PtkColor color);
|
||||
PtkHandle ptk_ellipse(const PtkPos center, const PtkSize radii, const PtkColor color);
|
||||
PtkHandle ptk_circle(const PtkPos center, const float radius, const PtkColor color);
|
||||
PtkHandle ptk_triangle(const PtkPos vertices[3], const PtkRGB color);
|
||||
PtkHandle ptk_rect(const PtkPos top_left, const PtkSize size, const PtkRGB color);
|
||||
PtkHandle ptk_square(const PtkPos top_left, const float size, const PtkRGB color);
|
||||
PtkHandle ptk_ellipse(const PtkPos center, const PtkSize radii, const PtkRGB color);
|
||||
PtkHandle ptk_circle(const PtkPos center, const float radius, const PtkRGB color);
|
||||
PtkHandle ptk_clickable(PtkHandle hitbox, const MouseButtonCallback on_press);
|
||||
|
||||
#define PTK_BOX(...) ptk_box(sizeof((PtkHandle []){ __VA_ARGS__ }) / sizeof(PtkHandle), (PtkHandle []) { __VA_ARGS__ })
|
||||
|
|
|
@ -12,7 +12,7 @@ typedef union {
|
|||
float green;
|
||||
float blue;
|
||||
};
|
||||
} PtkColor;
|
||||
} PtkRGB;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
|
@ -40,7 +40,7 @@ typedef union {
|
|||
float blue;
|
||||
float alpha;
|
||||
};
|
||||
} PtkColorA;
|
||||
} PtkRGBA;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
|
|
10
src/ptk.c
10
src/ptk.c
|
@ -143,7 +143,7 @@ PtkHandle ptk_box(const size_t child_count, PtkHandle *children) {
|
|||
return (PtkHandle)ret;
|
||||
}
|
||||
|
||||
PtkHandle ptk_triangle(const PtkPos vertices[3], const PtkColor color) {
|
||||
PtkHandle ptk_triangle(const PtkPos vertices[3], const PtkRGB color) {
|
||||
PtkTriangle *ret = malloc(sizeof(PtkTriangle));
|
||||
*ret = (PtkTriangle){
|
||||
.type = PTK_COMPONENT_TYPE_TRIANGLE,
|
||||
|
@ -154,7 +154,7 @@ PtkHandle ptk_triangle(const PtkPos vertices[3], const PtkColor color) {
|
|||
return (PtkHandle)ret;
|
||||
}
|
||||
|
||||
PtkHandle ptk_rect(const PtkPos top_left, const PtkSize size, const PtkColor color) {
|
||||
PtkHandle ptk_rect(const PtkPos top_left, const PtkSize size, const PtkRGB color) {
|
||||
PtkRect *ret = malloc(sizeof(PtkRect));
|
||||
*ret = (PtkRect){
|
||||
.type = PTK_COMPONENT_TYPE_RECT,
|
||||
|
@ -166,11 +166,11 @@ PtkHandle ptk_rect(const PtkPos top_left, const PtkSize size, const PtkColor col
|
|||
return (PtkHandle)ret;
|
||||
}
|
||||
|
||||
PtkHandle ptk_square(const PtkPos top_left, const float size, const PtkColor color) {
|
||||
PtkHandle ptk_square(const PtkPos top_left, const float size, const PtkRGB color) {
|
||||
return ptk_rect(top_left, (PtkSize){ .w = size, .h = size }, color);
|
||||
}
|
||||
|
||||
PtkHandle ptk_ellipse(const PtkPos center, const PtkSize radii, const PtkColor color) {
|
||||
PtkHandle ptk_ellipse(const PtkPos center, const PtkSize radii, const PtkRGB color) {
|
||||
PtkEllipse *ret = malloc(sizeof(PtkEllipse));
|
||||
*ret = (PtkEllipse){
|
||||
.type = PTK_COMPONENT_TYPE_ELLIPSE,
|
||||
|
@ -182,7 +182,7 @@ PtkHandle ptk_ellipse(const PtkPos center, const PtkSize radii, const PtkColor c
|
|||
return (PtkHandle)ret;
|
||||
}
|
||||
|
||||
PtkHandle ptk_circle(const PtkPos center, const float radius, const PtkColor color) {
|
||||
PtkHandle ptk_circle(const PtkPos center, const float radius, const PtkRGB color) {
|
||||
return ptk_ellipse(center, (PtkSize){ .w = radius, .h = radius }, color);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
typedef struct {
|
||||
PtkPos pos;
|
||||
PtkColor color;
|
||||
PtkRGB color;
|
||||
PtkComponentType shape_type;
|
||||
PtkVec2 uv;
|
||||
} Vertex;
|
||||
|
|
Loading…
Reference in a new issue