Пример #1
0
 protected override void Draw(GameTime time)
 {
     GL.ClearColor (Color4.White);
     GL.Clear (ClearBufferMask.ColorBufferBit);
     iodine.Call ("draw", time, SpriteBatch);
     base.Draw (time);
 }
Пример #2
0
 public override void Draw(GameTime time, SpriteBatch batch)
 {
     batch.Draw (texMap, OpenTK.Vector2.Zero, Color4.White);
     batch.Draw (texOverlay, OpenTK.Vector2.Zero, new Color4 (1, 1, 1, overlayAlpha));
     batch.Draw (texMenu, OpenTK.Vector2.Zero, new Color4 (1, 1, 1, menuAlpha));
     base.Draw (time, batch);
 }
Пример #3
0
 protected override void Draw(GameTime time)
 {
     Python.Call ("draw", this, time);
     SpriteBatch.Begin ();
     Python.Call ("draw2d", this, time, SpriteBatch);
     SpriteBatch.End ();
     base.Draw (time);
 }
Пример #4
0
 protected override void Draw(GameTime time)
 {
     GL.ClearColor (Color4.White);
     GL.Clear (ClearBufferMask.ColorBufferBit);
     SpriteBatch.Begin ();
     UI.Draw (time, SpriteBatch);
     SpriteBatch.End ();
     base.Draw (time);
 }
Пример #5
0
        protected override void Update(GameTime time)
        {
            // Exit if escape is pressed
            if (Keyboard.IsKeyTyped (Key.Escape))
                Exit ();

            stage.Act (time);

            base.Update (time);
        }
Пример #6
0
 public override void Draw(GameTime time, SpriteBatch batch)
 {
     var tint = new Color4 (1 - (blueTint * 3f), 1f - (blueTint * 2f), 1f - blueTint, 1);
     batch.Draw (texMap, new Vector2 (backgroundLeft, 0), tint);
     if (backgroundLeft < 640)
         batch.Draw (texMap, new Vector2 (backgroundLeft + texMap.Width, 0), tint);
     bird.Draw (time, batch);
     generator.Draw (time, batch);
     base.Draw (time, batch);
 }
