@@ -286,8 +286,8 @@ struct queue_t {
286286 zxdb z ;
287287 char * url ;
288288};
289- void * queue_values [144 ]; // 12x12 thumbnails max
290- void * queue_values2 [144 ]; // 12x12 thumbnails max
289+ void * queue_values [12 * 12 ]; // 12x12 thumbnails max
290+ void * queue_values2 [12 * 12 ]; // 12x12 thumbnails max
291291struct queue_t * queue_t_new (zxdb z ,const char * url ) {
292292 struct queue_t * q = malloc (sizeof (struct queue_t ));
293293 q -> z = zxdb_dup (z );
@@ -908,7 +908,7 @@ char* game_browser_v2() {
908908 // background (text mode only)
909909
910910 static rgba * background_texture = 0 ;
911- // if( thumbnails == 0 )
911+ if ( thumbnails == 0 )
912912 if ( background_texture ) {
913913#if 0
914914 int factor = 0 , f256 = 256 /(1 <<factor ), f192 = 192 /(1 <<factor );
@@ -1364,24 +1364,19 @@ char* game_browser_v2() {
13641364 ui_y -- ; // compact
13651365 }
13661366 else {
1367- int t = thumbnails ;
1368- int w = _320 /t , h = (_240 - 16 )/t ;
1369- int x = (cnt % t ) * w , y = 16 + (cnt / t ) * h ;
1367+ int t = thumbnails , _16 = 16 ; // _16 = 28; // progress_y+2 ;
1368+ int w = _320 /t , h = (_240 - _16 )/t ;
1369+ int x = (cnt % t ) * w , y = _16 + (cnt / t ) * h ;
13701370 int has_thumb = 0 ;
13711371
1372- int factor = t == 3 ? 1 : t == 6 ? 2 : 3 ;
1372+ int factor = t >= 12 ? 3 : t >= 6 ? 2 : t >= 3 ? 1 : 0 ;
13731373 const char * data = zxdb_screen_async (va ("#%.*s" , zx_id_len , zx_id ), & len , factor );
13741374 if ( data && len ) {
13751375 // blit
13761376 const rgba * bitmap = (rgba * )data ;
13771377 int f256 = 256 /(1 <<factor ), f192 = 192 /(1 <<factor );
1378- #if 0
1379- for (int i = 0 ; i < f192 ; ++ i ) {
1380- memcpy (& ui -> pix [x + (y + i )* _320 ], bitmap + (0 + i * f256 ), f256 * 4 );
1381- }
1382- #else
1383- rgba_blit (ui , bitmap , x ,y , 0 ,0 ,f256 ,f192 );
1384- #endif
1378+ int cx = (_320 - _256 )/t /2 , cy = ((_240 - _16 )- _192 )/t /2 ;
1379+ rgba_blit (ui , bitmap , x + cx ,y + 0 * cy , 0 ,0 ,f256 ,f192 );
13851380
13861381 has_thumb = 1 ;
13871382 }
@@ -1426,15 +1421,11 @@ char* game_browser_v2() {
14261421 mouse_cursor (2 );
14271422 ui_notify (full_title );
14281423 clicked = m .lb ;
1424+ }
14291425
1430- // prepare to blit larger preview
1431- if ( thumbnails == 12 ) {
1432- larger_preview = (const rgba * )zxdb_screen_async (va ("#%.*s" , zx_id_len , zx_id ), NULL , larger_factor = 1 );
1433- }
1434- else
1435- if ( thumbnails == 6 ) {
1436- larger_preview = (const rgba * )zxdb_screen_async (va ("#%.*s" , zx_id_len , zx_id ), NULL , larger_factor = 1 );
1437- }
1426+ // prepare to blit larger preview
1427+ if ( thumbnails >= 6 ) {
1428+ larger_preview = (const rgba * )zxdb_screen_async (va ("#%.*s" , zx_id_len , zx_id ), NULL , larger_factor = 1 );
14381429 }
14391430 }
14401431 }
@@ -1492,15 +1483,22 @@ char* game_browser_v2() {
14921483 if ( larger_preview ) {
14931484 int f256 = 256 /(1 <<larger_factor ), f192 = 192 /(1 <<larger_factor );
14941485
1495- int x = mouse ().x ; // x = (x + f256) > _320 ? x - f256 : x;
1496- int y = mouse ().y ; // y = (y + f192) > _240 ? y - f192 : y;
1486+ int x = mouse ().x ;
1487+ int y = mouse ().y ;
1488+
1489+ {float dt = x / (float )_320 ; x += 8 ; x -= (f256 + 8 * 2 ) * dt ; }
1490+ // {float dt = y / (float)_240; y += 16; y -= (f192 + 16*2) * dt; }
1491+
1492+ // x = (x + f256) > _320 ? x - f256 - 8 : x + 8;
1493+ y = (y + f192 ) > _240 ? y - f192 - 16 : y + 16 ;
14971494
1495+ static float alpha = 0.75 ;
14981496 static float at_x = 0 , at_y = 0 ; do_once at_x = x , at_y = y ;
1499- at_x = at_x * 0.90 + x * 0.10 ;
1500- at_y = at_y * 0.90 + y * 0.10 ;
1497+ at_x = at_x * alpha + x * ( 1 - alpha ) ;
1498+ at_y = at_y * alpha + y * ( 1 - alpha ) ;
15011499
15021500 rgba_blit (ui , larger_preview , at_x ,at_y , 0 ,0 ,f256 ,f192 );
1503- ui_rect (ui , at_x - 1 ,at_y - 1 ,at_x + f256 + 1 ,at_y + f192 + 1 );
1501+ ui_rect (ui , at_x - 1 ,at_y - 1 ,at_x + f256 + 1 - 1 ,at_y + f192 + 1 - 1 );
15041502 }
15051503
15061504 }
0 commit comments