Esempio n. 1
0
        public override void Intro( params object [] args )
        {
            LiqueurSystem.Window.Title = "Simple Dodge";
            LiqueurSystem.GraphicsDevice.BlendState = true;
            LiqueurSystem.GraphicsDevice.BlendOperation = BlendOperation.AlphaBlend;

            Add ( InputHelper.CreateInstance () );
            InputHelper.IsKeyboardEnabled = true;
            Add ( SceneContainer = new SceneContainer ( new MenuScene () ) );

            contentManager = new ContentManager ( FileSystemManager.GetFileSystem ( "ManifestFileSystem" ) );
            contentManager.AddDefaultContentLoader ();
            LiqueurSystem.Launcher.InvokeInMainThread ( () =>
            {
                fpsFont = contentManager.Load<TrueTypeFont> ( "Test.Game.Dodge.Resources.GameFont.ttf", 20 );
            } );

            FpsCalculator calc;
            Add ( calc = new FpsCalculator () );
            calc.DrawEvent += ( object sender, GameTimeEventArgs e ) =>
            {
                string fpsString = string.Format ( "Update FPS:{0:0.00}\nRender FPS:{1:0.00}", calc.UpdateFPS, calc.DrawFPS );
                fpsFont.DrawFont ( fpsString, Color.White,
                    LiqueurSystem.GraphicsDevice.ScreenSize - fpsFont.MeasureString ( fpsString ) - new Vector2 ( 10, 10 ) );
            };

            base.Intro ( args );
        }
Esempio n. 2
0
 public override void Intro( params object [] args )
 {
     contentManager = new ContentManager ( FileSystemManager.GetFileSystem ( "ManifestFileSystem" ) );
     contentManager.AddDefaultContentLoader ();
     LiqueurSystem.Launcher.InvokeInMainThread ( () =>
     {
         titleFont = contentManager.Load<TrueTypeFont> ( "Test.Game.Dodge.Resources.GameFont.ttf", 64 );
         menuFont = contentManager.Load<TrueTypeFont> ( "Test.Game.Dodge.Resources.GameFont.ttf", 24 );
     } );
     base.Intro ( args );
 }
Esempio n. 3
0
        public override void Intro( params object [] args )
        {
            contentManager = new ContentManager ( FileSystemManager.GetFileSystem ( "ManifestFileSystem" ) );
            contentManager.AddDefaultContentLoader ();

            audio1 = contentManager.Load<IAudio> ( "Test.Game.PlaySound.Resources.test1.ogg" );
            audio2 = contentManager.Load<IAudio> ( "Test.Game.PlaySound.Resources.test2.ogg" );

            font = contentManager.Load<TrueTypeFont> ( "Test.Game.PlaySound.Resources.GameFont.ttf", 20 );

            Add ( InputHelper.CreateInstance () );

            base.Intro ( args );
        }
Esempio n. 4
0
        public override void Intro( params object [] args )
        {
            LiqueurSystem.GraphicsDevice.CullingMode = CullingMode.None;

            Add ( InputHelper.CreateInstance () );

            FpsCalculator calc = new FpsCalculator ();
            calc.DrawEvent += ( object sender, GameTimeEventArgs e ) =>
            {
                int childrenCount = 0;
                for ( int i = 0; i < 6; ++i )
                    childrenCount += nodes [ i ].ChildrenCount;
                LiqueurSystem.Window.Title = string.Format ( "Update FPS: {0}, Draw FPS: {1}, Children count: {2}",
                    calc.UpdateFPS, calc.DrawFPS, childrenCount );
            };
            Add ( calc );

            ContentManager.ContentLoaderAssemblies.Add ( Assembly.Load ( "Daramkun.Liqueur.Spirit" ) );
            contentManager = new ContentManager ( FileSystemManager.GetFileSystem ( "ManifestFileSystem" ) );
            contentManager.AddDefaultContentLoader ();
            Texture2DContentLoader.AddDefaultDecoders ();

            textures = new ITexture2D [ 6 ];
            textures [ 0 ] = contentManager.Load<ITexture2D> ( "Test.Game.PerformanceTester.Resources.0096x0096.png" );
            textures [ 1 ] = contentManager.Load<ITexture2D> ( "Test.Game.PerformanceTester.Resources.0128x0128.png" );
            textures [ 2 ] = contentManager.Load<ITexture2D> ( "Test.Game.PerformanceTester.Resources.0256x0256.png" );
            textures [ 3 ] = contentManager.Load<ITexture2D> ( "Test.Game.PerformanceTester.Resources.0512x0512.png" );
            textures [ 4 ] = contentManager.Load<ITexture2D> ( "Test.Game.PerformanceTester.Resources.1024x1024.png" );
            textures [ 5 ] = contentManager.Load<ITexture2D> ( "Test.Game.PerformanceTester.Resources.2048x2048.png" );

            nodes = new Node [ 6 ];
            for ( int i = 0; i < 6; ++i )
            {
                nodes [ i ] = Add ( new Node () );
            }

            base.Intro ( args );
        }
