예제 #1
0
 public void Draw(FPCanvas canvas)
 {
     playerTexture.Draw(new PointF(X, Y), Rotation);
 }
        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);
            }
        }
 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);
 }
 public void Draw(FPCanvas canvas)
 {
     speedPowerUpTexture.Draw(new PointF(X, Y));
 }
 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);
 }
 public void Draw(FPCanvas canvas)
 {
     FPTexture texture = trampolineTextures[textureIndex];
     texture.Draw(new PointF(X, Y), WidthSegments, 1);
 }
 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);
 }
 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);
 }
 public void Draw(FPCanvas canvas)
 {
     movableTexture.Draw(new PointF(X, Y), WidthSegments, HeightSegments);
 }
 public static void InitTextures(FPCanvas canvas)
 {
     speedPowerUpTexture = canvas.CreateTexture(Resources.speed_symbol);
 }
 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());
        }
        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));
        }