Changeset 9259d20 in mainline for uspace/app/gfxdemo/gfxdemo.c
- Timestamp:
- 2019-04-16T09:15:55Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3e828ea
- Parents:
- 045186b
- git-author:
- Jiri Svoboda <jiri@…> (2019-04-15 17:15:29)
- git-committer:
- Jiri Svoboda <jiri@…> (2019-04-16 09:15:55)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/gfxdemo/gfxdemo.c
r045186b r9259d20 33 33 */ 34 34 35 #include <fibril.h> 36 #include <gfx/backend/console.h> 35 37 #include <gfx/color.h> 36 38 #include <gfx/render.h> 39 #include <io/console.h> 40 #include <stdlib.h> 37 41 38 42 int main(int argc, char *argv[]) 39 43 { 44 console_ctrl_t *con = NULL; 45 gfx_color_t *color = NULL; 46 gfx_context_t *gc = NULL; 47 gfx_rect_t rect; 48 int i; 49 errno_t rc; 50 51 printf("Init console..\n"); 52 con = console_init(stdin, stdout); 53 if (con == NULL) 54 return 1; 55 56 printf("Create console GC\n"); 57 rc = console_gc_create(con, stdout, &gc); 58 if (rc != EOK) 59 return 1; 60 61 while (true) { 62 rc = gfx_color_new_rgb_i16(rand() % 0x10000, rand() % 0x10000, 63 rand() % 0x10000, &color); 64 if (rc != EOK) 65 return 1; 66 67 rc = gfx_set_color(gc, color); 68 if (rc != EOK) 69 return 1; 70 71 for (i = 0; i < 10; i++) { 72 rect.p0.x = rand() % 79; 73 rect.p0.y = rand() % 24; 74 rect.p1.x = rect.p0.x + rand() % (79 - rect.p0.x); 75 rect.p1.y = rect.p0.y + rand() % (24 - rect.p0.y); 76 77 rc = gfx_fill_rect(gc, &rect); 78 if (rc != EOK) 79 return 1; 80 } 81 82 gfx_color_delete(color); 83 84 fibril_usleep(500 * 1000); 85 } 86 87 // TODO How will we free GC subclass? 88 89 // rc = gfx_context_delete(gc); 90 // if (rc != EOK) 91 // return 1; 92 93 return 0; 40 94 } 41 95
Note:
See TracChangeset
for help on using the changeset viewer.