public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch _spritebatch)
 {
     _spritebatch.Begin();
     this.m_lp_extractor.Draw(_spritebatch);
     base.Draw(_spritebatch);
     _spritebatch.End();
 }
Exemple #2
0
        public override bool PreDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Color lightColor)
        {
            Rectangle frame = BaseMod.BaseDrawing.GetFrame(projectile.frame, Main.projectileTexture[projectile.type].Width, Main.projectileTexture[projectile.type].Height / 5, 0, 2);

            BaseMod.BaseDrawing.DrawTexture(spriteBatch, Main.projectileTexture[projectile.type], 0, projectile.position, projectile.width, projectile.height, projectile.scale, projectile.rotation, 0, 5, frame, Color.White, true);
            return(false);
        }
Exemple #3
0
 public override bool PreDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Color drawColor)
 {
     base.PreDraw(spriteBatch, drawColor);
     FlipVertically = AiStage < 2;
     if (AiStage == 0)
     {
         Vector2 TextPosition = npc.Bottom;
         TextPosition.Y += 8f;
         float Scale = 1f;
         if (TextPosition.Y < Main.screenPosition.Y + 56)
         {
             Scale          = 1f - (Main.screenPosition.Y + 56 - TextPosition.Y) / 1000f;
             TextPosition.Y = Main.screenPosition.Y + 56;
         }
         if (Scale < 0.1f)
         {
             Scale = 0.1f;
         }
         if (TextPosition.X - 48f < Main.screenPosition.X)
         {
             TextPosition.X = Main.screenPosition.X + 48;
         }
         if (TextPosition.X + 48f > Main.screenPosition.X + Main.screenWidth)
         {
             TextPosition.X = Main.screenPosition.X + Main.screenWidth - 48;
         }
         if (Scale > 1f)
         {
             Scale = 1f;
         }
         Utils.DrawBorderString(spriteBatch, "*AAAAAAHHHH!!!*", TextPosition - Main.screenPosition, Color.White, Scale, 0.5f, 0.5f);
     }
     return(false);
 }
        public virtual void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            if (!gameStarted || Screen.Selected != GameMain.GameScreen || GUI.DisableHUD)
            {
                return;
            }

            GameMain.GameSession.CrewManager.Draw(spriteBatch);

            inGameHUD.Draw(spriteBatch);

            if (respawnManager != null)
            {
                string respawnInfo = "";

                if (respawnManager.CurrentState == RespawnManager.State.Waiting &&
                    respawnManager.CountdownStarted)
                {
                    respawnInfo = respawnManager.UsingShuttle ? "Respawn Shuttle dispatching in " : "Respawning players in ";
                    respawnInfo = respawnManager.RespawnTimer <= 0.0f ? "" : respawnInfo + ToolBox.SecondsToReadableTime(respawnManager.RespawnTimer);
                }
                else if (respawnManager.CurrentState == RespawnManager.State.Transporting)
                {
                    respawnInfo = respawnManager.TransportTimer <= 0.0f ? "" : "Shuttle leaving in " + ToolBox.SecondsToReadableTime(respawnManager.TransportTimer);
                }

                if (!string.IsNullOrEmpty(respawnInfo))
                {
                    GUI.DrawString(spriteBatch,
                                   new Vector2(120.0f, 10),
                                   respawnInfo, Color.White, null, 0, GUI.SmallFont);
                }
            }
        }
Exemple #5
0
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            NinePatch patch = Selected ? SelectedNinepatch : UnselectedNinepatch;

            patch.Draw(spriteBatch, AbsolutePosition, Width, Height, 0f, EffectiveOpacity);
            base.Draw(spriteBatch);
        }
        protected override void DoDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, float zindex)
        {
            _outline.Visible    = ShowOutlined;
            _hitlighted.Visible = ShowHitlighted;

            base.DoDraw(spriteBatch, zindex);
        }
Exemple #7
0
 public void Render(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, SystemManagers managers)
 {
     if (Visible)
     {
         mLinePrimitive.Render(spriteBatch, managers);
     }
 }
 public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch batch)
 {
     foreach (TPString s in strings)
     {
         s.Draw(batch);
     }
 }
Exemple #9
0
 internal void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
 {
     buttonController.Draw(spriteBatch);
     Height.Draw(spriteBatch);
     Width.Draw(spriteBatch);
     Mines.Draw(spriteBatch);
 }
