From f556219fe75a6717588c3af504a455050dc7ab8e Mon Sep 17 00:00:00 2001 From: Jesse Litton Date: Wed, 23 Apr 2014 12:07:37 -0500 Subject: [PATCH 1/3] Comment updates for SDL2/*.cs --- MonoGame.Framework/SDL2/SDL2_GameWindow.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/MonoGame.Framework/SDL2/SDL2_GameWindow.cs b/MonoGame.Framework/SDL2/SDL2_GameWindow.cs index f0fdf204250..1ee343e122f 100644 --- a/MonoGame.Framework/SDL2/SDL2_GameWindow.cs +++ b/MonoGame.Framework/SDL2/SDL2_GameWindow.cs @@ -401,8 +401,6 @@ internal void INTERNAL_RunLoop() #endif while (SDL.SDL_PollEvent(out evt) == 1) { - // TODO: All events... - // Keyboard if (evt.type == SDL.SDL_EventType.SDL_KEYDOWN) { From 6f66149f2fd876d30b2bccb1de7e0ea98e2c701b Mon Sep 17 00:00:00 2001 From: Jesse Litton Date: Wed, 23 Apr 2014 18:42:29 -0500 Subject: [PATCH 2/3] SDL2/Input & SDL2/Media Comment Cleanup --- MonoGame.Framework/SDL2/Input/SDL2_GamePad.cs | 6 ++++-- MonoGame.Framework/SDL2/Media/Song.cs | 6 +++++- MonoGame.Framework/SDL2/Media/Video.cs | 6 +++--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/MonoGame.Framework/SDL2/Input/SDL2_GamePad.cs b/MonoGame.Framework/SDL2/Input/SDL2_GamePad.cs index d96f774f064..7139db33485 100644 --- a/MonoGame.Framework/SDL2/Input/SDL2_GamePad.cs +++ b/MonoGame.Framework/SDL2/Input/SDL2_GamePad.cs @@ -286,7 +286,8 @@ private static void INTERNAL_AutoConfig() osConfigFile += Environment.GetEnvironmentVariable("HOME"); if (osConfigFile.Length == 0) { - osConfigFile += "MonoGameJoystick.cfg"; // Oh well. + // Home wasn't found, so just try file in current directory. + osConfigFile = "MonoGameJoystick.cfg"; } else { @@ -302,7 +303,8 @@ private static void INTERNAL_AutoConfig() osConfigFile += Environment.GetEnvironmentVariable("HOME"); if (osConfigFile.Length == 0) { - osConfigFile += "MonoGameJoystick.cfg"; // Oh well. + // Home wasn't found, so just try file in current directory. + osConfigFile = "MonoGameJoystick.cfg"; } else { diff --git a/MonoGame.Framework/SDL2/Media/Song.cs b/MonoGame.Framework/SDL2/Media/Song.cs index 019190dc9ed..2ca140258a3 100644 --- a/MonoGame.Framework/SDL2/Media/Song.cs +++ b/MonoGame.Framework/SDL2/Media/Song.cs @@ -234,7 +234,11 @@ internal void Stop() /// internal void SetEventHandler(FinishedPlayingHandler handler) { - // No-op + // No-op. We always use MediaPlayer.OnSongFinishedPlaying as handler. + + /* TODO: Remove this function, and the call in Song.cs, since we've + * completely forked MediaPlayer.cs? + */ } internal void OnFinishedPlaying() diff --git a/MonoGame.Framework/SDL2/Media/Video.cs b/MonoGame.Framework/SDL2/Media/Video.cs index 17c9bd75ec5..62cc7ea9166 100644 --- a/MonoGame.Framework/SDL2/Media/Video.cs +++ b/MonoGame.Framework/SDL2/Media/Video.cs @@ -154,7 +154,7 @@ internal static string Normalize(string FileName) return FileName; } - // Check the file extension + // Valid video asset names should not already have an extension, if (!string.IsNullOrEmpty(Path.GetExtension(FileName))) { return null; @@ -170,7 +170,7 @@ internal static string Normalize(string FileName) return FileName + ".ogg"; } - return null; + return null; // File not found with supported extension. } #endregion @@ -187,7 +187,7 @@ internal void Initialize() // Initialize the decoder. theoraDecoder = TheoraPlay.THEORAPLAY_startDecodeFile( FileName, - 150, // Arbitrarily 5 seconds in a 30fps movie. + 150, // Max frames to buffer. Arbitrarily set 5 seconds, assuming 30fps. #if VIDEOPLAYER_OPENGL TheoraPlay.THEORAPLAY_VideoFormat.THEORAPLAY_VIDFMT_IYUV #else From 8ff2f5fe3d5c537234d337d75e2b828c2d38460f Mon Sep 17 00:00:00 2001 From: Jesse Litton Date: Thu, 24 Apr 2014 05:56:06 -0500 Subject: [PATCH 3/3] Updates per Flibi's comments --- MonoGame.Framework/Media/MediaPlayer.cs | 1 - MonoGame.Framework/SDL2/Media/Song.cs | 12 ------------ MonoGame.Framework/SDL2/Media/Video.cs | 2 +- 3 files changed, 1 insertion(+), 14 deletions(-) diff --git a/MonoGame.Framework/Media/MediaPlayer.cs b/MonoGame.Framework/Media/MediaPlayer.cs index af3a0eb59a5..7006d709a7f 100644 --- a/MonoGame.Framework/Media/MediaPlayer.cs +++ b/MonoGame.Framework/Media/MediaPlayer.cs @@ -291,7 +291,6 @@ private static void NextSong(int direction) private static void PlaySong(Song song) { - song.SetEventHandler(OnSongFinishedPlaying); song.Volume = IsMuted ? 0.0f : Volume; song.Play(); State = MediaState.Playing; diff --git a/MonoGame.Framework/SDL2/Media/Song.cs b/MonoGame.Framework/SDL2/Media/Song.cs index 2ca140258a3..d84657c4201 100644 --- a/MonoGame.Framework/SDL2/Media/Song.cs +++ b/MonoGame.Framework/SDL2/Media/Song.cs @@ -229,18 +229,6 @@ internal void Stop() #region Internal Event Handler Methods - /// - /// Set the event handler for "Finished Playing". Done this way to prevent multiple bindings. - /// - internal void SetEventHandler(FinishedPlayingHandler handler) - { - // No-op. We always use MediaPlayer.OnSongFinishedPlaying as handler. - - /* TODO: Remove this function, and the call in Song.cs, since we've - * completely forked MediaPlayer.cs? - */ - } - internal void OnFinishedPlaying() { MediaPlayer.OnSongFinishedPlaying(null, null); diff --git a/MonoGame.Framework/SDL2/Media/Video.cs b/MonoGame.Framework/SDL2/Media/Video.cs index 62cc7ea9166..91fbc165025 100644 --- a/MonoGame.Framework/SDL2/Media/Video.cs +++ b/MonoGame.Framework/SDL2/Media/Video.cs @@ -170,7 +170,7 @@ internal static string Normalize(string FileName) return FileName + ".ogg"; } - return null; // File not found with supported extension. + return null; // File not found with supported extension. } #endregion