-
Notifications
You must be signed in to change notification settings - Fork 4
/
catgl_ui_searchbox.h
37 lines (31 loc) · 1.13 KB
/
catgl_ui_searchbox.h
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
32
33
34
35
36
37
void caDrawSearchBox(NVGcontext* vg, const char* text, float x, float y, float w, float h)
{
NVGpaint bg;
char icon[8];
float cornerRadius = h/2-1;
// Edit
bg = nvgBoxGradient(vg, x,y+1.5f, w,h, h/2,5, nvgRGBA(0,0,0,16), nvgRGBA(0,0,0,92));
nvgBeginPath(vg);
nvgRoundedRect(vg, x,y, w,h, cornerRadius);
nvgFillPaint(vg, bg);
nvgFill(vg);
/* nvgBeginPath(vg);
nvgRoundedRect(vg, x+0.5f,y+0.5f, w-1,h-1, cornerRadius-0.5f);
nvgStrokeColor(vg, nvgRGBA(0,0,0,48));
nvgStroke(vg);*/
nvgFontSize(vg, h*1.3f);
nvgFontFace(vg, "icons");
nvgFillColor(vg, nvgRGBA(255,255,255,64));
nvgTextAlign(vg, NVG_ALIGN_CENTER|NVG_ALIGN_MIDDLE);
nvgText(vg, x+h*0.55f, y+h*0.55f, cpToUTF8(CATGL_ICON_SEARCH, icon), NULL);
nvgFontSize(vg, 20.0f);
nvgFontFace(vg, "sans");
nvgFillColor(vg, nvgRGBA(255,255,255,32));
nvgTextAlign(vg, NVG_ALIGN_LEFT|NVG_ALIGN_MIDDLE);
nvgText(vg, x+h*1.05f, y+h*0.5f, text, NULL);
nvgFontSize(vg, h*1.3f);
nvgFontFace(vg, "icons");
nvgFillColor(vg, nvgRGBA(255,255,255,32));
nvgTextAlign(vg, NVG_ALIGN_CENTER|NVG_ALIGN_MIDDLE);
nvgText(vg, x+w-h*0.55f, y+h*0.55f, cpToUTF8(CATGL_ICON_CIRCLED_CROSS, icon), NULL);
}