Esempio n. 5
0
        public override void Intro( params object [] args )
        {
            LiqueurSystem.GraphicsDevice.BlendState = true;
            LiqueurSystem.GraphicsDevice.BlendOperation = BlendOperation.AlphaBlend;

            LiqueurSystem.Window.Title = "Information Viewer";

            contentManager = new ContentManager ( FileSystemManager.GetFileSystem ( "ManifestFileSystem" ) );
            contentManager.AddDefaultContentLoader ();
            LiqueurSystem.Launcher.InvokeInMainThread ( () =>
            {
                font = contentManager.Load<TrueTypeFont> ( "Test.Game.InfoViewer.Resources.GameFont.ttf", 20 );
            } );

            Add ( InputHelper.CreateInstance () );

            infoText = string.Format (
            @"Platform Type: {0}
            Platform Version: {1}
            Machine Unique ID: {2}
            User Name: {3}

            Base Renderer: {4}
            Renderer Version: {5}
            Maximum Anisotropic Level: {6}",
                LiqueurSystem.Launcher.PlatformInformation.PlatformType,
                LiqueurSystem.Launcher.PlatformInformation.PlatformVersion,
                LiqueurSystem.Launcher.PlatformInformation.MachineUniqueIdentifier,
                LiqueurSystem.Launcher.PlatformInformation.UserName,

                LiqueurSystem.GraphicsDevice.BaseRenderer,
                LiqueurSystem.GraphicsDevice.RendererVersion,
                LiqueurSystem.GraphicsDevice.MaximumAnisotropicLevel
            );

            base.Intro ( args );
        }
Esempio n. 6
0
        public override void Intro( params object [] args )
        {
            IFileSystem fileSystem = FileSystemManager.GetFileSystem ( "ManifestFileSystem" );
            contentManager = new ContentManager ( fileSystem );
            contentManager.AddDefaultContentLoader ();

            ImageInfo imageInfo = new PngDecoder ().Decode ( fileSystem.OpenFile ( "Test.Game.Terrain.Resources.terrain_01.png" ) );
            Color [] decoded = imageInfo.GetPixel ( null );

            terrainVertex = LiqueurSystem.GraphicsDevice.CreateVertexBuffer<TerrainVertex> (
                FlexibleVertexFormat.PositionXYZ | FlexibleVertexFormat.Diffuse | FlexibleVertexFormat.TextureUV1,
                imageInfo.Width * imageInfo.Height );
            TerrainVertex [] tempVertices = new TerrainVertex [ terrainVertex.Length ];
            int index = 0;
            for ( int x = 0; x < imageInfo.Height; x++ )
            {
                for ( int z = 0; z < imageInfo.Width; z++ )
                {
                    int location = x * imageInfo.Width + z;
                    tempVertices [ index ] = new TerrainVertex (
                        ( x - imageInfo.Width / 2 ) * 5.0f, ( decoded [ location ].AlphaValue ) * 5.0f / 2,
                        ( z - imageInfo.Width / 2 ) * 5.0f,
                        z / ( float ) imageInfo.Width, x / ( float ) imageInfo.Height
                    );
                    ++index;
                }
            }
            terrainVertex.Vertices = tempVertices;

            terrainIndex = LiqueurSystem.GraphicsDevice.CreateIndexBuffer ( imageInfo.Width * imageInfo.Height * 2 * 3 );
            int [] tempIndices = new int [ terrainIndex.Length ];
            index = 0;
            for ( int z = 0; z < imageInfo.Height - 1; z++ )
            {
                for ( int x = 0; x < imageInfo.Width - 1; x++ )
                {
                    tempIndices [ index++ ] = z * imageInfo.Width + x;
                    tempIndices [ index++ ] = z * imageInfo.Width + ( x + 1 );
                    tempIndices [ index++ ] = ( z + 1 ) * imageInfo.Width + x;
                    tempIndices [ index++ ] = ( z + 1 ) * imageInfo.Width + x;
                    tempIndices [ index++ ] = z * imageInfo.Width + ( x + 1 );
                    tempIndices [ index++ ] = ( z + 1 ) * imageInfo.Width + ( x + 1 );
                }
            }
            terrainIndex.Indices = tempIndices;

            terrainEffect = new SpriteEffect ();

            texture = contentManager.Load<ITexture2D> ( "Test.Game.Terrain.Resources.terrain_02.png" );

            LiqueurSystem.GraphicsDevice.CullingMode = CullingMode.None;
            LiqueurSystem.GraphicsDevice.IsZWriteEnable = true;
            LiqueurSystem.GraphicsDevice.BlendState = true;
            LiqueurSystem.GraphicsDevice.BlendOperation = BlendOperation.AlphaBlend;

            base.Intro ( args );
        }