コード例 #1
0
ファイル: Minigame3.cs プロジェクト: nolanmanning703/GGJ2014
 public Minigame3(ZoomLevels zoom)
     : base(zoom)
 {
     TimeInHill = 0.0f;
     HarmonyInsideHill = false;
     HillShape = null;
 }
コード例 #2
0
        public static Utilities.Math.Shape.Circle GetMouth(ZoomLevels zoom)
        {
            //KarmaWorld.World.CurrentZoom;
            float scale = WorldData.ZoomScaleAmount[zoom];

            return new Utilities.Math.Shape.Circle(scale * Mouth.Center, scale * Mouth.Radius);
        }
コード例 #3
0
ファイル: KarmaWorld.cs プロジェクト: heyx3/GGJ2014
        public KarmaWorld(GraphicsDevice device, ContentManager content)
        {
            KarmaWorld.World = this;

            GraphicsDevice = device;
            ContentManager = content;
            RenderedWorld = new RenderTarget2D(device, device.PresentationParameters.BackBufferWidth, device.PresentationParameters.BackBufferHeight,
                                               true, device.DisplayMode.Format, DepthFormat.Depth24);

            Timers = new Utilities.TimerManager();
            Input = new ButtonInputManager();

            Input.AddInput("Zoom In", new ComboButton(new KeyboardButton(Keys.LeftControl, false), new KeyboardButton(Keys.PageUp, true)));
            Input.AddInput("Zoom Out", new ComboButton(new KeyboardButton(Keys.LeftControl, false), new KeyboardButton(Keys.PageDown, true)));

            CurrentTime = new GameTime(TimeSpan.Zero, TimeSpan.Zero);

            currentZoom = ZoomLevels.Three;

            Camera = new KarmaCamera(device);
            Camera.Zoom = GetCameraZoom(currentZoom);

            CurrentZoom = currentZoom;
            ZoomingIn = false;
            ZoomingOut = false;
            foreach (ZoomLevels zooms in WorldData.AscendingZooms)
                if (WorldData.Minigames[zooms] != null)
                    WorldData.Minigames[zooms].ResetGame();

            JoustingInput.InitializeInput();

            Camera.Update(new GameTime(TimeSpan.FromSeconds(0.016667), TimeSpan.FromSeconds(0.016667)));
            Camera.Zoom = GetCameraZoom(currentZoom);
        }
コード例 #4
0
ファイル: Minigame.cs プロジェクト: heyx3/GGJ2014
        public Minigame(ZoomLevels currentZoom)
        {
            CurrentZoom = currentZoom;
            MoveUp = false;
            MoveDown = false;

            TimeSinceMinigameStart = 0.0f;
        }
コード例 #5
0
ファイル: SoundAssets.cs プロジェクト: heyx3/GGJ2014
 public static void SwitchZoomMusic(ZoomLevels newZoom)
 {
     foreach (ZoomLevels zoom in WorldData.AscendingZooms) if (LevelMusic[zoom] != null)
     {
         if (zoom == newZoom) LevelMusic[zoom].Volume = LevelMusicVolume;
         else LevelMusic[zoom].Volume = 0.0f;
     }
 }
コード例 #6
0
ファイル: Jouster.cs プロジェクト: nolanmanning703/GGJ2014
 public Jouster(Jousters thisJouster, V2 pos, ZoomLevels zoom)
     : base(ArtAssets.GetJousterShape(KarmaWorld.World.CurrentZoom, WorldData.ZoomScaleAmount[zoom]),
            (zoom == ZoomLevels.Five ? Single.PositiveInfinity : PhysData.Acceleration), PhysData.MaxSpeed)
 {
     Pos = pos;
     ThisJouster = thisJouster;
     Mass = PhysicsData.JousterStartingMass[zoom];
 }
コード例 #7
0
        public JousterPhysicsData(ZoomLevels zoom, float maxSpeed, float turnSpd, float accel, float friction, float bounceEnergyScale)
        {
            ZoomLevel = zoom;

            this.maxSpeed = maxSpeed;
            acceleration = accel;
            this.friction = friction;
            turnSpeed = turnSpd;
            this.bounceEnergyScale = bounceEnergyScale;
        }
