comparison tools/64vw.c @ 2617:2f322910dec5

Comments.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 28 Nov 2023 19:20:53 +0200
parents ff4c35d98267
children 1b62395e2bb7
comparison
equal deleted inserted replaced
2616:def52341ee5f 2617:2f322910dec5
423 dmErrorMsg("Could not initialize SDL: %s\n", SDL_GetError()); 423 dmErrorMsg("Could not initialize SDL: %s\n", SDL_GetError());
424 goto out; 424 goto out;
425 } 425 }
426 flagInitSDL = true; 426 flagInitSDL = true;
427 427
428 // Open window 428 // Create window
429 if ((window = SDL_CreateWindow(dmProgName, 429 if ((window = SDL_CreateWindow(dmProgName,
430 SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 430 SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
431 optSetWindowWidth, optSetWindowHeight, 431 optSetWindowWidth, optSetWindowHeight,
432 optWindowFlags | SDL_WINDOW_RESIZABLE 432 optWindowFlags | SDL_WINDOW_RESIZABLE
433 //| SDL_WINDOW_HIDDEN 433 //| SDL_WINDOW_HIDDEN
588 } 588 }
589 589
590 // Convert image to surface (we are lazy and ugly) 590 // Convert image to surface (we are lazy and ugly)
591 if (dmConvertC64ImageToSDLSurface(&bimage, &surf, cimage, &optSpec) == DMERR_OK) 591 if (dmConvertC64ImageToSDLSurface(&bimage, &surf, cimage, &optSpec) == DMERR_OK)
592 { 592 {
593 // Create title string
593 title = dm_strdup_printf("%s - [%d / %d] %s (%dx%d @ %s)", 594 title = dm_strdup_printf("%s - [%d / %d] %s (%dx%d @ %s)",
594 dmProgName, 595 dmProgName,
595 currIndex + 1, 596 currIndex + 1,
596 noptFilenames2, 597 noptFilenames2,
597 filename, 598 filename,
598 cimage->fmt->width, cimage->fmt->height, 599 cimage->fmt->width, cimage->fmt->height,
599 fmt->name); 600 fmt->name);
600 601
602 // Output some information to stdout if we are verbose
601 if (dmVerbosity >= 1) 603 if (dmVerbosity >= 1)
602 { 604 {
603 fprintf(stdout, "\n%s\n", filename); 605 fprintf(stdout, "\n%s\n", filename);
604 dmC64ImageDump(stdout, cimage, fmt, " "); 606 dmC64ImageDump(stdout, cimage, fmt, " ");
605 } 607 }
642 prevIndex = currIndex; 644 prevIndex = currIndex;
643 } 645 }
644 646
645 if (flagRedraw) 647 if (flagRedraw)
646 { 648 {
647 // Calculate the render size 649 // Calculate the image render size
648 SDL_Rect dstRect; 650 SDL_Rect dstRect;
649 dstRect.w = (((float) currWindowHeight) * D64_SCR_FULL_WIDTH / D64_SCR_FULL_HEIGHT / D64_SCR_PAR_XY); 651 dstRect.w = (((float) currWindowHeight) * D64_SCR_FULL_WIDTH / D64_SCR_FULL_HEIGHT / D64_SCR_PAR_XY);
650 dstRect.h = currWindowHeight; 652 dstRect.h = currWindowHeight;
651 dstRect.x = (currWindowWidth - dstRect.w) / 2; 653 dstRect.x = (currWindowWidth - dstRect.w) / 2;
652 dstRect.y = 0; 654 dstRect.y = 0;