コード例 #1
0
 public void Draw(FPCanvas canvas)
 {
     playerTexture.Draw(new PointF(X, Y), Rotation);
 }
コード例 #2
0
        private void DrawHandlesOnGameObject(FPCanvas canvas, FPGameObject gameObject)
        {
            RectangleF rect = gameObject.Rect;

            canvas.DisableTexturing();
            canvas.SetCurrentColor(Color.FromArgb(204, Color.White));
            canvas.DrawRectangle(rect);

            canvas.SetPointSize(6.0f);

            var draggedObject = DraggedObject;

            bool widthHandles = false;
            bool heightHandles = false;

            if (draggedObject != null)
            {
                widthHandles = draggedObject.WidthSegments > 0;
                heightHandles = draggedObject.HeightSegments > 0;
            }

            for (FPDragHandle handle = FPDragHandle.TopLeft; handle < FPDragHandle.Center; handle++)
            {
                if (!widthHandles && IsWidthHandle(handle))
                    continue;

                if (!heightHandles && IsHeightHandle(handle))
                    continue;

                if (handle == currentHandle)
                    canvas.SetCurrentColor(Color.FromArgb(204, Color.Red));
                else
                    canvas.SetCurrentColor(Color.FromArgb(204, Color.Yellow));

                PointF handlePoint = PointFromHandleAroundRect(handle, rect);
                canvas.DrawPoint(handlePoint);
            }
        }
コード例 #3
0
 public static void InitTextures(FPCanvas canvas)
 {
     playerTexture = canvas.CreateTexture(Resources.ball);
     jumpTexture = canvas.CreateTexture(Resources.speed);
 }
コード例 #4
0
        public void Draw(FPCanvas canvas)
        {
            canvas.SetCurrentColor(Color.White);
            canvas.DisableBlend();

            PointF offset = new PointF(FPMath.fmodf(backgroundOffset.X, 32.0f) - 32.0f,
                                       FPMath.fmodf(backgroundOffset.Y, 32.0f) - 32.0f);

            backgroundTexture.Draw(offset, (int)(Width / backgroundTexture.Width) + 3, (int)(Height / backgroundTexture.Height) + 2);

            foreach (var gameObject in gameObjects)
            {
                if (!gameObject.IsVisible)
                    continue;

                if (!gameObject.IsTransparent)
                    gameObject.Draw(canvas);
            }

            canvas.EnableBlend();
            foreach (var gameObject in gameObjects)
            {
                if (!gameObject.IsVisible)
                    continue;

                if (gameObject.IsTransparent)
                    gameObject.Draw(canvas);
            }
            player.Draw(canvas);
            player.DrawSpeedUp(canvas);

            canvas.SetCurrentColor(Color.FromArgb(204, Color.White));

            fontTexture.DrawText(string.Format("Diamonds: {0}/{1}", diamondsPicked, diamondsCount), new PointF(3.0f, 0.0f), 16, 16, 32, 13);

            string speedUpText = null;
            if (player.SpeedUpCounter > 0)
                speedUpText = string.Format(CultureInfo.InvariantCulture, "{0:f1}", (FPPlayer.maxSpeedUpCount - player.SpeedUpCounter) / 60.0f);

            if (!string.IsNullOrEmpty(speedUpText))
            {
                canvas.SetCurrentColor(Color.FromArgb(204, 127, 255, 255));
                fontTexture.DrawText(speedUpText, new PointF(430.0f, 285.0f), 16, 16, 32, 13);
            }
        }
コード例 #5
0
 public void Draw(FPCanvas canvas)
 {
     elevatorTextures[textureIndex].Draw(new PointF(X, Y), WidthSegments, 1);
 }
コード例 #6
0
 public void Draw(FPCanvas canvas)
 {
     magnetTexture.Draw(new PointF(X, Y), WidthSegments, 1);
 }
コード例 #7
0
 public void Draw(FPCanvas canvas)
 {
     speedPowerUpTexture.Draw(new PointF(X, Y));
 }
コード例 #8
0
 public void AddTexture(FPCanvas canvas, Bitmap bitmap)
 {
     textures.Add(canvas.CreateTexture(bitmap));
 }
コード例 #9
0
 public static void InitTextures(FPCanvas canvas)
 {
     diamondTexture = canvas.CreateTexture(Resources.diamond);
 }
コード例 #10
0
 public void Draw(FPCanvas canvas)
 {
     FPTexture texture = trampolineTextures[textureIndex];
     texture.Draw(new PointF(X, Y), WidthSegments, 1);
 }