コード例 #8
0
        public Fullscreen()
        {
            InitializeComponent();
            DataContext = this;

            ZoomLevels.Add("25%");
            ZoomLevels.Add("30%");
            ZoomLevels.Add("40%");
            ZoomLevels.Add("50%");
            ZoomLevels.Add("75%");
            ZoomLevels.Add("100%");
            ZoomLevels.Add("125%");
            ZoomLevels.Add("150%");
            ZoomLevels.Add("200%");
            ZoomLevels.Add("250%");
            ZoomLevels.Add("300%");

            fPreviousExecutionState = NativeMethods.SetThreadExecutionState(NativeMethods.ES_CONTINUOUS | NativeMethods.ES_SYSTEM_REQUIRED);
        }
コード例 #9
0
ファイル: CharacterView.cs プロジェクト: Anders-H/UEd
 public void EnsurePositionIsVisible(int x, int y)
 {
     while (x < OffsetX)
     {
         OffsetX--;
     }
     while (x > OffsetX + ZoomLevels.GetCurrentZoom().Columns - 1)
     {
         OffsetX++;
     }
     while (y < OffsetY)
     {
         OffsetY--;
     }
     while (y > OffsetY + ZoomLevels.GetCurrentZoom().Rows - 1)
     {
         OffsetY++;
     }
 }
コード例 #10
0
        /// <summary>Handles the Click event of the ItemZoomToWindow control.</summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The [EventArgs] instance containing the event data.</param>
        private void ItemZoom_Click(object sender, EventArgs e)
        {
            var item = (ToolStripMenuItem)sender;

            if ((item.Tag == null) || (!Enum.TryParse(item.Tag.ToString(), out ZoomLevels zoom)))
            {
                item.Checked = false;
                return;
            }

            // Do not let us uncheck.
            if (_zoomLevel == zoom)
            {
                item.Checked = true;
                return;
            }

            _zoomLevel = zoom;
            UpdateZoomMenu();
        }
コード例 #11
0
        /// <summary>
        /// Function to convert a <see cref="ZoomLevels"/> to its associated scaling factor.
        /// </summary>
        /// <param name="zoomLevel">The zoom level to retrieve the scaling factor from.</param>
        /// <returns>The scaling factor.</returns>
        /// <remarks>
        /// <para>
        /// When the zoom level is set to <see cref="ZoomLevels.ToWindow"/>, then this method will return -1.
        /// </para>
        /// </remarks>
        public static float GetScale(this ZoomLevels zoomLevel)
        {
            switch (zoomLevel)
            {
            case ZoomLevels.Percent12:
                return(0.12f);

            case ZoomLevels.Percent25:
                return(0.25f);

            case ZoomLevels.Percent50:
                return(0.5f);

            case ZoomLevels.Percent100:
                return(1);

            case ZoomLevels.Percent200:
                return(2);

            case ZoomLevels.Percent400:
                return(4);

            case ZoomLevels.Percent800:
                return(8);

            case ZoomLevels.Percent1600:
                return(16);

            case ZoomLevels.Percent3200:
                return(32);

            case ZoomLevels.Percent6400:
                return(64);

            case ZoomLevels.Custom:
            case ZoomLevels.ToWindow:
                return(-1);
            }

            return(1);
        }
コード例 #12
0
 public BingMapsTileSchema()
     : base(TileFormat.Jpeg)
 {
     ZoomLevels.RemoveAt(0);     // Bing Maps does't have the signle tile showing the whole world.
 }
コード例 #13
0
ファイル: KarmaWorld.cs プロジェクト: heyx3/GGJ2014
 public float GetCameraZoom(ZoomLevels zoom)
 {
     return 1.0f / WorldData.ZoomScaleAmount[zoom];
 }
コード例 #14
0
ファイル: ArtAssets.cs プロジェクト: heyx3/GGJ2014
 public static Vector2 GetBackgroundOrigin(ZoomLevels zoom)
 {
     return 0.5f * new Vector2(WorldBackgrounds[zoom].Width, WorldBackgrounds[zoom].Height);
 }
コード例 #15
0
ファイル: Minigame4.cs プロジェクト: heyx3/GGJ2014
 public Minigame4(ZoomLevels zoom)
     : base(zoom)
 {
 }
コード例 #16
0
 /// <summary>
 /// Gets actual minimum hit speed for the given zoom level, accounting for level zoom scale.
 /// </summary>
 public static float GetMinHitSpeed(ZoomLevels zoom)
 {
     return WorldData.ZoomScaleAmount[zoom] *
            MinHitSpeeds[zoom];
 }
