public override void LoadContent()
        {
            // Init our Sprite Batch
            if (SpriteBatch == null)
            {
                SpriteBatch = new SpriteBatch(Globals.Game.GraphicsDevice);
            }

            // Set the data on our textures

            if (RedLine == null)
            {
                RedLine = Utilitys.GenerateTexture(Globals.Game.GraphicsDevice, Color.Red, 1, 1);
            }

            if (GrayLine == null)
            {
                GrayLine = Utilitys.GenerateTexture(Globals.Game.GraphicsDevice, Color.Gray, 1, 1);
            }

            if (BlueLine == null)
            {
                BlueLine = Utilitys.GenerateTexture(Globals.Game.GraphicsDevice, Color.LightBlue, 1, 1);
            }

            base.LoadContent();
        }
Пример #2
0
        public override void LoadContent()
        {
            if (Picker == null)
            {
                Picker = new BoundingBoxRenderer(Game);
                Picker.Initialize();
            }

            if (SelectedNode == null)
            {
                SelectedNode = Utilitys.GenerateTexture(Game.GraphicsDevice, Color.MediumSlateBlue, 10, 10);
            }

            if (UnSelectedNode == null)
            {
                UnSelectedNode = Utilitys.GenerateTexture(Game.GraphicsDevice, Color.Orange, 10, 10);
            }

            if (SpriteBatch == null)
            {
                SpriteBatch = Globals.RenderWindow.RenderWindow.SpriteBatch;
            }

            base.LoadContent();
        }
Пример #3
0
        public override void LoadContent()
        {
            base.LoadContent();

            if (Texture == null)
            {
                Texture = Utilitys.GenerateTexture(GraphicsDevice, Color, Width, Height);
            }
        }
Пример #4
0
        public override void Initialize()
        {
            base.Initialize();

            Picker = new BoundingBoxRenderer(Game);
            Picker.Initialize();

            SelectedNode   = Utilitys.GenerateTexture(GraphicsDevice, Color.White, 10, 10);
            UnSelectedNode = Utilitys.GenerateTexture(GraphicsDevice, Color.Orange, 10, 10);

            // Init our sprite batch
            SpriteBatch = new SpriteBatch(GraphicsDevice);
        }
        protected override void LoadContent()
        {
            base.LoadContent();

            // Load our Custom Shader
            Effect = Content.Load <Effect>("EditorLandscapeShader");

            // Load our Actual Textures
            Layer1 = Content.Load <Texture2D>("desert1");
            Layer2 = Content.Load <Texture2D>("dirt1");
            Layer3 = Content.Load <Texture2D>("grass1");
            Layer4 = Content.Load <Texture2D>("snow1");

            // Setup our Texture Masks
            PaintMask1 = Utilitys.GenerateTexture(GraphicsDevice, new Color(255, 0, 0, 0), Width, Height);
        }
Пример #6
0
        public override void Initialize()
        {
            base.Initialize();

            // Hook our input handler
            InputHandler = (InputHandler)Game.Services.GetService(typeof(InputHandler));

            // Setup the border
            BorderTexture         = new Sprite(Game);
            BorderTexture.Texture = Utilitys.GenerateTexture(Game.GraphicsDevice, BorderColor, Width + BorderSize, Height + BorderSize);
            BorderTexture.Initialize();

            // Setup the Interior of the text box
            InsideTexture         = new Sprite(Game);
            InsideTexture.Texture = Utilitys.GenerateTexture(Game.GraphicsDevice, BorderColor, Width, Height);
            InsideTexture.Initialize();

            // Inside label text
            label           = new Label(Game, fontName);
            label.FontColor = FontColor;
            label.Initialize();
        }
Пример #7
0
        public override void LoadContent()
        {
            base.LoadContent();

            // Create a black texture for doing menu transitions
            if (black == null || black.IsDisposed)
            {
                black = Utilitys.GenerateTexture(Game.GraphicsDevice, Color.Black, Game.GraphicsDevice.Viewport.Width,
                                                 Game.GraphicsDevice.Viewport.Height);
            }

            foreach (var v in VisualObjects)
            {
                if (v != null && !v.IsLoaded)
                {
                    v.SpriteBatch = SceneManager.SpriteBatch;
                    v.GameScreen  = this;

                    // Load its content
                    v.LoadContent();
                }
            }
        }
