Changeset 211fd68 in mainline for uspace/app/barber
- Timestamp:
- 2024-03-08T10:41:31Z (19 months ago)
- Branches:
- master
- Children:
- 0a411bbf
- Parents:
- cd27cd1
- git-author:
- Jiri Svoboda <jiri@…> (2024-03-07 18:41:21)
- git-committer:
- Jiri Svoboda <jiri@…> (2024-03-08 10:41:31)
- Location:
- uspace/app/barber
- Files:
-
- 30 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/barber/barber.c
rcd27cd1 r211fd68 50 50 #include <ui/image.h> 51 51 #include "images.h" 52 #include "images_tiny.h" 52 53 53 54 #define NAME "barber" … … 60 61 #define MIN_LOAD (LOAD_UNIT / 4) 61 62 #define MAX_LOAD (LOAD_UNIT / 3) 62 63 #define FRAME_WIDTH 5964 #define FRAME_HEIGHT 19265 63 66 64 #define LED_PERIOD 1000000 … … 97 95 static unsigned int frame = 0; 98 96 static unsigned int fps = MIN_FPS; 97 static gfx_coord_t frame_width; 98 static gfx_coord_t frame_height; 99 99 100 100 static void led_timer_callback(void *); … … 119 119 } 120 120 121 static bool decode_frames(gfx_context_t *gc )121 static bool decode_frames(gfx_context_t *gc, image_t *img) 122 122 { 123 123 gfx_rect_t rect; … … 125 125 126 126 for (unsigned int i = 0; i < FRAMES; i++) { 127 rc = decode_tga_gz(gc, im ages[i].addr, images[i].size,127 rc = decode_tga_gz(gc, img[i].addr, img[i].size, 128 128 &frame_bmp[i], &rect); 129 129 if (rc != EOK) { … … 132 132 } 133 133 134 (void) 134 (void)rect; 135 135 } 136 136 … … 238 238 rect.p0.x = 0; 239 239 rect.p0.y = 0; 240 rect.p1.x = FRAME_WIDTH;241 rect.p1.y = FRAME_HEIGHT;240 rect.p1.x = frame_width; 241 rect.p1.y = frame_height; 242 242 243 243 ui_image_set_bmp(frame_img, frame_bmp[frame], &rect); … … 299 299 int main(int argc, char *argv[]) 300 300 { 301 const char *display_spec = UI_ DISPLAY_DEFAULT;301 const char *display_spec = UI_ANY_DEFAULT; 302 302 barber_t barber; 303 303 ui_t *ui; … … 310 310 gfx_context_t *gc; 311 311 gfx_coord2_t off; 312 image_t *img; 312 313 int i; 313 314 … … 355 356 } 356 357 358 if (ui_is_textmode(ui)) { 359 frame_width = 10; 360 frame_height = 16; 361 } else { 362 frame_width = 59; 363 frame_height = 192; 364 } 365 357 366 rect.p0.x = 0; 358 367 rect.p0.y = 0; 359 rect.p1.x = FRAME_WIDTH;360 rect.p1.y = FRAME_HEIGHT;368 rect.p1.x = frame_width; 369 rect.p1.y = frame_height; 361 370 362 371 ui_wnd_params_init(¶ms); … … 367 376 * to rect 368 377 */ 369 ui_wdecor_rect_from_app( params.style, &rect, &wrect);378 ui_wdecor_rect_from_app(ui, params.style, &rect, &wrect); 370 379 off = wrect.p0; 371 380 gfx_rect_rtranslate(&off, &wrect, ¶ms.rect); … … 384 393 ui_window_set_cb(window, &window_cb, (void *) &barber); 385 394 386 if (!decode_frames(gc)) 395 img = ui_is_textmode(ui) ? image_tinys : images; 396 397 if (!decode_frames(gc, img)) 387 398 return 1; 388 399 -
uspace/app/barber/meson.build
rcd27cd1 r211fd68 62 62 ) 63 63 64 _images_tiny = files( 65 'gfx-tiny/frame01t.tga.gz', 66 'gfx-tiny/frame02t.tga.gz', 67 'gfx-tiny/frame03t.tga.gz', 68 'gfx-tiny/frame04t.tga.gz', 69 'gfx-tiny/frame05t.tga.gz', 70 'gfx-tiny/frame06t.tga.gz', 71 'gfx-tiny/frame07t.tga.gz', 72 'gfx-tiny/frame08t.tga.gz', 73 'gfx-tiny/frame09t.tga.gz', 74 'gfx-tiny/frame10t.tga.gz', 75 'gfx-tiny/frame11t.tga.gz', 76 'gfx-tiny/frame12t.tga.gz', 77 'gfx-tiny/frame13t.tga.gz', 78 'gfx-tiny/frame14t.tga.gz', 79 'gfx-tiny/frame15t.tga.gz', 80 'gfx-tiny/frame16t.tga.gz', 81 'gfx-tiny/frame17t.tga.gz', 82 'gfx-tiny/frame18t.tga.gz', 83 'gfx-tiny/frame19t.tga.gz', 84 'gfx-tiny/frame20t.tga.gz', 85 'gfx-tiny/frame21t.tga.gz', 86 'gfx-tiny/frame22t.tga.gz', 87 'gfx-tiny/frame23t.tga.gz', 88 'gfx-tiny/frame24t.tga.gz', 89 'gfx-tiny/frame25t.tga.gz', 90 'gfx-tiny/frame26t.tga.gz', 91 'gfx-tiny/frame27t.tga.gz', 92 'gfx-tiny/frame28t.tga.gz', 93 'gfx-tiny/frame29t.tga.gz', 94 'gfx-tiny/frame30t.tga.gz', 95 ) 96 64 97 _tarball = custom_target('barber_images.tar', 65 98 input: _images, … … 70 103 # TODO 71 104 105 # Normal images 106 72 107 _images_zip = custom_target('barber_images.zip', 73 108 input : _images, 74 109 output : [ 'images.zip' ], 75 command : [ mkarray, '@OUTDIR@', 'images', 'image', uspace_as_prolog, '.data', '@INPUT@' ],110 command : [ mkarray, '@OUTDIR@', 'images', 'image', 'image', uspace_as_prolog, '.data', '@INPUT@' ], 76 111 ) 77 112 _imgs_s = custom_target('barber_images.s', … … 94 129 ) 95 130 96 src = [ files('barber.c'), _imgs_s, _imgs_h, _imgs_desc_c ] 131 # Tiny images 132 133 _images_tiny_zip = custom_target('barber_images_tiny.zip', 134 input : _images_tiny, 135 output : [ 'images_tiny.zip' ], 136 command : [ mkarray, '@OUTDIR@', 'images_tiny', 'image', 'image_tiny', uspace_as_prolog, '.data', '@INPUT@' ], 137 ) 138 _imgs_tiny_s = custom_target('barber_images_tiny.s', 139 input : _images_tiny_zip, 140 output : [ 'images_tiny.s' ], 141 command : [ unzip, '-p', '@INPUT@', 'images_tiny.s' ], 142 capture : true, 143 ) 144 _imgs_tiny_h = custom_target('barber_images_tiny.h', 145 input : _images_tiny_zip, 146 output : [ 'images_tiny.h' ], 147 command : [ unzip, '-p', '@INPUT@', 'images_tiny.h' ], 148 capture : true, 149 ) 150 _imgs_tiny_desc_c = custom_target('barber_images_tiny_desc.c', 151 input : _images_tiny_zip, 152 output : [ 'images_tiny_desc.c' ], 153 command : [ unzip, '-p', '@INPUT@', 'images_tiny_desc.c' ], 154 capture : true, 155 ) 156 157 src = [ files('barber.c'), _imgs_s, _imgs_h, _imgs_desc_c, 158 _imgs_tiny_s, _imgs_tiny_h, _imgs_tiny_desc_c ]
Note:
See TracChangeset
for help on using the changeset viewer.