コード例 #17
0
ファイル: ArtAssets.cs プロジェクト: heyx3/GGJ2014
        public static Shape GetJousterShape(ZoomLevels zoom, float scale)
        {
            switch (zoom)
            {
                case ZoomLevels.One:
                    return new Polygon(CullMode.CullClockwiseFace, new List<Vector2>()
                                       {
                                           new Vector2(61.0f, 28.0f),
                                           new Vector2(41.0f, 47.0f),
                                           new Vector2(14.0f, 42.0f),
                                           new Vector2(3.0f, 31.0f),
                                           new Vector2(21.0f, 15.0f),
                                           new Vector2(48.0f, 19.0f),
                                       }.Select(v => v * scale * 2.0f).ToArray());
                case ZoomLevels.Two:
                    return new Circle(Vector2.Zero, 100.0f * scale);
                case ZoomLevels.Three:
                    return new Polygon(CullMode.CullClockwiseFace, new List<Vector2>()
                                       {
                                           new Vector2(125, 61),
                                           new Vector2(114, 68),
                                           new Vector2(89, 73),
                                           new Vector2(34, 73),
                                           new Vector2(27, 64),
                                           new Vector2(34, 54),
                                           new Vector2(89, 51),
                                           new Vector2(114, 55),
                                       }.Select(v => v * scale).ToArray());
                case ZoomLevels.Four:
                    return new Circle(Vector2.Zero, 100.0f * scale);
                case ZoomLevels.Five:
                    return new Circle(Vector2.Zero, 60.0f * scale);

                default: throw new NotImplementedException();
            }
        }
コード例 #18
0
 /// <summary>Initializes a new instance of the <see cref="ZoomEventArgs"/> class.</summary>
 /// <param name="currentZoomLevel">The current zoom level.</param>
 public ZoomEventArgs(ZoomLevels currentZoomLevel) => ZoomLevel = currentZoomLevel;
コード例 #19
0
ファイル: WorldData.cs プロジェクト: heyx3/GGJ2014
 public static int ZoomToInt(ZoomLevels zoom)
 {
     return (int)zoom;
 }
コード例 #20
0
 public TestMinigame(ZoomLevels currentZoom)
     : base(currentZoom)
 {
 }
コード例 #21
0
ファイル: WorldData.cs プロジェクト: heyx3/GGJ2014
 public static Vector2 GetStartingPos(ZoomLevels zoom, Jousters jouster)
 {
     return ZoomScaleAmount[zoom] * StartingPoses[zoom][jouster];
 }
コード例 #22
0
ファイル: WorldData.cs プロジェクト: heyx3/GGJ2014
        public static ZoomLevels ZoomOut(ZoomLevels current)
        {
            switch (current)
            {
                case ZoomLevels.One: return ZoomLevels.Three;
                case ZoomLevels.Two: return ZoomLevels.Three;
                case ZoomLevels.Three: return ZoomLevels.Five;
                case ZoomLevels.Four: return ZoomLevels.Five;
                case ZoomLevels.Five: return ZoomLevels.Five;
                default: throw new NotImplementedException();
            }

            switch (current)
            {
                case ZoomLevels.One: return ZoomLevels.Two;
                case ZoomLevels.Two: return ZoomLevels.Three;
                case ZoomLevels.Three: return ZoomLevels.Four;
                case ZoomLevels.Four: return ZoomLevels.Five;
                case ZoomLevels.Five: return ZoomLevels.Five;
                default: throw new NotImplementedException();
            }
        }
コード例 #23
0
ファイル: WorldData.cs プロジェクト: heyx3/GGJ2014
 public static float CameraZoomSpeed(ZoomLevels zoom)
 {
     return ZoomScaleAmount[zoom] * 10.0f;
 }