Exemple #10
0
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch sB, GraphicsDeviceManager gM, bool drawHUD)
        {
            sB.Begin();
            //background.Draw(sB, Vector2.Zero, managers);
            backgrounds.DrawBackgrounds(sB, Vector2.Zero);
            backgrounds.Drawforegrounds(sB, Vector2.Zero);

            textures.DrawString(sB, red, redPos, Color.Red, TextureManager.FontSizes.small, true);
            mustachio.Draw(sB, new Vector2(0, 0), managers);
            textures.DrawString(sB, blue, bluePos, Color.Blue, TextureManager.FontSizes.small, true);
            aqueos.Draw(sB, new Vector2(0, 0), managers);
            textures.DrawString(sB, green, greenPos, Color.Green, TextureManager.FontSizes.small, true);
            terron.Draw(sB, new Vector2(0, 0), managers);
            textures.DrawString(sB, yellow, yellowPos, Color.Yellow, TextureManager.FontSizes.small, true);
            dian.Draw(sB, new Vector2(0, 0), managers);

            textures.DrawString(sB, nextGame.GetName(), new Vector2(DEFAUT_SCREEN_SIZE.X / 2, DEFAUT_SCREEN_SIZE.Y / 8), Color.White, TextureManager.FontSizes.small, true);
            textures.DrawString(sB, on, new Vector2(DEFAUT_SCREEN_SIZE.X / 2, DEFAUT_SCREEN_SIZE.Y / 8 + 32), Color.White, TextureManager.FontSizes.small, true);
            textures.DrawString(sB, mapName, new Vector2(DEFAUT_SCREEN_SIZE.X / 2, DEFAUT_SCREEN_SIZE.Y / 8 + 64), Color.White, TextureManager.FontSizes.small, true);

            textures.DrawString(sB, nextGame.GetSummary(), new Vector2(DEFAUT_SCREEN_SIZE.X / 2, DEFAUT_SCREEN_SIZE.Y / 8 + 192), Color.White, TextureManager.FontSizes.small, true);

            textures.DrawString(sB, ((timer <= beginTime) ? "" : (int)Math.Ceiling(timer) + ""), new Vector2(DEFAUT_SCREEN_SIZE.X / 2, DEFAUT_SCREEN_SIZE.Y / 8 + 320), Color.White, TextureManager.FontSizes.big, true);

            textures.DrawString(sB, tipText, new Vector2(DEFAUT_SCREEN_SIZE.X / 2, DEFAUT_SCREEN_SIZE.Y / 2 + 230), Color.White, TextureManager.FontSizes.small, true);
            sB.End();
        }
Exemple #11
0
 public void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, bool editing = false)
 {
     if (light.LightSprite != null && (item.body == null || item.body.Enabled))
     {
         light.LightSprite.Draw(spriteBatch, new Vector2(item.DrawPosition.X, -item.DrawPosition.Y), lightColor * lightBrightness, 0.0f, 1.0f, Microsoft.Xna.Framework.Graphics.SpriteEffects.None, item.Sprite.Depth - 0.0001f);
     }
 }
Exemple #12
0
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            base.Draw(spriteBatch);

            for (int y = 0; y < cells.Length; y++)
            {
                float   margin      = 25f;
                Vector2 destination = new Vector2(Position.Real.X, Position.Real.Y + y * 25);;
                for (int x = 0; x < cells[y].Length; x++)
                {
                    KeyboardButton button = cells[y][x];
                    destination.X = Position.Real.X + x * margin;
                    if (button.HasFocus)
                    {
                        Vector2 size = Font.MeasureString(button.Button);
                        spriteBatch.Draw(Khv.Engine.KhvGame.Temp,
                                         new Rectangle((int)destination.X - (int)((margin - size.X) / 2), (int)destination.Y,
                                                       (int)margin,
                                                       (int)size.Y),
                                         Color.Green);
                    }
                    spriteBatch.DrawString(Font, button.Button, destination, Color.Azure);
                }
            }
        }