Пример #7
0
        protected override void Draw(GameTime time)
        {
            GL.Clear (ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            SpriteBatch.Begin ();
            SpriteBatch.Draw (test, Vector2.Zero, Color4.White);
            SpriteBatch.End ();

            base.Draw (time);
        }
Пример #8
0
 public void Draw(GameTime time, SpriteBatch batch)
 {
     tubes.ForEach (instance => {
         if (instance.IsInView ()) {
             for (var i = 0; i < instance.Tubes.Length; i++) {
                 batch.Draw (instance.Tubes [i].Texture, instance.Tubes [i].Position, Color4.White);
             }
         }
     });
 }
Пример #9
0
 public void Action(GameTime time, KeyboardBuffer keyboard, MouseBuffer mouse)
 {
     if (keyboard.IsKeyDown (Key.W))
         Position.Y -= 1;
     if (keyboard.IsKeyDown (Key.S))
         Position.Y += 1;
     if (keyboard.IsKeyDown (Key.A))
         Position.X -= 1;
     if (keyboard.IsKeyDown (Key.D))
         Position.X += 1;
 }
Пример #10
0
        protected override void Draw(GameTime time)
        {
            GL.Clear (ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            RenderingPipeline.Draw (camera.Camera, shader => {
                GL.Clear (ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
                foreach (Model model in models)
                    model.Draw (shader, camera.Camera);
            });

            base.Draw (time);
        }
Пример #11
0
        protected override void Draw(GameTime time)
        {
            GL.ClearColor (.25f, .30f, .35f, 1f);
            GL.Clear (ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            batch.Begin ();
            batch.Draw (tex, Vector2.Zero, Color4.White, Vector2.One);
            testMap.Draw (batch);
            stage.Draw (time, batch);
            batch.End ();

            base.Draw (time);
        }
Пример #12
0
 public void Update(GameTime time)
 {
     var speed = TUBE_SPEED * (float) time.Elapsed.TotalMilliseconds;
     for (var i = 0; i < tubes.Count; i++) {
         var instance = tubes [i];
         for (var j = 0; j < instance.Tubes.Length; j++) {
             var tube = instance.Tubes [j];
             tube.Position.X -= speed;
             if (tube.Position.X < (160 - (tube.Texture.Width / 2)))
                 AddTube ();
             if (tube.Position.X < (-tube.Texture.Width)) {
                 tubes.Remove (instance);
                 --tubeCount;
                 break;
             }
         }
     }
 }
Пример #13
0
        protected override void Draw(GameTime time)
        {
            GL.ClearColor (.25f, .30f, .35f, 1f);
            GL.Clear (ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            SpriteBatch.Begin ();
            TileMap.Draw (SpriteBatch);
            SpriteBatch.Draw (SpriteSheet.Texture, SpriteSheet[0, 3], new Vector2 ((float) Math.Floor (Mouse.X / 64), (float) Math.Floor (Mouse.Y / 64)) * 64, Color4.White, scale: 4f, rotation: 0);
            SpriteBatch.Draw (UITexture, Vector2.Zero, Color4.White, scale: 8f, rotation: 0);
            SpriteBatch.Draw (SpriteSheet.Texture, SpriteSheet[0, 5], new Vector2 (856, 96), Color4.White, scale: 1f, rotation: 0);
            SpriteBatch.Draw (SpriteSheet.Texture, SpriteSheet[1, 5], new Vector2 (856, 144), Color4.White, scale: 1f, rotation: 0);
            Font.DrawString (SpriteBatch, "100", new Vector2 (872, 86), Color4.White);
            Font.DrawString (SpriteBatch, "32", new Vector2 (872, 134), Color4.White);

            SpriteBatch.End ();

            base.Draw (time);
        }
Пример #14
0
 public override void Update(GameTime time)
 {
     blueTint = MathHelper.Clamp (blueTint + (DAYNIGHT_CYCLE_SPEED * (float) time.Elapsed.TotalSeconds), 0, DAYNIGHT_CYCLE_MIN);
     scoreDelta += 2f * (float) time.Elapsed.TotalSeconds;
     if (scoreDelta > 1f) {
         score += 1;
         lblScore.Text = "Score: " + score;
         scoreDelta -= 1f;
     }
     game.Mouse.CursorVisible = false;
     game.Mouse.ShouldCenterMouse = true;
     if (game.Keyboard.IsKeyTyped (OpenTK.Input.Key.Escape))
         UIController.Instance.SwitchScene ("mainmenu");
     var scrollSpeed = 160f * (float) time.Elapsed.TotalSeconds;
     backgroundLeft = Wrap (backgroundLeft - scrollSpeed, -texMap.Width);
     bird.Update (time);
     generator.Update (time);
     base.Update (time);
 }
Пример #15
0
        protected override void Draw(GameTime time)
        {
            GL.ClearColor (.25f, .30f, .35f, 1f);
            GL.Clear (ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            program.Use (shader => {
                GL.BindVertexArray (abo);
                texture.Bind ();

                shader["VP"] = camera.ViewProjectionMatrix;
                shader["Right"] = camera.Right;
                shader["Up"] = camera.Up;

                shader["tex"] = 0;

                GL.DrawArrays (PrimitiveType.Quads, 0, 4);
            });

            base.Draw (time);
        }
Пример #16
0
 public void Update(GameTime time)
 {
     ypos = MathHelper.Clamp (ypos + (drag * (float) time.Elapsed.TotalSeconds), 0, game.Resolution.Height - (sheet [0].Height * animator.Scale.Y));
     drag = MathHelper.Clamp (drag + (750 * (float) time.Elapsed.TotalSeconds), MIN_DRAG, MAX_DRAG);
     if (ydelta > 0) {
         var xdrag = (drag * 5 * (float) time.Elapsed.TotalSeconds);
         ypos -= xdrag;
         ydelta = MathHelper.Clamp (ydelta - xdrag, 0, game.Resolution.Height);
     }
     clickCountDelta += (float) time.Elapsed.TotalMilliseconds;
     if (clickCountDelta > CLICK_COUNT_RESET) {
         clickCount = 0;
         clickCountDelta -= CLICK_COUNT_RESET;
     }
     if (game.Mouse.IsButtonDown (MouseButton.Left)) {
         var ydeltaspeed = UP_VELOCITY * (float) time.Elapsed.TotalMilliseconds;
         ydelta += ydeltaspeed;
         if (clickCount > MAX_CLICKS)
             ydelta -= ydeltaspeed;
         upydelta = ydelta;
         drag = MIN_DRAG;
         if (!mouseDown) {
             ++clickCount;
             mouseDown = true;
         }
     } else if (game.Mouse.IsButtonUp (MouseButton.Left) && mouseDown)
         mouseDown = false;
     animator.Position.Y = ypos;
     animator.Update (time);
     var bounds = new RectangleF (
         x: animator.Position.X,
         y: animator.Position.Y,
         width: sheet [0].Width,
         height: sheet [0].Height
     );
     if (generator.CollidesWithTube (bounds)) {
         Console.WriteLine ("You lost!");
     }
 }
Пример #17
0
 public override void Update(GameTime time)
 {
     game.Mouse.CursorVisible = true;
     game.Mouse.ShouldCenterMouse = false;
     if (fadeOut) {
         var fadeSpeed = 2f * (float) time.Elapsed.TotalSeconds;
         overlayAlpha = MathHelper.Clamp (overlayAlpha - fadeSpeed, 0f, 1f);
         menuAlpha = MathHelper.Clamp (menuAlpha - fadeSpeed * 2f, 0f, 1f);
         btnStart.Transparency = MathHelper.Clamp (btnStart.Transparency - (fadeSpeed * 2f), 0f, 1f);
         btnExit.Transparency = MathHelper.Clamp (btnStart.Transparency - (fadeSpeed * 2f), 0f, 1f);
         if (overlayAlpha <= .1f && menuAlpha <= .1f) {
             ResetLayout (true);
             UIController.Instance.SwitchScene ("maingame");
         }
     } else if (fadeIn) {
         var fadeSpeed = 5f * (float) time.Elapsed.TotalSeconds;
         menuAlpha = MathHelper.Clamp (menuAlpha + fadeSpeed, 0f, 1f);
         btnStart.Transparency = MathHelper.Clamp (btnStart.Transparency + (fadeSpeed * 2f), 0f, 1f);
         btnExit.Transparency = MathHelper.Clamp (btnStart.Transparency + (fadeSpeed * 2f), 0f, 1f);
         overlayAlpha = MathHelper.Clamp (overlayAlpha + (fadeSpeed * 2f), 0f, .5f);
     }
     base.Update (time);
 }
Пример #18
0
 public override void Draw(GameTime time, SpriteBatch batch)
 {
     if (UseTexture && BackgroundTexture != null)
         batch.Draw (BackgroundTexture, BackgroundTexture.Bounds, Bounds, new Color4 (1, 1, 1, Transparency));
     base.Draw (time, batch);
 }
Пример #19
0
        /// <summary>
        /// Update.
        /// </summary>
        /// <param name="time">Time.</param>
        public void Update(GameTime time)
        {
            // Calculate the delta increase
            var deltaIncrease = Speed * (float) time.Elapsed.TotalSeconds;
            Delta += deltaIncrease;

            // Update the tile index
            if (Delta >= Target) {
                Delta -= Target;
                ++Index;
                if (Index == Count)
                    Index = 0;
            }
        }
Пример #20
0
 public override void Update(GameTime time)
 {
     var mouse = UIController.Instance.Game.Mouse;
     var mouseRect = new Rectangle ((int) mouse.X, (int) mouse.Y, 1, 1);
     if (mouseDown && mouse.IsButtonUp (MouseButton.Left))
         mouseDown = false;
     if (Bounds.IntersectsWith (mouseRect)) {
         Label.ForegroundColor = HighlightForegroundColor;
         highlighted = true;
         if (!mouseDown && mouse.IsButtonDown (MouseButton.Left)) {
             Click (this, EventArgs.Empty);
             mouseDown = true;
         }
     } else {
         if (highlighted) {
             Label.ForegroundColor = ForegroundColor;
             highlighted = false;
         }
     }
     base.Update (time);
 }
Пример #21
0
 public void Draw(GameTime time, SpriteBatch batch)
 {
     animator.Draw (time, batch);
 }
Пример #22
0
 protected override void Update(GameTime time)
 {
     python ["update"] ();
     base.Update (time);
 }
Пример #23
0
 protected override void Update(GameTime time)
 {
     UI.Update (time);
     base.Update (time);
 }
Пример #24
0
 protected override void Draw(GameTime time)
 {
     python ["draw"] ();
     base.Draw (time);
 }
Пример #25
0
 public override void Update(GameTime time)
 {
     var measurement = Font.MeasureString (Text);
     if (CenterText) {
         cachedFontPosition = new Vector2 (
             x: (float) X + ((WidthF / 2f) - ((float) measurement.X / 2f)),
             y: (float) Y + ((HeightF / 2f) - ((float) measurement.Y / 2f))
         );
     } else {
         cachedFontPosition = Position;
     }
     base.Update (time);
 }
Пример #26
0
 public void Draw(GameTime time, SpriteBatch batch)
 {
     batch.Draw (MascotTexture, Position, Color4.White, 1, rotation: MathHelper.DegreesToRadians (90));
 }
Пример #27
0
 protected override void Update(GameTime time)
 {
     iodine.Call ("update", time);
     base.Update (time);
 }
Пример #28
0
 /// <summary>
 /// Draw.
 /// </summary>
 /// <param name="time">Time.</param>
 /// <param name="batch">Batch.</param>
 public void Draw(GameTime time, SpriteBatch batch)
 {
     // Draw the tile
     batch.Draw (
         texture: Sheet.Texture,
         sourceRect: Sheet [StartTile + Index],
         position: Position,
         origin: new Vector2 (Sheet [StartTile + Index].Width / 2f, Sheet [StartTile + Index].Height / 2f),
         color: Tint,
         scale: Scale,
         rotation: RotationX
     );
 }
Пример #29
0
 public override void Draw(GameTime time, SpriteBatch batch)
 {
     Font.DrawString (batch, Text, cachedFontPosition, ColorWithTransparency);
     base.Draw (time, batch);
 }
Пример #30
0
 /// <summary>
 /// Initializes the <see cref="nginz.GameTime"/> class.
 /// </summary>
 static GameTime()
 {
     var zero = TimeSpan.Zero;
     ZeroTime = new GameTime (zero, zero);
 }