コード例 #1
0
ファイル: Window.cs プロジェクト: dzamkov/L2D
        public Window()
            : base(640, 480, GraphicsMode.Default, "L2D")
        {
            Path resources = Path.ProcessFile.Parent.Parent.Parent.Parent["Resources"];
            Path shaders = resources["Shaders"];

            this.VSync = VSyncMode.Off;

            //GL.Enable(EnableCap.ColorArray);
            GL.Enable(EnableCap.VertexArray);
            GL.Enable(EnableCap.NormalArray);
            GL.Enable(EnableCap.Texture2D);
            GL.Enable(EnableCap.TextureCoordArray);
			
			
            GL.Enable(EnableCap.CullFace);
            GL.Enable(EnableCap.DepthTest);
            //GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill);

            this.WindowState = WindowState.Maximized;

            Blur b = new Blur(shaders);
            VisualSystem vissys = new VisualSystem(shaders);
            TimeSystem tsys = new TimeSystem();

            PhysicsSystem psys = new PhysicsSystem();
            this._World = new World(vissys, tsys, psys);

            

            // Make it midday
            tsys.Offset = tsys.SecondsPerDay / 2.0;
#if SHADERS
            this._World.Add(Atmosphere.MakeEntity(shaders, AtmosphereOptions.DefaultEarth, AtmosphereQualityOptions.Default));
			this._World.Add(new Sun(37.3 * Math.PI / 180.0 /* LOL my house */));
#endif
            this._World.Add(new GroundTest(resources, new Vector2d(1.0, 1.0)));
            this._World.Add(new PhysDuck(resources));
            
            vissys.Setup();
            vissys.SetSize(this.Width, this.Height);
 
			this._World.Add(this._Player = new Player(this._World.Physics.PhysWorld));
			
			this.Keyboard.KeyDown += delegate(object sender, KeyboardKeyEventArgs e)
            {
                if (e.Key == Key.Q) this._TimeRate *= 2.0;
                if (e.Key == Key.E) this._TimeRate *= 0.5;
            };
            this._TimeRate = 1.0;
        }
コード例 #2
0
ファイル: HDR.cs プロジェクト: dzamkov/L2D
 public HDRShaders(Path Shaders, Blur Blur)
 {
     this.Normal = Shader.Load(Shaders["HDR.glsl"]);
     this.Copy = Shader.Load(Shaders["Copy.glsl"]);
     this.Blur = Blur;
 }