Skip to content

Commit

Permalink
apply formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
tcdude committed Nov 25, 2023
1 parent 0a331a3 commit cc0259c
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions Sources/krink/nk/nuklear_krink.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#include "nuklear_krink.h"
#include <assert.h>
#include <math.h>

#include <kinc/input/keyboard.h>
#include <krink/eventhandler.h>
#include <krink/memory.h>

#include <assert.h>
#include <math.h>

#define NK_IMPLEMENTATION
#ifdef NK_MAX_FLOAT_PRECISION
#undef NK_MAX_FLOAT_PRECISION
Expand Down Expand Up @@ -219,16 +221,20 @@ NK_API void kr_nk_render(int window, struct nk_color clear) {
(float)(i->img.region[2]), (float)(i->img.region[3]),
(float)i->x, (float)i->y, (float)i->w, (float)i->h);
} break;
case NK_COMMAND_CURVE:{
case NK_COMMAND_CURVE: {
const struct nk_command_curve *c = (const struct nk_command_curve *)cmd;
kr_g2_set_color(nk_color_to_uint(c->color));
double px = 0.0;double py = 0.0;double u = 0.0;
for(u = 0.0 ; u <= 1.0 ; u += 0.0001){
px = pow(1-u,3)*c->begin.x+3*u*pow(1-u,2)*c->ctrl[0].x+3*pow(u,2)*(1-u)*c->ctrl[1].x+pow(u,3)*c->end.x;
py = pow(1-u,3)*c->begin.y+3*u*pow(1-u,2)*c->ctrl[0].y+3*pow(u,2)*(1-u)*c->ctrl[1].y+pow(u,3)*c->end.y;
kr_g2_fill_rect(px,py,c->line_thickness,c->line_thickness);
double px = 0;
double py = 0;
double u = 0;
for (u = 0; u <= 1; u += 0.0001) {
px = pow(1 - u, 3) * c->begin.x + 3 * u * pow(1 - u, 2) * c->ctrl[0].x +
3 * pow(u, 2) * (1 - u) * c->ctrl[1].x + pow(u, 3) * c->end.x;
py = pow(1 - u, 3) * c->begin.y + 3 * u * pow(1 - u, 2) * c->ctrl[0].y +
3 * pow(u, 2) * (1 - u) * c->ctrl[1].y + pow(u, 3) * c->end.y;
kr_g2_fill_rect(px, py, c->line_thickness, c->line_thickness);
}
}break;
} break;
case NK_COMMAND_POLYGON:
case NK_COMMAND_POLYGON_FILLED:
case NK_COMMAND_POLYLINE:
Expand Down

0 comments on commit cc0259c

Please sign in to comment.