Author: dhudson Date: 2006-07-19 11:53:47 -0400 (Wed, 19 Jul 2006) New Revision: 62753
Modified: trunk/tao/examples/DevIlExamples/SimpleExample/AssemblyInfo.cs trunk/tao/examples/DevIlExamples/SimpleExample/SimpleExample.cs trunk/tao/examples/SdlExamples/GfxPrimitives/GfxPrimitives.cs trunk/tao/examples/SdlExamples/Rectangles/Rectangles.cs trunk/tao/examples/SdlExamples/SmpegPlayer/SmpegPlayer.cs Log: fix some line endings. Fix caption Modified: trunk/tao/examples/DevIlExamples/SimpleExample/AssemblyInfo.cs =================================================================== --- trunk/tao/examples/DevIlExamples/SimpleExample/AssemblyInfo.cs 2006-07-19 15:31:55 UTC (rev 62752) +++ trunk/tao/examples/DevIlExamples/SimpleExample/AssemblyInfo.cs 2006-07-19 15:53:47 UTC (rev 62753) @@ -1,60 +1,60 @@ -#region License -/* -MIT License -Copyright �2003-2005 Tao Framework Team -http://www.taoframework.com -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ -#endregion License - -using System; -using System.Reflection; -using System.Security; -using System.Security.Permissions; - -[assembly: AllowPartiallyTrustedCallers] -[assembly: AssemblyCompany("Tao Framework - http://www.taoframework.com")] -#if DEBUG -[assembly: AssemblyConfiguration("Debug")] -#else -[assembly: AssemblyConfiguration("Retail")] -#endif -[assembly: AssemblyCopyright("Copyright �2003-2005 Tao Framework Team. All rights reserved.")] -[assembly: AssemblyCulture("")] -[assembly: AssemblyDefaultAlias("DevIlExamples.SimpleExample")] -[assembly: AssemblyDelaySign(false)] -[assembly: AssemblyDescription("DevIL simple example.")] -[assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: AssemblyInformationalVersion("1.0.0.0")] -[assembly: AssemblyKeyFile("")] -[assembly: AssemblyKeyName("")] -#if DEBUG -[assembly: AssemblyProduct("DevIlExamples.SimpleExample.exe *** Debug Build ***")] -#else -[assembly: AssemblyProduct("DevIlExamples.SimpleExample.exe")] -#endif -[assembly: AssemblyTitle("DevIL simple example.")] -[assembly: AssemblyTrademark("Tao Framework - http://www.taoframework.com")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: CLSCompliant(true)] -[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.Execution)] -[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.SkipVerification)] -[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.UnmanagedCode)] +#region License +/* +MIT License +Copyright �2003-2005 Tao Framework Team +http://www.taoframework.com +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +#endregion License + +using System; +using System.Reflection; +using System.Security; +using System.Security.Permissions; + +[assembly: AllowPartiallyTrustedCallers] +[assembly: AssemblyCompany("Tao Framework - http://www.taoframework.com")] +#if DEBUG +[assembly: AssemblyConfiguration("Debug")] +#else +[assembly: AssemblyConfiguration("Retail")] +#endif +[assembly: AssemblyCopyright("Copyright �2003-2005 Tao Framework Team. All rights reserved.")] +[assembly: AssemblyCulture("")] +[assembly: AssemblyDefaultAlias("DevIlExamples.SimpleExample")] +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyDescription("DevIL simple example.")] +[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyInformationalVersion("1.0.0.0")] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] +#if DEBUG +[assembly: AssemblyProduct("DevIlExamples.SimpleExample.exe *** Debug Build ***")] +#else +[assembly: AssemblyProduct("DevIlExamples.SimpleExample.exe")] +#endif +[assembly: AssemblyTitle("DevIL simple example.")] +[assembly: AssemblyTrademark("Tao Framework - http://www.taoframework.com")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: CLSCompliant(true)] +[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.Execution)] +[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.SkipVerification)] +[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.UnmanagedCode)] Modified: trunk/tao/examples/DevIlExamples/SimpleExample/SimpleExample.cs =================================================================== --- trunk/tao/examples/DevIlExamples/SimpleExample/SimpleExample.cs 2006-07-19 15:31:55 UTC (rev 62752) +++ trunk/tao/examples/DevIlExamples/SimpleExample/SimpleExample.cs 2006-07-19 15:53:47 UTC (rev 62753) @@ -1,31 +1,31 @@ -#region License -/* -MIT License -Copyright �2003-2005 Tao Framework Team -http://www.taoframework.com -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ -#endregion License - -#region Original Credits / License +#region License +/* +MIT License +Copyright �2003-2005 Tao Framework Team +http://www.taoframework.com +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +#endregion License + +#region Original Credits / License //----------------------------------------------------------------------------- // // DevIL Source Example @@ -38,109 +38,109 @@ // Loads an image and saves it to a new image. // The images can be of any format and can be different. // -//----------------------------------------------------------------------------- -#endregion Original Credits / License - -using System; -using System.IO; -using Tao.DevIl; - -namespace DevIlExamples { - #region Class Documentation - /// <summary> - /// Converts one image to another. - /// </summary> - /// <remarks> - /// <para> - /// Original Author: Denton Woods - /// http://openil.sourceforge.net/ - /// </para> - /// <para> - /// C# Implementation: Randy Ridge - /// http://www.taoframework.com - /// </para> - /// </remarks> - #endregion Class Documentation - public sealed class SimpleExample { - // --- Entry Point --- - #region Main(string[] args) +//----------------------------------------------------------------------------- +#endregion Original Credits / License + +using System; +using System.IO; +using Tao.DevIl; + +namespace DevIlExamples { + #region Class Documentation + /// <summary> + /// Converts one image to another. + /// </summary> + /// <remarks> + /// <para> + /// Original Author: Denton Woods + /// http://openil.sourceforge.net/ + /// </para> + /// <para> + /// C# Implementation: Randy Ridge + /// http://www.taoframework.com + /// </para> + /// </remarks> + #endregion Class Documentation + public sealed class SimpleExample { + // --- Entry Point --- + #region Main(string[] args) /// <summary> /// /// </summary> - /// <param name="args"></param> - [STAThread] - public static void Main(string[] args) { - int imageId; - string inputFile = "Data" + Path.DirectorySeparatorChar + "yinyangblue.gif"; - string outputFile = "Data" + Path.DirectorySeparatorChar + "yinyangblue.jpg"; - - Console.WriteLine("DevIlExamples.SimpleExample - DevIL simple command line application."); - - if(args.Length == 2) { - inputFile = args[0]; - outputFile = args[1]; - Console.WriteLine("Converting - {0} -> {1}", inputFile, outputFile); - } - else { - Console.WriteLine("Usage - DevIlExamples.SimpleExample <inputfile> <outputfile>"); - Console.WriteLine("Converting example files - {0} -> {1}", inputFile, outputFile); - } - - if(Il.ilGetInteger(Il.IL_VERSION_NUM) < Il.IL_VERSION || - Il.ilGetInteger(Ilu.ILU_VERSION_NUM) < Ilu.ILU_VERSION || + /// <param name="args"></param> + [STAThread] + public static void Main(string[] args) { + int imageId; + string inputFile = "Data" + Path.DirectorySeparatorChar + "yinyangblue.gif"; + string outputFile = "Data" + Path.DirectorySeparatorChar + "yinyangblue.jpg"; + + Console.WriteLine("DevIlExamples.SimpleExample - DevIL simple command line application."); + + if(args.Length == 2) { + inputFile = args[0]; + outputFile = args[1]; + Console.WriteLine("Converting - {0} -> {1}", inputFile, outputFile); + } + else { + Console.WriteLine("Usage - DevIlExamples.SimpleExample <inputfile> <outputfile>"); + Console.WriteLine("Converting example files - {0} -> {1}", inputFile, outputFile); + } + + if(Il.ilGetInteger(Il.IL_VERSION_NUM) < Il.IL_VERSION || + Il.ilGetInteger(Ilu.ILU_VERSION_NUM) < Ilu.ILU_VERSION || Il.ilGetInteger(Ilut.ILUT_VERSION_NUM) < Ilut.ILUT_VERSION) { - Console.WriteLine("*** Your DevIL native libraries are older than what Tao.DevIl supports, get the latest DevIL native libraries. ***"); - Console.WriteLine("Your DevIL native IL version: {0}. Tao.DevIl's IL version: {1}.", + Console.WriteLine("*** Your DevIL native libraries are older than what Tao.DevIl supports, get the latest DevIL native libraries. ***"); + Console.WriteLine("Your DevIL native IL version: {0}. Tao.DevIl's IL version: {1}.", Il.ilGetInteger(Il.IL_VERSION_NUM), Il.IL_VERSION); - Console.WriteLine("Your DevIL native ILU version: {0}. Tao.DevIl's ILU version: {1}.", + Console.WriteLine("Your DevIL native ILU version: {0}. Tao.DevIl's ILU version: {1}.", Il.ilGetInteger(Ilu.ILU_VERSION_NUM), Ilu.ILU_VERSION_NUM); - Console.WriteLine("Your DevIL native ILUT version: {0}. Tao.DevIl's ILUT version: {1}.", + Console.WriteLine("Your DevIL native ILUT version: {0}. Tao.DevIl's ILUT version: {1}.", Il.ilGetInteger(Ilut.ILUT_VERSION_NUM), Ilut.ILUT_VERSION_NUM); - } - - // Initialize DevIL - Il.ilInit(); - - // Generate the main image name to use - Il.ilGenImages(1, out imageId); - - // Bind this image name - Il.ilBindImage(imageId); - - // Loads the image into the imageId - if(!Il.ilLoadImage(inputFile)) { - Console.WriteLine("Could not open file, {0}, exiting.", inputFile); - Exit(); - } - - // Display the image's dimensions - Console.WriteLine("Width: {0} Height: {1}, Depth: {2}, Bpp: {3}", - Il.ilGetInteger(Il.IL_IMAGE_WIDTH), Il.ilGetInteger(Il.IL_IMAGE_HEIGHT), - Il.ilGetInteger(Il.IL_IMAGE_DEPTH), - Il.ilGetInteger(Il.IL_IMAGE_BITS_PER_PIXEL)); - - // Enable overwriting destination file - Il.ilEnable(Il.IL_FILE_OVERWRITE); - - // Save the image - Il.ilSaveImage(outputFile); - - // Done with the imageId, so let's delete it - Il.ilDeleteImages(1, ref imageId); - - Exit(); - } - #endregion Main(string[] args) - - #region Exit() - /// <summary> - /// Exits application. - /// </summary> - private static void Exit() { - Console.WriteLine("Press Enter to exit..."); - Console.ReadLine(); - Environment.Exit(0); - } - #endregion Exit() - } -} + } + + // Initialize DevIL + Il.ilInit(); + + // Generate the main image name to use + Il.ilGenImages(1, out imageId); + + // Bind this image name + Il.ilBindImage(imageId); + + // Loads the image into the imageId + if(!Il.ilLoadImage(inputFile)) { + Console.WriteLine("Could not open file, {0}, exiting.", inputFile); + Exit(); + } + + // Display the image's dimensions + Console.WriteLine("Width: {0} Height: {1}, Depth: {2}, Bpp: {3}", + Il.ilGetInteger(Il.IL_IMAGE_WIDTH), Il.ilGetInteger(Il.IL_IMAGE_HEIGHT), + Il.ilGetInteger(Il.IL_IMAGE_DEPTH), + Il.ilGetInteger(Il.IL_IMAGE_BITS_PER_PIXEL)); + + // Enable overwriting destination file + Il.ilEnable(Il.IL_FILE_OVERWRITE); + + // Save the image + Il.ilSaveImage(outputFile); + + // Done with the imageId, so let's delete it + Il.ilDeleteImages(1, ref imageId); + + Exit(); + } + #endregion Main(string[] args) + + #region Exit() + /// <summary> + /// Exits application. + /// </summary> + private static void Exit() { + Console.WriteLine("Press Enter to exit..."); + Console.ReadLine(); + Environment.Exit(0); + } + #endregion Exit() + } +} Modified: trunk/tao/examples/SdlExamples/GfxPrimitives/GfxPrimitives.cs =================================================================== --- trunk/tao/examples/SdlExamples/GfxPrimitives/GfxPrimitives.cs 2006-07-19 15:31:55 UTC (rev 62752) +++ trunk/tao/examples/SdlExamples/GfxPrimitives/GfxPrimitives.cs 2006-07-19 15:53:47 UTC (rev 62753) @@ -87,6 +87,7 @@ try { Sdl.SDL_Init(Sdl.SDL_INIT_EVERYTHING); + Sdl.SDL_WM_SetCaption("Tao.Sdl Example - GfxPrimitives", ""); IntPtr surfacePtr = Sdl.SDL_SetVideoMode( width, height, Modified: trunk/tao/examples/SdlExamples/Rectangles/Rectangles.cs =================================================================== --- trunk/tao/examples/SdlExamples/Rectangles/Rectangles.cs 2006-07-19 15:31:55 UTC (rev 62752) +++ trunk/tao/examples/SdlExamples/Rectangles/Rectangles.cs 2006-07-19 15:53:47 UTC (rev 62753) @@ -1,254 +1,255 @@ -#region License -/* -MIT License -Copyright �2003-2005 Tao Framework Team -http://www.taoframework.com -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ -#endregion License - -#region Original Credits / License -//----------------------------------------------------------------------------- -//Copyright (C) 2003 Will Weisser ([EMAIL PROTECTED]) -// * -// * This library is free software; you can redistribute it and/or -// * modify it under the terms of the GNU Lesser General Public -// * License as published by the Free Software Foundation; either -// * version 2.1 of the License, or (at your option) any later version. -// * -// * This library is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// * Lesser General Public License for more details. -// * -// * You should have received a copy of the GNU Lesser General Public -// * License along with this library; if not, write to the Free Software -// * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//----------------------------------------------------------------------------- -#endregion Original Credits / License - -using System; -using Tao.Sdl; -using System.IO; -using System.Runtime.InteropServices; - -namespace SdlExamples -{ - #region Class Documentation - /// <summary> - /// Simple Tao.Sdl Example - /// </summary> - /// <remarks> - /// Just draws a bunch of rectangles to the screen. - /// To quit, you can close the window, - /// press the Escape key or press the 'q' key - /// <p>Written by David Hudson ([EMAIL PROTECTED])</p> - /// <p>This is a reimplementation of an example - /// written by Will Weisser ([EMAIL PROTECTED])</p> - /// </remarks> - #endregion Class Documentation - public class Rectangles - { - #region Run() - /// <summary> - /// - /// </summary> - public void Run() - { - int flags = (Sdl.SDL_HWSURFACE|Sdl.SDL_DOUBLEBUF|Sdl.SDL_ANYFORMAT); - int bpp = 16; - int width = 640; - int height = 480; - bool quitFlag = false; - - Random rand = new Random(); - - string filepath = @"../../"; - if (File.Exists("Data/SdlExamples.Rectangles.sound.ogg")) - { - filepath = ""; - } - - string musicFile = filepath + "Data/SdlExamples.Rectangles.sound.ogg"; - - Sdl.SDL_Event evt; - - try - { - Sdl.SDL_Init(Sdl.SDL_INIT_EVERYTHING); - IntPtr surfacePtr = Sdl.SDL_SetVideoMode( - width, - height, - bpp, - flags); - - int result = SdlMixer.Mix_OpenAudio( - SdlMixer.MIX_DEFAULT_FREQUENCY, - (short) SdlMixer.MIX_DEFAULT_FORMAT, - 2, - 1024); - IntPtr chunkPtr = SdlMixer.Mix_LoadMUS(musicFile); - - SdlMixer.MusicFinishedDelegate musicStopped = - new SdlMixer.MusicFinishedDelegate(this.musicHasStopped); - SdlMixer.Mix_HookMusicFinished(musicStopped); - - result = SdlMixer.Mix_PlayMusic( chunkPtr, 1); - if (result == -1) - { - Console.WriteLine("Music Error: " + Sdl.SDL_GetError()); - } - - int rmask = 0x00000000; - int gmask = 0x00ff0000; - int bmask = 0x0000ff00; - int amask = 0x000000ff; - - IntPtr rgbSurfacePtr = Sdl.SDL_CreateRGBSurface( - flags, - width, - height, - bpp, - rmask, - gmask, - bmask, - amask); - - Sdl.SDL_Rect rect = new Sdl.SDL_Rect( - 0, - 0, - (short) width, - (short) height); - result = Sdl.SDL_FillRect(rgbSurfacePtr, ref rect, 0); - - Sdl.SDL_Rect rect2; - - IntPtr videoInfoPointer = Sdl.SDL_GetVideoInfo(); - if(videoInfoPointer == IntPtr.Zero) - { - throw new ApplicationException(string.Format("Video query failed: {0}", Sdl.SDL_GetError())); - } - - Sdl.SDL_VideoInfo videoInfo = (Sdl.SDL_VideoInfo) - Marshal.PtrToStructure(videoInfoPointer, - typeof(Sdl.SDL_VideoInfo)); - Console.WriteLine("Hi There"); - - Sdl.SDL_PixelFormat pixelFormat = (Sdl.SDL_PixelFormat) - Marshal.PtrToStructure(videoInfo.vfmt, - typeof(Sdl.SDL_PixelFormat)); - - Console.WriteLine(videoInfo.hw_available); - Console.WriteLine(videoInfo.wm_available); - Console.WriteLine(videoInfo.blit_hw); - Console.WriteLine(videoInfo.blit_hw_CC); - Console.WriteLine(videoInfo.blit_hw_A); - Console.WriteLine(videoInfo.blit_sw); - Console.WriteLine(videoInfo.blit_hw_CC); - Console.WriteLine(videoInfo.blit_hw_A); - Console.WriteLine(videoInfo.blit_fill); - Console.WriteLine(videoInfo.video_mem); - Console.WriteLine(pixelFormat.BitsPerPixel); - Console.WriteLine(pixelFormat.BytesPerPixel); - Console.WriteLine(pixelFormat.Rmask); - Console.WriteLine(pixelFormat.Gmask); - Console.WriteLine(pixelFormat.Bmask); - Console.WriteLine(pixelFormat.Amask); - - int numevents= 10; - Sdl.SDL_Event[] events = new Sdl.SDL_Event[numevents]; - events[0].type = Sdl.SDL_KEYDOWN; - events[0].key.keysym.sym = (int)Sdl.SDLK_p; - events[1].type = Sdl.SDL_KEYDOWN; - events[1].key.keysym.sym = (int)Sdl.SDLK_z; - int result2 = Sdl.SDL_PeepEvents(events, numevents, Sdl.SDL_ADDEVENT, Sdl.SDL_KEYDOWNMASK); - Console.WriteLine("Addevent result: " + result2); - - while (quitFlag == false) - { - result = Sdl.SDL_PollEvent(out evt); - - if (evt.type == Sdl.SDL_QUIT) - { - quitFlag = true; - } - else if (evt.type == Sdl.SDL_KEYDOWN) - { - if ((evt.key.keysym.sym == (int)Sdl.SDLK_ESCAPE) || - (evt.key.keysym.sym == (int)Sdl.SDLK_q)) - { - quitFlag = true; - } - if (evt.key.keysym.sym == (int)Sdl.SDLK_p) - { - Console.WriteLine("Key p event was added"); - } - if (evt.key.keysym.sym == (int)Sdl.SDLK_z) - { - Console.WriteLine("Key z event was added"); - } - } - - rect2 = new Sdl.SDL_Rect( - (short)rand.Next(-300, width), - (short) rand.Next(-300, height), - (short) rand.Next(20, 300), - (short) rand.Next(20, 300)); - - try - { - result = Sdl.SDL_FillRect( - surfacePtr, - ref rect2, - rand.Next(100000)); - result = Sdl.SDL_BlitSurface( - rgbSurfacePtr, - ref rect2, - surfacePtr, - ref rect); - result = Sdl.SDL_Flip(surfacePtr); - } - catch (Exception) {} - } - } - catch - { - Sdl.SDL_Quit(); - throw; - } - } - #endregion Run() - - private void musicHasStopped() - { - Console.WriteLine("The Music has stopped!"); - } - - #region Main() - [STAThread] - static void Main() - { - Rectangles rectangles = new Rectangles(); - rectangles.Run(); - } - #endregion Main() - } -} +#region License +/* +MIT License +Copyright �2003-2005 Tao Framework Team +http://www.taoframework.com +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +#endregion License + +#region Original Credits / License +//----------------------------------------------------------------------------- +//Copyright (C) 2003 Will Weisser ([EMAIL PROTECTED]) +// * +// * This library is free software; you can redistribute it and/or +// * modify it under the terms of the GNU Lesser General Public +// * License as published by the Free Software Foundation; either +// * version 2.1 of the License, or (at your option) any later version. +// * +// * This library is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// * Lesser General Public License for more details. +// * +// * You should have received a copy of the GNU Lesser General Public +// * License along with this library; if not, write to the Free Software +// * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +//----------------------------------------------------------------------------- +#endregion Original Credits / License + +using System; +using Tao.Sdl; +using System.IO; +using System.Runtime.InteropServices; + +namespace SdlExamples +{ + #region Class Documentation + /// <summary> + /// Simple Tao.Sdl Example + /// </summary> + /// <remarks> + /// Just draws a bunch of rectangles to the screen. + /// To quit, you can close the window, + /// press the Escape key or press the 'q' key + /// <p>Written by David Hudson ([EMAIL PROTECTED])</p> + /// <p>This is a reimplementation of an example + /// written by Will Weisser ([EMAIL PROTECTED])</p> + /// </remarks> + #endregion Class Documentation + public class Rectangles + { + #region Run() + /// <summary> + /// + /// </summary> + public void Run() + { + int flags = (Sdl.SDL_HWSURFACE|Sdl.SDL_DOUBLEBUF|Sdl.SDL_ANYFORMAT); + int bpp = 16; + int width = 640; + int height = 480; + bool quitFlag = false; + + Random rand = new Random(); + + string filepath = @"../../"; + if (File.Exists("Data/SdlExamples.Rectangles.sound.ogg")) + { + filepath = ""; + } + + string musicFile = filepath + "Data/SdlExamples.Rectangles.sound.ogg"; + + Sdl.SDL_Event evt; + + try + { + Sdl.SDL_Init(Sdl.SDL_INIT_EVERYTHING); + Sdl.SDL_WM_SetCaption("Tao.Sdl Example - Rectangles", ""); + IntPtr surfacePtr = Sdl.SDL_SetVideoMode( + width, + height, + bpp, + flags); + + int result = SdlMixer.Mix_OpenAudio( + SdlMixer.MIX_DEFAULT_FREQUENCY, + (short) SdlMixer.MIX_DEFAULT_FORMAT, + 2, + 1024); + IntPtr chunkPtr = SdlMixer.Mix_LoadMUS(musicFile); + + SdlMixer.MusicFinishedDelegate musicStopped = + new SdlMixer.MusicFinishedDelegate(this.musicHasStopped); + SdlMixer.Mix_HookMusicFinished(musicStopped); + + result = SdlMixer.Mix_PlayMusic( chunkPtr, 1); + if (result == -1) + { + Console.WriteLine("Music Error: " + Sdl.SDL_GetError()); + } + + int rmask = 0x00000000; + int gmask = 0x00ff0000; + int bmask = 0x0000ff00; + int amask = 0x000000ff; + + IntPtr rgbSurfacePtr = Sdl.SDL_CreateRGBSurface( + flags, + width, + height, + bpp, + rmask, + gmask, + bmask, + amask); + + Sdl.SDL_Rect rect = new Sdl.SDL_Rect( + 0, + 0, + (short) width, + (short) height); + result = Sdl.SDL_FillRect(rgbSurfacePtr, ref rect, 0); + + Sdl.SDL_Rect rect2; + + IntPtr videoInfoPointer = Sdl.SDL_GetVideoInfo(); + if(videoInfoPointer == IntPtr.Zero) + { + throw new ApplicationException(string.Format("Video query failed: {0}", Sdl.SDL_GetError())); + } + + Sdl.SDL_VideoInfo videoInfo = (Sdl.SDL_VideoInfo) + Marshal.PtrToStructure(videoInfoPointer, + typeof(Sdl.SDL_VideoInfo)); + Console.WriteLine("Hi There"); + + Sdl.SDL_PixelFormat pixelFormat = (Sdl.SDL_PixelFormat) + Marshal.PtrToStructure(videoInfo.vfmt, + typeof(Sdl.SDL_PixelFormat)); + + Console.WriteLine(videoInfo.hw_available); + Console.WriteLine(videoInfo.wm_available); + Console.WriteLine(videoInfo.blit_hw); + Console.WriteLine(videoInfo.blit_hw_CC); + Console.WriteLine(videoInfo.blit_hw_A); + Console.WriteLine(videoInfo.blit_sw); + Console.WriteLine(videoInfo.blit_hw_CC); + Console.WriteLine(videoInfo.blit_hw_A); + Console.WriteLine(videoInfo.blit_fill); + Console.WriteLine(videoInfo.video_mem); + Console.WriteLine(pixelFormat.BitsPerPixel); + Console.WriteLine(pixelFormat.BytesPerPixel); + Console.WriteLine(pixelFormat.Rmask); + Console.WriteLine(pixelFormat.Gmask); + Console.WriteLine(pixelFormat.Bmask); + Console.WriteLine(pixelFormat.Amask); + + int numevents= 10; + Sdl.SDL_Event[] events = new Sdl.SDL_Event[numevents]; + events[0].type = Sdl.SDL_KEYDOWN; + events[0].key.keysym.sym = (int)Sdl.SDLK_p; + events[1].type = Sdl.SDL_KEYDOWN; + events[1].key.keysym.sym = (int)Sdl.SDLK_z; + int result2 = Sdl.SDL_PeepEvents(events, numevents, Sdl.SDL_ADDEVENT, Sdl.SDL_KEYDOWNMASK); + Console.WriteLine("Addevent result: " + result2); + + while (quitFlag == false) + { + result = Sdl.SDL_PollEvent(out evt); + + if (evt.type == Sdl.SDL_QUIT) + { + quitFlag = true; + } + else if (evt.type == Sdl.SDL_KEYDOWN) + { + if ((evt.key.keysym.sym == (int)Sdl.SDLK_ESCAPE) || + (evt.key.keysym.sym == (int)Sdl.SDLK_q)) + { + quitFlag = true; + } + if (evt.key.keysym.sym == (int)Sdl.SDLK_p) + { + Console.WriteLine("Key p event was added"); + } + if (evt.key.keysym.sym == (int)Sdl.SDLK_z) + { + Console.WriteLine("Key z event was added"); + } + } + + rect2 = new Sdl.SDL_Rect( + (short)rand.Next(-300, width), + (short) rand.Next(-300, height), + (short) rand.Next(20, 300), + (short) rand.Next(20, 300)); + + try + { + result = Sdl.SDL_FillRect( + surfacePtr, + ref rect2, + rand.Next(100000)); + result = Sdl.SDL_BlitSurface( + rgbSurfacePtr, + ref rect2, + surfacePtr, + ref rect); + result = Sdl.SDL_Flip(surfacePtr); + } + catch (Exception) {} + } + } + catch + { + Sdl.SDL_Quit(); + throw; + } + } + #endregion Run() + + private void musicHasStopped() + { + Console.WriteLine("The Music has stopped!"); + } + + #region Main() + [STAThread] + static void Main() + { + Rectangles rectangles = new Rectangles(); + rectangles.Run(); + } + #endregion Main() + } +} Modified: trunk/tao/examples/SdlExamples/SmpegPlayer/SmpegPlayer.cs =================================================================== --- trunk/tao/examples/SdlExamples/SmpegPlayer/SmpegPlayer.cs 2006-07-19 15:31:55 UTC (rev 62752) +++ trunk/tao/examples/SdlExamples/SmpegPlayer/SmpegPlayer.cs 2006-07-19 15:53:47 UTC (rev 62753) @@ -1,99 +1,100 @@ -#region License -/* -MIT License -Copyright �2003-2005 Tao Framework Team -http://www.taoframework.com -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ -#endregion License - -#region Original Credits / License -//----------------------------------------------------------------------------- -//Copyright (C) 2003 Will Weisser ([EMAIL PROTECTED]) -// * -// * This library is free software; you can redistribute it and/or -// * modify it under the terms of the GNU Lesser General Public -// * License as published by the Free Software Foundation; either -// * version 2.1 of the License, or (at your option) any later version. -// * -// * This library is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// * Lesser General Public License for more details. -// * -// * You should have received a copy of the GNU Lesser General Public -// * License along with this library; if not, write to the Free Software -// * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//----------------------------------------------------------------------------- -#endregion Original Credits / License - -using System; -using System.Threading; -using Tao.Sdl; -using System.Runtime.InteropServices; -using System.IO; - -namespace SdlExamples -{ - #region Class Documentation - /// <summary> - /// Simple Tao.Sdl Example - /// </summary> - /// <remarks> - /// Just draws a bunch of rectangles to the screen. - /// To quit, you can close the window, - /// press the Escape key or press the 'q' key - /// <p>Written by David Hudson ([EMAIL PROTECTED])</p> - /// <p>This is a reimplementation of an example - /// written by Will Weisser ([EMAIL PROTECTED])</p> - /// </remarks> - #endregion Class Documentation - public class SmpegPlayer - { - //int position = 0; - //byte[] two = new byte[4096]; - //Smpeg.SMPEG_DisplayCallback callbackDelegate; - IntPtr surfacePtr; - - #region Run() - /// <summary> - /// - /// </summary> - public void Run() - { - Sdl.SDL_Event evt; - bool quitFlag = false; +#region License +/* +MIT License +Copyright �2003-2005 Tao Framework Team +http://www.taoframework.com +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +#endregion License + +#region Original Credits / License +//----------------------------------------------------------------------------- +//Copyright (C) 2003 Will Weisser ([EMAIL PROTECTED]) +// * +// * This library is free software; you can redistribute it and/or +// * modify it under the terms of the GNU Lesser General Public +// * License as published by the Free Software Foundation; either +// * version 2.1 of the License, or (at your option) any later version. +// * +// * This library is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// * Lesser General Public License for more details. +// * +// * You should have received a copy of the GNU Lesser General Public +// * License along with this library; if not, write to the Free Software +// * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +//----------------------------------------------------------------------------- +#endregion Original Credits / License + +using System; +using System.Threading; +using Tao.Sdl; +using System.Runtime.InteropServices; +using System.IO; + +namespace SdlExamples +{ + #region Class Documentation + /// <summary> + /// Simple Tao.Sdl Example + /// </summary> + /// <remarks> + /// Just draws a bunch of rectangles to the screen. + /// To quit, you can close the window, + /// press the Escape key or press the 'q' key + /// <p>Written by David Hudson ([EMAIL PROTECTED])</p> + /// <p>This is a reimplementation of an example + /// written by Will Weisser ([EMAIL PROTECTED])</p> + /// </remarks> + #endregion Class Documentation + public class SmpegPlayer + { + //int position = 0; + //byte[] two = new byte[4096]; + //Smpeg.SMPEG_DisplayCallback callbackDelegate; + IntPtr surfacePtr; + + #region Run() + /// <summary> + /// + /// </summary> + public void Run() + { + Sdl.SDL_Event evt; + bool quitFlag = false; int flags = (Sdl.SDL_HWSURFACE|Sdl.SDL_DOUBLEBUF|Sdl.SDL_ANYFORMAT); int bpp = 16; int width = 352; int height = 240; Sdl.SDL_Init(Sdl.SDL_INIT_EVERYTHING); + Sdl.SDL_WM_SetCaption("Tao.Sdl Example - SmpegPlayer", ""); surfacePtr = Sdl.SDL_SetVideoMode( width, height, bpp, flags); SdlMixer.Mix_OpenAudio(SdlMixer.MIX_DEFAULT_FREQUENCY, unchecked(Sdl.AUDIO_S16LSB), 2, 1024); - Smpeg.SMPEG_Info info = new Smpeg.SMPEG_Info(); + Smpeg.SMPEG_Info info = new Smpeg.SMPEG_Info(); string filepath = @"../../"; if (File.Exists("Data/SdlExamples.SmpegPlayer.mpg")) @@ -132,28 +133,28 @@ //Smpeg.SMPEG_loop(intPtr, 1); //Smpeg.SMPEG_enableaudio(intPtr, 1); - while ((Smpeg.SMPEG_status(intPtr) == Smpeg.SMPEG_PLAYING) && - (quitFlag == false)) - { - Sdl.SDL_PollEvent(out evt); - - if (evt.type == Sdl.SDL_QUIT) - { - quitFlag = true; - } - else if (evt.type == Sdl.SDL_KEYDOWN) - { - if ((evt.key.keysym.sym == (int)Sdl.SDLK_ESCAPE) || - (evt.key.keysym.sym == (int)Sdl.SDLK_q)) - { - quitFlag = true; - } - } - } + while ((Smpeg.SMPEG_status(intPtr) == Smpeg.SMPEG_PLAYING) && + (quitFlag == false)) + { + Sdl.SDL_PollEvent(out evt); + + if (evt.type == Sdl.SDL_QUIT) + { + quitFlag = true; + } + else if (evt.type == Sdl.SDL_KEYDOWN) + { + if ((evt.key.keysym.sym == (int)Sdl.SDLK_ESCAPE) || + (evt.key.keysym.sym == (int)Sdl.SDLK_q)) + { + quitFlag = true; + } + } + } Smpeg.SMPEG_stop(intPtr); - Smpeg.SMPEG_delete(intPtr); - } - + Smpeg.SMPEG_delete(intPtr); + } + // private void player(IntPtr one, byte[] temp, int len) // { // //position +=len; @@ -162,16 +163,16 @@ // Marshal.Copy(tempPtr, two, 0, len); // Smpeg.SMPEG_playAudio(one, two, len); // position +=len; -// } - #endregion Run() - - #region Main() - [STAThread] - static void Main() - { - SmpegPlayer player = new SmpegPlayer(); - player.Run(); - } - #endregion Main() - } -} +// } + #endregion Run() + + #region Main() + [STAThread] + static void Main() + { + SmpegPlayer player = new SmpegPlayer(); + player.Run(); + } + #endregion Main() + } +}
_______________________________________________ Mono-patches maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-patches