Exemple #13
0
        protected override void DrawSelf(Microsoft.Xna.Framework.Graphics.SpriteBatch sb)
        {
            var ci  = GetInstance <Config>();
            var lp  = Main.LocalPlayer;
            var txt = 0 < (int)(lp.HeldItem.mana * lp.manaCost) ? "" + lp.statMana / (int)(lp.HeldItem.mana * lp.manaCost) : "∞";

            if (ci.madb)
            {
                sb.Draw(GetTexture("Widgets/sprites/wp"), new Rectangle((ci.madi ? 20 : 4) + (int)tp.X, (int)tp.Y + 4, 50, 10), Color.Black);
                sb.Draw(GetTexture("Widgets/sprites/wp"), new Rectangle((ci.madi ? 20 : 4) + (int)tp.X, (int)tp.Y + 4, 50 * lp.statMana / lp.statManaMax2, 10), Gradient(ci.madrg, ci.madsc, ci.madec, (float)lp.statMana / lp.statManaMax2));
                sb.Draw(GetTexture("Widgets/sprites/bfg"), new Vector2((ci.madi ? 16 : 0) + tp.X, tp.Y), Color.White);
                if (ci.madi)
                {
                    sb.Draw(GetTexture("Widgets/sprites/madi2"), new Vector2(10 + tp.X, tp.Y), Color.White);
                }
            }
            else
            {
                Utils.DrawBorderString(sb, txt, new Vector2(23 + tp.X, tp.Y), Color.White);
            }
            Height.Set(18, 0);
            if (!ci.madb || ci.madi)
            {
                sb.Draw(GetTexture("Widgets/sprites/madi"), new Vector2(tp.X, tp.Y), Color.White);
            }
            base.DrawSelf(sb);
            Width.Set(ci.madb ? ci.madi ? 74 : 58 : 23 + Main.fontMouseText.MeasureString(txt).X, 0);
        }
Exemple #14
0
 public void Render(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
 {
     foreach (var _element in Elements)
     {
         _element.Render(spriteBatch);
     }
 }
Exemple #15
0
 public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
 {
     tex = Actor.GetActiveAnimation().GetCurrentFrame().Image;
     base.Draw(spriteBatch);
     hpBar.Value = Actor.HealthRatio;
     hpBar.Draw(spriteBatch);
 }
Exemple #16
0
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            base.Draw(spriteBatch);
            string text = textProcessor.Text;

            if (textProcessor.IsTextSelectionEnabled)
            {
                string selectedText = textProcessor.SelectedText;

                // on valittua tekstiä
                if (!selectedText.Equals(""))
                {
                    int startIndex = textProcessor.SelectionStartIndex;
                    int endIndex   = textProcessor.SelectionEndIndex;

                    Vector2 size   = Font.MeasureString(selectedText);
                    Vector2 offset = Vector2.Zero;
                    if (startIndex != 0)
                    {
                        offset = Font.MeasureString(text.Substring(0, startIndex));
                    }

                    Rectangle selectionPosition = new Rectangle((int)Position.Real.X + (int)offset.X, (int)Position.Real.Y, (int)size.X, (int)size.Y);
                    spriteBatch.Draw(Khv.Engine.KhvGame.Temp, selectionPosition, Color.Green);
                }
            }
            Vector2 position = new Vector2(Position.Real.X, Position.Real.Y);

            spriteBatch.DrawString(Font, text, position, Colors.Foreground, 0.0f, Vector2.Zero, 1f, Microsoft.Xna.Framework.Graphics.SpriteEffects.None, 0f);
            spriteBatch.DrawString(Font, caret, caretPositionInPixels, caretColor);
        }
 public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
 {
     foreach (Accessory a in accessories)
     {
         a.Draw(spriteBatch, entity.Get <TransformPart>().GetPosition);
     }
 }
Exemple #18
0
 ///
 /// Draws all the blocks to the sprite batch.
 ///
 /// <param name="sb"></param>
 public void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch sb)
 {
     foreach (Block b in blocks)
     {
         b.Draw(sb);
     }
 }
Exemple #19
0
 public void draw(Microsoft.Xna.Framework.Graphics.SpriteBatch b, Microsoft.Xna.Framework.Graphics.SpriteFont font, Microsoft.Xna.Framework.Vector2 position, Microsoft.Xna.Framework.Color color)
 {
     if (this.drawThis)
     {
         b.DrawString(font, this.displayText, position, color);
     }
 }
