Exemplo n.º 1
0
        public Demo2DGame()
            : base(new GameOptions()
            {
                AutoResizeViewport = true,
                WindowResizable = true
            })
        {
            this.Window.Title = "Samurai 2D Demo";

            this.Graphics.DepthBufferState = DepthBufferState.LessThanOrEqual;

            this.Graphics.BlendState = BlendState.AlphaBlend;
            this.Graphics.RasterizerState = RasterizerState.Default;

            this.spriteRenderer = new SpriteRenderer(this.Graphics, 1024);
            this.shaderProgram = new BasicSpriteShaderProgram(this.Graphics);

            this.planesTexture = Texture2D.LoadFromFile(this.Graphics, "Planes.png", new TextureParams()
                {
                });

            this.planeSpriteSheet = SpriteSheet.Build(this.planesTexture, 64, 64);

            this.font = TextureFont.Build(this.Graphics, "Segoe UI", 72, new TextureFontParams()
                {
                    Color = Color4.White,
                    BackgroundColor = Color4.Transparent,
                    //ColorKey = Color4.Black
                });

            this.keyboard = new Keyboard();
            this.mouse = new Mouse(this.Window);

            Random random = new Random();

            this.planes = new List<Plane>();

            for (int i = 0; i < PlaneCount; i++)
            {
                this.planes.Add(new Plane(
                    random.Next(4) * 3,
                    new Vector2(random.Next(this.Window.Width), random.Next(this.Window.Height)),
                    (float)random.Next(360),
                    this.Window.Size
                ));
            }
        }
Exemplo n.º 2
0
 public ControlInputHandler(IGraphicsHostControl hostControl)
 {
     this.mouse = new Mouse(hostControl);
 }