コード例 #24
0
ファイル: CharacterView.cs プロジェクト: Anders-H/UEd
        public void Draw(CharacterArea area, Graphics g, Font secondaryFont, int viewportX, int viewportY, int viewportWidth, int viewportHeight)
        {
            var xpos           = (double)viewportX;
            var ypos           = (double)viewportY;
            var charWidth      = viewportWidth / (double)ZoomLevels.GetCurrentZoom().Columns;
            var charHeight     = viewportHeight / (double)ZoomLevels.GetCurrentZoom().Rows;
            var physicalWidth  = (float)charWidth;
            var physicalHeight = (float)charHeight;

            using (var background = new SolidBrush(_options.BackgroundColor))
            {
                using (var foreground = new SolidBrush(_options.CursorColor))
                {
                    using (var selection = new SolidBrush(_options.SelectionColor))
                    {
                        g.Clear(Color.Black);
                        var z           = g.MeasureString("l", Font);
                        var charOffsetX = (float)(charWidth / 2 - z.Width / 2);
                        var charOffsetY = (float)(charHeight / 2 - z.Height / 2);
                        for (var y = 0; y < ZoomLevels.GetCurrentZoom().Rows; y++)
                        {
                            var rowSelection = area.GetRowSelection(y + OffsetY);
                            var physicalY    = (float)ypos;
                            for (var x = 0; x < ZoomLevels.GetCurrentZoom().Columns; x++)
                            {
                                var physicalX = (float)xpos;
                                var s         = area.GetCharacterAt(x + OffsetX, y + OffsetY);
                                if (rowSelection.CharacterIsSelected(x + OffsetX))
                                {
                                    g.FillRectangle(selection, physicalX, physicalY, physicalWidth, physicalHeight);
                                }
                                var charX = physicalX + charOffsetX;
                                var charY = physicalY + charOffsetY;
                                if (x + OffsetX == area.CursorX && y + OffsetY == area.CursorY)
                                {
                                    g.FillRectangle(foreground, physicalX, physicalY, physicalWidth, physicalHeight);
                                    if (!string.IsNullOrWhiteSpace(s))
                                    {
                                        g.DrawString(s, Font, background, charX, charY);
                                    }
                                }
                                else
                                {
                                    g.DrawString(s, Font, foreground, charX, charY);
                                }
#if DEBUG
                                var whitespace = area.GetCharacterOrWhitespaceAt(x + OffsetX, y + OffsetY);
                                if (whitespace != null)
                                {
                                    if (whitespace == " ")
                                    {
                                        g.FillRectangle(Brushes.Yellow, (physicalX + (int)(charWidth / 2)) - 1,
                                                        (physicalY + (int)(charHeight / 2)) - 1, 2, 2);
                                    }
                                    else if (whitespace[0] == 9)
                                    {
                                        g.FillRectangle(Brushes.Pink, (physicalX + (int)(charWidth / 2)) - 1,
                                                        (physicalY + (int)(charHeight / 2)) - 1, 2, 2);
                                    }
                                }
#endif
                                xpos += charWidth;
                            }

                            xpos  = viewportX;
                            ypos += charHeight;
                        }
                    }
                }
            }
            if (!_options.ShowCurrentLineNumber && !_options.ShowTotalLines && !_options.ShowColumnNumber)
            {
                return;
            }
            string row;
            if (_options.ShowColumnNumber && (_options.ShowCurrentLineNumber || _options.ShowTotalLines))
            {
                row = $"{area.CursorX + 1}, ";
            }
            else if (_options.ShowColumnNumber)
            {
                row = $"{area.CursorX + 1}";
            }
            else
            {
                row = "";
            }
            row += _options.ShowCurrentLineNumber && _options.ShowTotalLines ? $"{area.CursorY + 1}/{area.RowCount}"
                : _options.ShowCurrentLineNumber
                ? $"{area.CursorY + 1}" : $"{area.RowCount}";
            var       m      = g.MeasureString(row, secondaryFont);
            const int margin = 3;
            using (var b = new SolidBrush(Color.FromArgb(50, 255, 255, 255)))
                g.DrawString(row, secondaryFont, b, viewportX + viewportWidth - m.Width - margin, viewportY + margin);
        }
コード例 #25
0
 /// <summary>
 /// Function to convert a <see cref="ZoomLevels"/> to its associated friendly name.
 /// </summary>
 /// <param name="zoomLevel">The zoom level to retrieve the name for.</param>
 /// <returns>The friendly name of the zoom level.</returns>
 public static string GetName(this ZoomLevels zoomLevel) => !_names.TryGetValue(zoomLevel, out string name) ? string.Empty : name;
コード例 #26
0
ファイル: CharacterView.cs プロジェクト: Anders-H/UEd
 public bool IsInView(int x, int y) =>
 x >= OffsetX &&
 x < OffsetX + ZoomLevels.GetCurrentZoom().Columns &&
 y >= OffsetY &&
 y < OffsetY + ZoomLevels.GetCurrentZoom().Rows;
コード例 #27
0
 /// <summary>
 /// Function to reset the zoom back to the default.
 /// </summary>
 public void ResetZoom()
 {
     _zoomLevel = ZoomLevels.ToWindow;
     UpdateZoomMenu();
 }