Exemple #20
0
 protected override void DrawSelf(Microsoft.Xna.Framework.Graphics.SpriteBatch sb)
 {
     Height.Set(Math.Max(20, 209 * 5 / TUIL.cl.Count), 0);
     if (md)
     {
         TUIL.dps = (y - mouseY) / ((209 - (int)Height.Pixels) / (TUIL.cl.Count - 5)) * 40 + dps;
     }
     if ((5 - TUIL.cl.Count) * 40 > dps)
     {
         dps = (5 - TUIL.cl.Count) * 40;
     }
     if ((5 - TUIL.cl.Count) * 40 > TUIL.dps)
     {
         TUIL.dps = (5 - TUIL.cl.Count) * 40;
     }
     if (0 < dps)
     {
         dps = 0;
     }
     if (0 < TUIL.dps)
     {
         TUIL.dps = 0;
     }
     if (ContainsPoint(MouseScreen))
     {
         LocalPlayer.mouseInterface = true;
     }
     Left.Set(Math.Max(113, 40 + TUIL.il.Max()), 0);
     Top.Set((209 - Height.Pixels) / (TUIL.cl.Count - 5) * -TUIL.dps / 40 + 7, 0);
     UI.Panel(ContainsPoint(MouseScreen) || md ? new Color(231, 177, 48) : new Color(194, 120, 4), Color.Black, new Rectangle((int)GetDimensions().X, (int)GetDimensions().Y - 2, 16, (int)Height.Pixels + 4), sb);
     Width.Set(16, 0);
 }
Exemple #21
0
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            if (!Visible)
            {
                return;
            }

            Color currColor = color;

            if (state == ComponentState.Selected)
            {
                currColor = selectedColor;
            }
            if (state == ComponentState.Hover)
            {
                currColor = hoverColor;
            }

            if (sprites == null || !sprites.Any())
            {
                GUI.DrawRectangle(spriteBatch, rect, currColor * (currColor.A / 255.0f), true);
            }
            base.Draw(spriteBatch);

            if (OutlineColor != Color.Transparent)
            {
                GUI.DrawRectangle(spriteBatch, rect, OutlineColor * (OutlineColor.A / 255.0f), false);
            }


            DrawChildren(spriteBatch);
        }
Exemple #22
0
 public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch sb)
 {
     if (activeRocket != null && activeRocket.Alive)
     {
         activeRocket.Draw();
     }
 }
Exemple #23
0
 public void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
 {
     foreach (Component c in components)
     {
         c.Draw(spriteBatch);
     }
 }
 public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
 {
     if (TheGame.Instance.isDebug)
     {
         base.Draw(spriteBatch);
     }
 }
        public override void DebugDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            if (selectedAiTarget != null)
            {
                GUI.DrawLine(spriteBatch,
                             new Vector2(Character.DrawPosition.X, -Character.DrawPosition.Y),
                             new Vector2(selectedAiTarget.WorldPosition.X, -selectedAiTarget.WorldPosition.Y), Color.Red);
            }

            IndoorsSteeringManager pathSteering = steeringManager as IndoorsSteeringManager;

            if (pathSteering == null || pathSteering.CurrentPath == null || pathSteering.CurrentPath.CurrentNode == null)
            {
                return;
            }

            GUI.DrawLine(spriteBatch,
                         new Vector2(Character.DrawPosition.X, -Character.DrawPosition.Y),
                         new Vector2(pathSteering.CurrentPath.CurrentNode.DrawPosition.X, -pathSteering.CurrentPath.CurrentNode.DrawPosition.Y),
                         Color.LightGreen);


            for (int i = 1; i < pathSteering.CurrentPath.Nodes.Count; i++)
            {
                GUI.DrawLine(spriteBatch,
                             new Vector2(pathSteering.CurrentPath.Nodes[i].DrawPosition.X, -pathSteering.CurrentPath.Nodes[i].DrawPosition.Y),
                             new Vector2(pathSteering.CurrentPath.Nodes[i - 1].DrawPosition.X, -pathSteering.CurrentPath.Nodes[i - 1].DrawPosition.Y),
                             Color.LightGreen);

                GUI.SmallFont.DrawString(spriteBatch,
                                         pathSteering.CurrentPath.Nodes[i].ID.ToString(),
                                         new Vector2(pathSteering.CurrentPath.Nodes[i].DrawPosition.X, -pathSteering.CurrentPath.Nodes[i].DrawPosition.Y - 10),
                                         Color.LightGreen);
            }
        }
Exemple #26
0
 public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
 {
     if (IsUsed)
     {
         base.Draw(spriteBatch);
     }
 }