Пример #8
0
        public override void LoadContent()
        {
            base.LoadContent();

            InputHandler = (InputHandler)Game.Services.GetService(typeof(InputHandler));

            // Load these gestures to the game screen that this control requires
            GameScreen.EnabledGestures = GameScreen.EnabledGestures | GestureType.FreeDrag | GestureType.DragComplete;

            // Setup our slider texture
            SliderTexture            = new Sprite(Game, false);
            SliderTexture.Position   = Position;
            SliderTexture.GameScreen = GameScreen;

            if (!string.IsNullOrEmpty(sliderTextureName))
            {
                GameScreen.Content.Load <Texture2D>(AssetFolder + "/" + Path.GetFileNameWithoutExtension(AssetName));
            }
            else
            {
                if (SliderType == SliderType.Horizontal)
                {
                    SliderTexture.Texture = Utilitys.GenerateTexture(Game.GraphicsDevice, Color.White, Width, Height);
                }
                else
                {
                    SliderTexture.Texture = Utilitys.GenerateTexture(Game.GraphicsDevice, Color.White, Height, Width);
                }
            }

            SliderTexture.Initialize();

            // Button Texture
            Button            = new Sprite(Game, false);
            Button.Color      = ButtonColor;
            Button.GameScreen = GameScreen;

            if (!string.IsNullOrEmpty(AssetName))
            {
                Button.Texture = GameScreen.Content.Load <Texture2D>(Path.GetFileNameWithoutExtension(AssetName));
            }
            else
            {
                Button.Texture = Utilitys.GenerateTexture(GraphicsDevice, Color.White, 15, 15);
            }

            switch (SliderType)
            {
            case SliderType.Horizontal:
            {
                // Width of slider bar in pixels
                float sliderWidth = (SliderTexture.Texture.Width * SliderTexture.Scale.X);

                // Percentage of slider position
                float percent = (CurrentSliderPosition / sliderWidth) * 100;

                // Position of current button on slider factoring in slider percentage
                float x = (Position.X - ((Button.Texture.Width * Button.Scale.X) / 2)) + percent;

                Button.Position = new Vector2(x, Position.Y - ((Button.Texture.Height * Button.Scale.Y) / 2));
            }
            break;

            case SliderType.Vertical:
            {
                float y = Position.Y - ((Button.Texture.Height * Button.Scale.Y) / 2);

                Button.Position = new Vector2(Position.X - ((Button.Texture.Width * Button.Scale.X) / 2), y);
            }
            break;
            }



            Button.Initialize();
        }
        public override void LoadContent()
        {
            InputHandler = (InputHandler)Game.Services.GetService(typeof(InputHandler));
            InputHandler.Commands.Add(new InputAction("LeftAlt", Buttons.X, Keys.LeftAlt));

            CustomEffect = Host.Game.Content.Load <Effect>("LandscapeShader");

            // Setup our Texture Masks
            if (string.IsNullOrEmpty(PaintMaskAssetName))
            {
                PaintMaskAssetName = "pMask1.png";
                PaintMask1         = Utilitys.GenerateTexture(GraphicsDevice, new Color(255, 0, 0, 0), Width, Height);

                SavePaintMask();
            }
            else
            {
                if (File.Exists(Host.ProjectPath + @"\Content\" + PaintMaskAssetName))
                {
                    using (Stream stream = File.Open(Host.ProjectPath + @"\Content\" + PaintMaskAssetName, FileMode.Open))
                    {
                        PaintMask1 = Texture2D.FromStream(Host.Game.GraphicsDevice, stream);
                    }
                }
            }

            if (!string.IsNullOrEmpty(Layer1Path))
            {
                if (File.Exists(Host.ProjectPath + @"\Content\" + Layer1Path))
                {
                    using (Stream stream = File.Open(Host.ProjectPath + @"\Content\" + Layer1Path, FileMode.Open))
                    {
                        Layer1 = Texture2D.FromStream(Host.Game.GraphicsDevice, stream);
                    }
                }
            }

            if (!string.IsNullOrEmpty(Layer2Path))
            {
                if (File.Exists(Host.ProjectPath + @"\Content\" + Layer2Path))
                {
                    using (Stream stream = File.Open(Host.ProjectPath + @"\Content\" + Layer2Path, FileMode.Open))
                    {
                        Layer2 = Texture2D.FromStream(Host.Game.GraphicsDevice, stream);
                    }
                }
            }

            if (!string.IsNullOrEmpty(Layer3Path))
            {
                if (File.Exists(Host.ProjectPath + @"\Content\" + Layer3Path))
                {
                    using (Stream stream = File.Open(Host.ProjectPath + @"\Content\" + Layer3Path, FileMode.Open))
                    {
                        Layer2 = Texture2D.FromStream(Host.Game.GraphicsDevice, stream);
                    }
                }
            }

            if (!string.IsNullOrEmpty(Layer4Path))
            {
                if (File.Exists(Host.ProjectPath + @"\Content\" + Layer4Path))
                {
                    using (Stream stream = File.Open(Host.ProjectPath + @"\Content\" + Layer4Path, FileMode.Open))
                    {
                        Layer2 = Texture2D.FromStream(Host.Game.GraphicsDevice, stream);
                    }
                }
            }

            base.LoadContent();
        }
Пример #10
0
        public override void LoadContent()
        {
            base.LoadContent();

            Texture = Utilitys.GenerateTexture(GraphicsDevice, Color.ForestGreen, 800, 100);
        }