New flag for PlayMovie: keep the movie aspect ratio while zooming.
This commit is contained in:
parent
d9d428de09
commit
21dce1573e
3 changed files with 23 additions and 7 deletions
src
|
@ -46,6 +46,7 @@
|
|||
enum _play_movie_flags_ {
|
||||
PlayMovieFullScreen = 1, /// Switch to full screen
|
||||
PlayMovieZoomScreen = 2, /// Zoom to screen size
|
||||
PlayMovieKeepAspect = 4, /// Keep the aspect while zooming
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -1186,7 +1186,8 @@ Use it at your own risk.\n\n");
|
|||
i=1;
|
||||
SetClipping(0,0,VideoWidth-1,VideoHeight-1);
|
||||
if( TitleScreen ) {
|
||||
if( (i=PlayMovie(TitleScreen,PlayMovieZoomScreen)) ) {
|
||||
if( (i=PlayMovie(TitleScreen,
|
||||
PlayMovieZoomScreen|PlayMovieKeepAspect)) ) {
|
||||
DisplayPicture(TitleScreen);
|
||||
Invalidate();
|
||||
}
|
||||
|
|
|
@ -257,16 +257,30 @@ global int PlayMovie(const char *name, int flags)
|
|||
callbacks.SoundReady=WriteSound;
|
||||
|
||||
if (flags & PlayMovieZoomScreen) {
|
||||
rect.x = 0;
|
||||
rect.y = 0;
|
||||
rect.w = VideoWidth;
|
||||
rect.h = VideoHeight;
|
||||
if (flags & PlayMovieKeepAspect) {
|
||||
int wa;
|
||||
int ha;
|
||||
|
||||
wa = VideoWidth * 100 / avi->Width;
|
||||
ha = VideoHeight * 100 / avi->Height;
|
||||
DebugLevel0Fn(" %d x %d\n" _C_ wa _C_ ha);
|
||||
if( wa < ha ) { // Keep the aspect ratio
|
||||
rect.w = VideoWidth;
|
||||
rect.h = avi->Height * wa / 100;
|
||||
} else {
|
||||
rect.w = avi->Width * ha / 100;
|
||||
rect.h = VideoHeight;
|
||||
}
|
||||
} else { // Just zoom to max
|
||||
rect.w = VideoWidth;
|
||||
rect.h = VideoHeight;
|
||||
}
|
||||
} else {
|
||||
rect.x = (VideoWidth - avi->Width) / 2;
|
||||
rect.y = (VideoHeight - avi->Height) / 2;
|
||||
rect.w = avi->Width;
|
||||
rect.h = avi->Height;
|
||||
}
|
||||
rect.x = (VideoWidth - rect.w) / 2;
|
||||
rect.y = (VideoHeight - rect.h) / 2;
|
||||
|
||||
if( 1 ) {
|
||||
int i;
|
||||
|
|
Loading…
Add table
Reference in a new issue