Exemple #27
0
        public override void draw(Microsoft.Xna.Framework.Graphics.SpriteBatch b)
        {
            if (this.visible)
            {
                if (!this.canvasTextureUpdated)
                {
                    this.convertPickerToTexture2D(b.GraphicsDevice);
                }

                Game1.drawDialogueBox(
                    this.xPositionOnScreen - 128,
                    this.yPositionOnScreen - 96,
                    64 + 64,
                    92 + 128,
                    false, true, null, false, true, 60, 50, 40);

                this.dummyChest.draw(b,
                                     this.xPositionOnScreen - 128 - 6 + IClickableMenu.borderWidth,
                                     this.yPositionOnScreen - 4 + IClickableMenu.borderWidth,
                                     1f, true);

                Game1.drawDialogueBox(
                    this.xPositionOnScreen - 32,
                    this.yPositionOnScreen - 96,
                    this.width + 64,
                    this.height + 128,
                    false, true, null, false, true, 60, 50, 40);

                b.Draw(this.canvasTexture, new Microsoft.Xna.Framework.Vector2(this.xPositionOnScreen, this.yPositionOnScreen), Microsoft.Xna.Framework.Color.White);
            }
        }
 public override void draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
 {
     if (image != null && image.texture != null)
     {
         image.draw(spriteBatch);
     }
 }
Exemple #29
0
 static public void DrawEquipment(ClickableComponent icon, Microsoft.Xna.Framework.Graphics.SpriteBatch b)
 {
     if (icon.item != null)
     {
         b.Draw(Game1.menuTexture, icon.bounds, Game1.getSourceRectForStandardTileSheet(Game1.menuTexture, 10, -1, -1), Color.White);
         icon.item.drawInMenu(b, new Vector2(icon.bounds.X, icon.bounds.Y), icon.scale, 1f, 0.866f, StackDrawType.Hide);
     }
     else
     {
         int tile = 41;
         if (icon.name == "Hat")
         {
             tile = 42;
         }
         if (icon.name == "Shirt")
         {
             tile = 69;
         }
         if (icon.name == "Pants")
         {
             tile = 68;
         }
         if (icon.name == "Boots")
         {
             tile = 40;
         }
         b.Draw(Game1.menuTexture, icon.bounds, Game1.getSourceRectForStandardTileSheet(Game1.menuTexture, tile, -1, -1), Color.White);
     }
 }
Exemple #30
0
 public virtual void Draw(
     Microsoft.Xna.Framework.GameTime gameTime,
     Microsoft.Xna.Framework.Graphics.SpriteBatch batch,
     float alpha,
     Microsoft.Xna.Framework.Matrix transform)
 {
 }
Exemple #31
0
 public Screen()
 {
     this.g = G.g;
     this.spriteBatch = g.spriteBatch;
     this.e = g.e;
     this.GraphicsDevice = g.GraphicsDevice;
     this.font = g.font;
 }
Exemple #32
0
        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------
        protected override void Initialize()
        {
            content		= new ContentManager(Services, "Content");
            spriteBatch	= new Microsoft.Xna.Framework.Graphics.SpriteBatch(GraphicsDevice);

            editorControl.Initialize(content, GraphicsDevice);

            // Wire the events.
            MouseMove += OnMouseMove;
            MouseDown += OnMouseDown;
            MouseLeave += OnMouseLeave;
            MouseEnter += OnMouseEnter;

            // Start the timer to refresh the panel.
            Application.Idle += delegate { Invalidate(); };
            this.ResizeRedraw = true;

            UpdateTileset();
        }
        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------
        protected override void Initialize()
        {
            content		= new ContentManager(Services, "Content");
            spriteBatch	= new Microsoft.Xna.Framework.Graphics.SpriteBatch(GraphicsDevice);

            selectedRoom = null;
            selectedTiles = new HashSet<BaseTileDataInstance>();
            selectionGrid = null;

            editorControl.Initialize(content, GraphicsDevice);

            //this.ContextMenuStrip = editorControl.EditorForm.ContextMenuStripTileInLevel;

            /*levelRenderTarget = new Microsoft.Xna.Framework.Graphics.RenderTarget2D(
                GraphicsDevice, 2048, 2048, false,
                Microsoft.Xna.Framework.Graphics.SurfaceFormat.Color,
                Microsoft.Xna.Framework.Graphics.DepthFormat.None, 0,
                Microsoft.Xna.Framework.Graphics.RenderTargetUsage.PreserveContents);*/

            // Wire the events.
            MouseMove			+= OnMouseMove;
            MouseDown			+= OnMouseDown;
            MouseUp				+= OnMouseUp;
            MouseLeave			+= OnMouseLeave;
            MouseDoubleClick	+= OnMouseDoubleClick;

            this.ResizeRedraw = true;

            // Start the timer to refresh the panel.
            Application.Idle += delegate { Invalidate(); };

            // TEMP: Open this world file upon starting the editor.
            if (File.Exists("./temp_world.zwd"))
                editorControl.OpenFile("temp_world.zwd");
            else if (File.Exists("../../../../WorldFiles/temp_world.zwd"))
                editorControl.OpenFile("../../../../WorldFiles/temp_world.zwd");
            //editorControl.OpenFile("temp_world.zwd");

            UpdateLevel();

            this.highlightedRoom = -Point2I.One;
            this.highlightedTile = -Point2I.One;
        }
