Exemplo n.º 1
0
        protected override void InitializeGame()
        {
            System.Windows.Forms.Cursor.Hide();

            renderer.ProjectionMode = ProjectionMode.Orthogonal;
            renderer.ViewMatrix = Matrix.LookAtLH( new Vector3( 0, 0, -5.0f ), new Vector3(), new Vector3( 0, 1, 0 ) );
            renderer.Device.RenderState.Lighting = false;

            showFPS = config.GetSetting<bool>( "ShowFPS" );

            fpsFont = renderer.CreateFont( "Arial", 16 );
            fpsFont.ShadowColor = Color.Gray;

            cursor = new Cursor( renderer, "cursor", new Size( 10, 10 ) );

            useBloom = config.GetSetting<bool>( "UseBloom" );

            sceneTex = new Gas.Graphics.Texture( renderer, renderer.FullscreenSize.Width, renderer.FullscreenSize.Height,
                true );
            bloomProcessor = new BloomPostProcessor( renderer );
            bloomProcessor.Blur = config.GetSetting<float>( "BloomBlur" );
            bloomProcessor.BloomScale = config.GetSetting<float>( "BloomScale" );
            bloomProcessor.BrightPassThreshold = config.GetSetting<float>( "BloomBrightPassThreshold" );

            cursorInfluenceMagnitude = config.GetSetting<int>( "CursorInfluenceMagnitude" );

            InitializeGrid();

            this.KeyDown += new KeyEventHandler( OnKeyDown );
        }
Exemplo n.º 2
0
        protected override void InitializeGame()
        {
            this.Icon = new Icon(Application.StartupPath + @"\GasIcon.ico");
            Cursor.Hide();

            useBloom = config.GetSetting<bool>("UseBloom");

            renderer.ProjectionMode = ProjectionMode.Orthogonal;
            renderer.ViewMatrix = Matrix.LookAtLH(new Vector3(0, 0, 5.0f), new Vector3(),
                new Vector3(0, 1, 0));

            font = new Gas.Graphics.Font(renderer, "Arial", 16);
            font.ShadowColor = Color.Red;

            sceneImage = new Texture(renderer, renderer.FullscreenSize.Width, renderer.FullscreenSize.Height,
                true);
            bloomProcessor = new BloomPostProcessor(renderer);
            bloomProcessor.BloomScale = config.GetSetting<float>("BloomScale");
            bloomProcessor.Blur = config.GetSetting<float>("Blur");
            bloomProcessor.BrightPassThreshold = config.GetSetting<float>("BrightPassThreshold");

            sceneGraph = new SceneGraph(renderer);

            string lightColorName = config.GetSetting<string>("LightColor");
            Color lightColor = Color.FromName(lightColorName);
            light = new LightNode(renderer, sceneGraph, Matrix.Identity, 250.0f, 1.0f, lightColor);

            backgroundQuad = new GeometryNode(renderer, sceneGraph, Matrix.Translation(0.0f, 0.0f, -1.0f),
                Mesh.Rectangle(renderer, Color.Black, renderer.FullscreenSize.Width,
                renderer.FullscreenSize.Height, 2.0f), "roughWall");

            waterMesh = new GeometryNode(renderer, sceneGraph, Matrix.Translation(0.0f, 0.0f, 0.0f),
                Mesh.Circle(renderer, Color.Black, 500, 64, 1.0f), "water");

            object1 = new GeometryNode(renderer, sceneGraph, Matrix.Translation(0.0f, 0.0f, 1.0f),
                Mesh.Circle(renderer, Color.Blue, 85, 12), "stones");
            object2 = new GeometryNode(renderer, sceneGraph, Matrix.Identity,
                Mesh.Circle(renderer, Color.Blue, 65, 8), "stones");
            object3 = new GeometryNode(renderer, sceneGraph, Matrix.Identity,
                Mesh.Circle(renderer, Color.Blue, 25, 6), "stones");

            sceneGraph.Root.AddChild(backgroundQuad);
            sceneGraph.Root.AddChild(waterMesh);
            sceneGraph.Root.AddChild(object1);
            object1.AddChild(object2);
            object1.AddChild(light);
            object2.AddChild(object3);

            this.KeyDown += new KeyEventHandler(OnKeyDown);
        }