application/main.c

changeset 97
1a786201465f
parent 95
29f5cd5f5367
child 98
efaae97bd95b
equal deleted inserted replaced
96:93785a7bda56 97:1a786201465f
45 } 45 }
46 46
47 void draw(UiEvent *event, UiGraphics *g, void *data) { 47 void draw(UiEvent *event, UiGraphics *g, void *data) {
48 int width = g->width; 48 int width = g->width;
49 int height = g->height; 49 int height = g->height;
50 printf("rec[%d,%d]\n", width, height);
50 ui_graphics_color(g, 64, 64, 64); 51 ui_graphics_color(g, 64, 64, 64);
51 ui_draw_rect(g, 0, 0, width, height, TRUE); 52 ui_draw_rect(g, 0, 0, width, height, TRUE);
52 53
53 UiTextLayout *text = ui_text(g); 54 UiTextLayout *text = ui_text(g);
54 ui_text_setfont(text, "Monospace", 12); 55 ui_text_setfont(text, "Monospace", 12);
55 ui_text_setstring(text, "Hello World"); 56 ui_text_setstring(text, "Hello World");
57 int w, h;
58 ui_text_getsize(text, &w, &h);
59 printf("ext[%d,%d]\n", w, h);
56 60
57 ui_graphics_color(g, 255, 255, 255); 61 ui_graphics_color(g, 255, 255, 255);
58 ui_draw_text(g, 50, 50, text); 62 ui_draw_text(g, 50, 50, text);
59 63
60 ui_text_free(text); 64 ui_text_free(text);

mercurial