Exemple #34
0
        /// <summary>
        /// Setup the game properties
        /// </summary>
        /// <param name="contentManager">the XNA content manager to be used</param>
        /// <param name="graphicDeviceManager">the XNA graphic manager to be used</param>
        public GameProperties(Microsoft.Xna.Framework.Content.ContentManager contentManager, Microsoft.Xna.Framework.GraphicsDeviceManager graphicDeviceManager, Microsoft.Xna.Framework.GameWindow window)
        {
            // load game properties
            System.Xml.XmlDocument config = new System.Xml.XmlDocument();
            config.Load(@"Content/config.xml");

            // try resolution
            try
            {
                graphicDeviceManager.PreferredBackBufferWidth = Convert.ToInt32(config.GetElementsByTagName("resolutionX")[0].InnerText);
                graphicDeviceManager.PreferredBackBufferHeight = Convert.ToInt32(config.GetElementsByTagName("resolutionY")[0].InnerText);
                Screen screen = Screen.PrimaryScreen;
                window.Position = new Microsoft.Xna.Framework.Point(screen.Bounds.Width / 2 - graphicDeviceManager.PreferredBackBufferWidth / 2, screen.Bounds.Height / 2 - graphicDeviceManager.PreferredBackBufferHeight / 2);
            }
            catch (Exception)
            {
                graphicDeviceManager.PreferredBackBufferWidth = 1280;
                graphicDeviceManager.PreferredBackBufferHeight = 720;
            }

            // try fullscreen
            try
            {
                int fullscreen = Convert.ToInt32(config.GetElementsByTagName("fullscreen")[0].InnerText);
                if (fullscreen == 1)
                {
                    Screen screen = Screen.PrimaryScreen;
                    window.IsBorderless = true;
                    window.Position = new Microsoft.Xna.Framework.Point(screen.Bounds.X, screen.Bounds.Y);
                    graphicDeviceManager.PreferredBackBufferWidth = screen.Bounds.Width;
                    graphicDeviceManager.PreferredBackBufferHeight = screen.Bounds.Height;
                    this.isFullscreen = true;
                }
                else
                {
                    this.isFullscreen = false;
                }
            }
            catch (Exception) { }

            graphicDeviceManager.ApplyChanges();

            // try language settings
            try
            {
                this.SelectedLanguage = config.GetElementsByTagName("language")[0].InnerText;
            }
            catch(Exception){ }

            this.currentGameState = GameState.LoadMenu;
            this.input = new InputHandler();

            this.contentManager = new Helper.ContentManager(contentManager);
            this.spriteBatch = new Microsoft.Xna.Framework.Graphics.SpriteBatch(graphicDeviceManager.GraphicsDevice);
            this.graphicDeviceManager = graphicDeviceManager;
            this.gameWindow = window;

            System.IO.BinaryReader Reader = new System.IO.BinaryReader(System.IO.File.Open(@"Content\Shader\main_shader.mgfxo", System.IO.FileMode.Open));
            this.baseShader = new Microsoft.Xna.Framework.Graphics.Effect(this.graphicDeviceManager.GraphicsDevice, Reader.ReadBytes((int)Reader.BaseStream.Length));
        }
Exemple #35
0
        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------
        protected override void Initialize()
        {
            content		= new ContentManager(Services, "Content");
            spriteBatch	= new Microsoft.Xna.Framework.Graphics.SpriteBatch(GraphicsDevice);

            editorControl.Initialize(content, GraphicsDevice);

            // Wire the events.
            MouseMove	+= OnMouseMove;
            MouseDown	+= OnMouseDown;
            MouseUp		+= OnMouseUp;
            MouseLeave	+= OnMouseLeave;

            this.ResizeRedraw = true;

            // Start the timer to refresh the panel.
            Application.Idle += delegate { Invalidate(); };

            // TEMP: Open this world file upon starting the editor.
            editorControl.OpenFile("../../../../WorldFiles/temp_world.zwd");

            UpdateLevel();

            this.highlightedRoom = -Point2I.One;
            this.highlightedTile = -Point2I.One;
        }