コード例 #11
0
 public static void InitTextures(FPCanvas canvas)
 {
     trampolineTextures = new FPTextureArray();
     trampolineTextures.AddTexture(canvas, Resources.trampoline01);
     trampolineTextures.AddTexture(canvas, Resources.trampoline02);
     trampolineTextures.AddTexture(canvas, Resources.trampoline03);
 }
コード例 #12
0
 public void Draw(FPCanvas canvas)
 {
     platformTexture.Draw(new PointF(X, Y), WidthSegments, HeightSegments);
 }
コード例 #13
0
 public static void InitTextures(FPCanvas canvas)
 {
     platformTexture = canvas.CreateTexture(Resources.plos_marble);
 }
コード例 #14
0
 private void InitAllTextures(FPCanvas canvas)
 {
     FPGame.InitTexture(canvas);
     FPPlayer.InitTextures(canvas);
     FPPlatform.InitTextures(canvas);
     FPDiamond.InitTextures(canvas);
     FPElevator.InitTextures(canvas);
     FPMovablePlatform.InitTextures(canvas);
     FPMagnet.InitTextures(canvas);
     FPSpeedPowerUp.InitTextures(canvas);
     FPTrampoline.InitTextures(canvas);
     FPExit.InitTextures(canvas);
 }
コード例 #15
0
        public void DrawSpeedUp(FPCanvas canvas)
        {
            if (SpeedUpCounter <= 0)
                return;

            float value = Math.Abs(FPMath.sinf(Alpha)) * 0.5f + 0.5f;
            canvas.SetCurrentColor(Color.FromArgb((int)(255 * value), Color.White));

            PointF position = new PointF(X - 16.0f, Y - 16.0f);
            jumpTexture.Draw(position);
        }
コード例 #16
0
 public void Draw(FPCanvas canvas)
 {
     diamondTexture.Draw(new PointF(X, Y));
 }
コード例 #17
0
 public static void InitTextures(FPCanvas canvas)
 {
     magnetTexture = canvas.CreateTexture(Resources.magnet);
 }
コード例 #18
0
 public void Draw(FPCanvas canvas)
 {
     movableTexture.Draw(new PointF(X, Y), WidthSegments, HeightSegments);
 }
コード例 #19
0
 public static void InitTextures(FPCanvas canvas)
 {
     speedPowerUpTexture = canvas.CreateTexture(Resources.speed_symbol);
 }
コード例 #20
0
 public static void InitTextures(FPCanvas canvas)
 {
     movableTexture = canvas.CreateTexture(Resources.movable);
 }
コード例 #21
0
 public static void InitTexture(FPCanvas canvas)
 {
     backgroundTexture = canvas.CreateTexture(Resources.marbleblue);
     fontTexture = canvas.CreateTexture(Resources.AndaleMono, true);
 }
コード例 #22
0
 public static void InitTextures(FPCanvas canvas)
 {
     exitTexture = canvas.CreateTexture(Resources.exit);
 }
コード例 #23
0
 public static void InitTextures(FPCanvas canvas)
 {
     elevatorTextures = new FPTextureArray();
     elevatorTextures.AddTexture(canvas, Resources.vytah01);
     elevatorTextures.AddTexture(canvas, Resources.vytah02);
     elevatorTextures.AddTexture(canvas, Resources.vytah03);
 }
コード例 #24
0
 public void Draw(FPCanvas canvas)
 {
     exitTexture.Draw(new PointF(X, Y));
 }
コード例 #25
0
        public void Draw(FPCanvas canvas)
        {
            canvas.SetCurrentColor(Color.FromArgb(100, Color.White));

            FPElevator.ElevatorTexture.Draw(new PointF(X, Y), WidthSegments, 1);
            canvas.DisableTexturing();

            RectangleF start = elevatorStart.Rect;
            RectangleF end = this.Rect;

            canvas.SetCurrentColor(Color.FromArgb(255, 0, 255, 0));
            canvas.DrawLine(start.MiddlePoint(), end.MiddlePoint());
        }
コード例 #26
0
        void DrawGrid(FPCanvas canvas)
        {
            Rectangle rect = levelView.ClientRectangle;

            rect.Offset(-(int)levelView.ViewOffset.X, -(int)levelView.ViewOffset.Y);

            rect.X /= 32;
            rect.Y /= 32;

            rect.X *= 32;
            rect.Y *= 32;

            canvas.SetCurrentColor(Color.FromArgb((int)(0.2 * 255), Color.White));

            for (int y = rect.Top; y < rect.Bottom + 32; y += 32)
                canvas.DrawLine(new Point(rect.Left, y), new Point(rect.Right + 32, y));

            for (int x = rect.Left; x < rect.Right + 32; x += 32)
                canvas.DrawLine(new Point(x, rect.Top), new Point(x, rect.Bottom + 32));
        }