Exemplo n.º 1
0
 public void Draw(SpriteBatch sb, Camera camera)
 {
     sb.Draw(Editor.ObjectTextures[this.Texture],
             camera.GlobalToCameraPos((int)Position.X, (int)Position.Y),
             null,
             Color.White,
             ParameterNames.Contains("Rotation") ? float.Parse(ValueFromName("Rotation")) : 0f,
             new Vector2(Editor.ObjectTextures[this.Texture].Width / 2, Editor.ObjectTextures[this.Texture].Height / 2),
             camera.TotalScale * ((ParameterNames.Contains("Width") ? int.Parse(ValueFromName("Width")) / Editor.ObjectTextures[this.Texture].Width : 1f) * Vector2.UnitX +
                                  (ParameterNames.Contains("Height") ? int.Parse(ValueFromName("Height")) / Editor.ObjectTextures[this.Texture].Height : 1f) * Vector2.UnitY),
             SpriteEffects.None,
             0.5555556f);
 }
Exemplo n.º 2
0
 public void Draw(SpriteBatch sb, Camera camera)
 {
     if (points.Count > 1)
     {
         for (int i = 0; i < points.Count - 1; i++)
         {
             Editor.DrawRectangleOutline(sb, new Rectangle((int)camera.GlobalToCameraPos(points[i]).X - 2, (int)camera.GlobalToCameraPos(points[i]).Y - 2, 4, 4), Color.Red);
             Editor.DrawLine(sb, camera.GlobalToCameraPos(points[i]), camera.GlobalToCameraPos(points[i + 1]), Color.Red);
         }
         Editor.DrawRectangleOutline(sb, new Rectangle((int)camera.GlobalToCameraPos(points[points.Count - 1]).X - 2, (int)camera.GlobalToCameraPos(points[points.Count - 1]).Y - 2, 4, 4), Color.Red);
         Editor.DrawLine(sb, camera.GlobalToCameraPos(points[points.Count - 1]), camera.GlobalToCameraPos(points[0]), Color.Red);
     }
 }
Exemplo n.º 3
0
        public GameWorld(Vector2 playerPos, Game game, string name)
        {
            world = new World(9.8f * Vector2.UnitY);

            globalLighting = new KryptonEngine(game, "KryptonEffect");
            globalLighting.Initialize();

            tiles = new List<Tile>();
            collisionMap = new List<StaticBody>();
            objects = new List<GameObject>();
            triggers = new List<Trigger>();

            toAdd = new List<GameObject>();

            Load(game, name);

            player = new PlayerGuy(world, playerPos.X, playerPos.Y, MainGame.texPlayer);
            objects.Add(player); // Player will have an index of -1
            camera = new Camera(player.Position, size, 15f, this.player);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Editor constructor
        /// </summary>
        public Editor()
        {
            Graphics = new GraphicsDeviceManager(this);
            Graphics.PreferredBackBufferWidth = 1280;
            Graphics.PreferredBackBufferHeight = 720;

            levelSize = new Rectangle(0, 0, 1920, 1080);
            camera = new Camera();

            selTexRotation = 0.0f;
            selTexScale = Vector2.One;
            selTexEffect = SpriteEffects.None;
            layer = 0.55555555555555556f;

            IsMouseVisible = true;
            prevMX = 0;
            prevMY = 0;
            prevScrollTotal = 0;

            xPressed = false;
            mleftPressed = false;
            rotOnceLeft = false;
            rotOnceRight = false;
            unfocused = false;
            windowOpen = false;
            step = 1;

            currentBox = new Vector2[2];
            tileInfo = new List<TileInformation>();
            sbInfo = new List<StaticBodyInformation>();
            objInfo = new List<ObjectInformation>();
            camInfo = new List<CameraBoxInformation>();
            triggerInfo = new List<TriggerInformation>();

            indices = new List<int>();
            index = 0;

            objMenuChoices = new List<RightClickMenu.MenuItem>();
            objMenuChoices.Add(new RightClickMenu.MenuItem("Obj ID: ", ""));
            objMenuChoices.Add(new RightClickMenu.MenuItem("Edit fields", "edit"));
            objMenuChoices.Add(new RightClickMenu.MenuItem("Delete", "delete"));
            objMenuChoices.Add(new RightClickMenu.MenuItem("Move", "move"));
            objMenuChoices.Add(new RightClickMenu.MenuItem("Manage Scripts", "scripts"));

            Content.RootDirectory = "Content";
        }