Example #1
0
        public override void Update(double totalMS, double frameMS)
        {
            if (_gumpTexture == null || _gumpTexture.IsDisposed || _forceUpdate)
            {
                _gumpTexture = FileManager.Gumps.GetTexture(_useLargeMap ? (ushort)5011 : (ushort)5010);
                Width        = _gumpTexture.Width;
                Height       = _gumpTexture.Height;
                CreateMiniMapTexture();

                if (_forceUpdate)
                {
                    _forceUpdate = false;
                }
            }

            if (_gumpTexture != null)
            {
                _gumpTexture.Ticks = (long)totalMS;
            }

            if (_mapTexture != null)
            {
                _mapTexture.Ticks = (long)totalMS;
            }

            if (_timeMS < totalMS)
            {
                _draw   = !_draw;
                _timeMS = (long)totalMS + 500;
            }
        }
Example #2
0
        public static SpriteTexture GetLandTexture(ushort g)
        {
            if (!_landDictionary.TryGetValue(g, out SpriteTexture texture) || texture.IsDisposed)
            {
                const int SIZE   = 44;
                ushort[]  pixels = ReadLandArt(g);
                texture = new SpriteTexture(SIZE, SIZE, false);
                texture.SetData(pixels);
                _usedIndexLand.Add(g);
                _picker.Set(g, SIZE, SIZE, pixels);

                _landDictionary.Add(g, texture);
            }

            //ref SpriteTexture texture = ref _landCache[g];

            //if (texture == null || texture.IsDisposed)
            //{
            //    const int SIZE = 44;
            //    ushort[] pixels = ReadLandArt(g);
            //    texture = new SpriteTexture(SIZE, SIZE, false);
            //    texture.SetData(pixels);
            //    _usedIndexLand.Add(g);
            //    _picker.Set(g, SIZE, SIZE, pixels);
            //}

            return(texture);
        }
        /// <inheritdoc/>
        protected internal override InspectableState Refresh()
        {
            SpriteTexture spriteTexture = InspectedObject as SpriteTexture;

            if (spriteTexture == null)
            {
                return(InspectableState.NotModified);
            }

            InspectableState state = genericDrawer.Refresh();

            if (state != InspectableState.NotModified)
            {
                // The inspector will by default just assign a resource reference without loading it, make sure we load it
                // so it can be previewed
                if (spriteTexture.Texture != null && !spriteTexture.Texture.IsLoaded)
                {
                    Resources.Load <Texture>(spriteTexture.Texture.UUID);
                }

                // Make sure GUI redraws as the sprite texture properties were updated
                previewTexture.SetTexture(spriteTexture);
            }

            return(state);
        }
Example #4
0
        public Checkbox(ushort inactive, ushort active, string text = "", byte font = 0, ushort color = 0, bool isunicode = true, int maxWidth = 0)
        {
            _textures[INACTIVE] = FileManager.Gumps.GetTexture(inactive);
            _textures[ACTIVE]   = FileManager.Gumps.GetTexture(active);

            if (_textures[0] == null || _textures[1] == null)
            {
                Dispose();

                return;
            }

            SpriteTexture t = _textures[INACTIVE];

            Width = t.Width;

            _text = new RenderedText
            {
                Font = font, Hue = color, IsUnicode = isunicode, MaxWidth = maxWidth, Text = text
            };
            Width += _text.Width;

            Height           = Math.Max(t.Width, _text.Height);
            CanMove          = false;
            AcceptMouseInput = true;
        }
Example #5
0
        public ResizePic(Graphic graphic)
        {
            CanMove = true;
            CanCloseWithRightClick = true;

            for (int i = 0; i < _gumpTexture.Length; i++)
            {
                SpriteTexture t = FileManager.Gumps.GetTexture((Graphic)(graphic + i));

                if (t == null)
                {
                    Dispose();

                    return;
                }

                if (i == 4)
                {
                    _gumpTexture[8] = t;
                }
                else if (i > 4)
                {
                    _gumpTexture[i - 1] = t;
                }
                else
                {
                    _gumpTexture[i] = t;
                }
            }
        }
        /// <inheritdoc/>
        protected internal override void Initialize()
        {
            LoadResource();

            SpriteTexture spriteTexture = InspectedObject as SpriteTexture;

            if (spriteTexture == null)
            {
                return;
            }

            genericDrawer = new GenericInspectorDrawer(spriteTexture, this, Layout);

            GUILayout previewLayout = PreviewGUI.AddLayoutY();

            previewTitleLayout = GUILayoutWithBackground.Create <GUILayoutX>(previewLayout, Builtin.WhiteTexture,
                                                                             new Color(0.129f, 0.129f, 0.129f), new RectOffset(11, 0, 2, 0));

            GUILabel title = new GUILabel(new LocEdString("Preview"));

            previewTitleLayout.Layout.AddElement(title);
            previewTitleLayout.Layout.AddFlexibleSpace();

            previewContentLayout = GUILayoutWithBackground.Create <GUILayoutX>(previewLayout, Builtin.WhiteTexture,
                                                                               new Color(0.09f, 0.09f, 0.09f), new RectOffset(5, 5, 5, 5));

            previewContentLayout.MainPanel.SetHeight(250);

            previewTexture = new GUITexture(spriteTexture, GUITextureScaleMode.ScaleToFit,
                                            GUIOption.FlexibleWidth(), GUIOption.FlexibleHeight());
            previewContentLayout.Layout.AddElement(previewTexture);
        }
Example #7
0
        public override void Update(double totalMS, double frameMS)
        {
            _frameMS = frameMS;

            if (_gumpTexture == null || _gumpTexture.IsDisposed || _useLargeMap != _miniMap_LargeFormat || _forceUpdate)
            {
                _useLargeMap = _miniMap_LargeFormat;

                if (_gumpTexture != null)
                {
                    _gumpTexture.Dispose();
                }
                _gumpTexture = IO.Resources.Gumps.GetGumpTexture(_useLargeMap ? (ushort)5011 : (ushort)5010);
                Width        = _gumpTexture.Width;
                Height       = _gumpTexture.Height;
                CreateMiniMapTexture();

                if (_forceUpdate)
                {
                    _forceUpdate = false;
                }
            }

            if (_gumpTexture != null)
            {
                _gumpTexture.Ticks = (long)totalMS;
            }

            if (_mapTexture != null)
            {
                _mapTexture.Ticks = (long)totalMS;
            }
        }
        /// <summary>
        /// Registers a new row in the layout. The row cannot be selected as the output field, but rather can be expanded
        /// so it displays child elements.
        /// </summary>
        /// <param name="layout">Layout to append the row GUI elements to.</param>
        /// <param name="icon">Optional icon to display next to the name. Can be null.</param>
        /// <param name="name">Name of the field.</param>
        /// <param name="so">Parent scene object of the field.</param>
        /// <param name="component">Parent component of the field. Can be null if field belongs to <see cref="SceneObject"/>.
        ///                         </param>
        /// <param name="path">Slash separated path to the field from its parent object.</param>
        /// <param name="toggleCallback">Callback to trigger when the user expands or collapses the foldout.</param>
        /// <returns>Element object storing all information about the added field.</returns>
        private Element AddFoldoutRow(GUILayout layout, SpriteTexture icon, string name, SceneObject so, Component component,
                                      string path, Action <Element, bool> toggleCallback)
        {
            Element element = new Element(so, component, path);

            GUILayoutY elementLayout = layout.AddLayoutY();
            GUILayoutX foldoutLayout = elementLayout.AddLayoutX();

            element.toggle            = new GUIToggle("", EditorStyles.Expand);
            element.toggle.OnToggled += x => toggleCallback(element, x);

            foldoutLayout.AddSpace(PADDING);
            foldoutLayout.AddElement(element.toggle);

            if (icon != null)
            {
                GUITexture guiIcon = new GUITexture(icon, GUIOption.FixedWidth(16), GUIOption.FixedWidth(16));
                foldoutLayout.AddElement(guiIcon);
            }

            GUILabel label = new GUILabel(new LocEdString(name));

            foldoutLayout.AddElement(label);
            foldoutLayout.AddFlexibleSpace();

            element.indentLayout = elementLayout.AddLayoutX();
            element.indentLayout.AddSpace(INDENT_AMOUNT);
            element.childLayout = element.indentLayout.AddLayoutY();

            element.indentLayout.Active = false;

            return(element);
        }
Example #9
0
        public static void DrawRectangle(Camera2D camera, Rectangle srcRect, Color?color = null, int borderWidth = 4)
        {
            if (debugSpriteTex.Texture == null)
            {
                debugSpriteTex = AssetManager.Get <SpriteTexture>(assetConsumerContext, "floor");
            }

            Color       c           = color ?? Color.Purple;
            SpriteBatch spriteBatch = Core.Rendering.SpriteBatch;
            Texture2D   texture     = debugSpriteTex.Texture;
            Rectangle   r           = srcRect;
            Vector2     viewPos     = camera.Position;
            int         bw          = borderWidth;

            spriteBatch.Draw(texture, new Rectangle(r.Left - (int)viewPos.X, r.Top - (int)viewPos.Y, bw, r.Height),
                             debugSpriteTex.SourceRectangle, c, 0.0f, Vector2.Zero, SpriteEffects.None, 0f); // Left

            spriteBatch.Draw(texture, new Rectangle(r.Right - (int)viewPos.X, r.Top - (int)viewPos.Y, bw, r.Height),
                             debugSpriteTex.SourceRectangle, c, 0.0f, Vector2.Zero, SpriteEffects.None, 0f); // Right

            spriteBatch.Draw(texture, new Rectangle(r.Left - (int)viewPos.X, r.Top - (int)viewPos.Y, r.Width, bw),
                             debugSpriteTex.SourceRectangle, c, 0.0f, Vector2.Zero, SpriteEffects.None, 0f); // Top

            spriteBatch.Draw(texture, new Rectangle(r.Left - (int)viewPos.X, r.Bottom - (int)viewPos.Y, r.Width, bw),
                             debugSpriteTex.SourceRectangle, c, 0.0f, Vector2.Zero, SpriteEffects.None, 0f); // Bottom
        }
Example #10
0
        public void Lookup(IItem item, out SpriteTexture texture, out int textureArrayIndex)
        {
            texture           = null;
            textureArrayIndex = 0;

            if (item is CubeResource)
            {
                texture = _iconTextureArray;
                var  cubeId = ((CubeResource)item).CubeId;
                byte arrayIndex;
                if (_cubeIconIndexes.TryGetValue(cubeId, out arrayIndex))
                {
                    textureArrayIndex = arrayIndex;
                }
                return;
            }
            if (item is Item)
            {
                var voxelItem = item as Item;

                var id = voxelItem.ModelName;

                if (id == null)
                {
                    return;
                }

                if (!string.IsNullOrEmpty(voxelItem.ModelState))
                {
                    id += ":" + voxelItem.ModelState;
                }

                _voxelIcons.TryGetValue(id, out texture);
            }
        }
Example #11
0
        public static void ClearUnusedTextures()
        {
            int count = 0;

            for (int i = 0; i < _usedIndex.Count; i++)
            {
                int           g       = _usedIndex[i];
                SpriteTexture texture = _gumpDictionary[g];
                //ref SpriteTexture texture = ref _gumpCache[_usedIndex[i]];

                if (texture == null || texture.IsDisposed)
                {
                    _usedIndex.RemoveAt(i--);
                }
                else if (CoreGame.Ticks - texture.Ticks >= 3000)
                {
                    texture.Dispose();
                    //texture = null;
                    _usedIndex.RemoveAt(i--);
                    _gumpDictionary.Remove(g);
                    if (++count >= 5)
                    {
                        break;
                    }
                }
            }
        }
Example #12
0
        public static void ClearUnusedTextures()
        {
            int  count = 0;
            long ticks = CoreGame.Ticks - Constants.CLEAR_TEXTURES_DELAY;

            for (int i = 0; i < _usedIndex.Count; i++)
            {
                int           g       = _usedIndex[i];
                SpriteTexture texture = _gumpDictionary[g];
                //ref SpriteTexture texture = ref _gumpCache[_usedIndex[i]];

                if (texture.Ticks < ticks)
                {
                    texture.Dispose();
                    //texture = null;
                    _usedIndex.RemoveAt(i--);
                    _gumpDictionary.Remove(g);

                    if (++count >= Constants.MAX_GUMP_OBJECT_REMOVED_BY_GARBAGE_COLLECTOR)
                    {
                        break;
                    }
                }
            }
        }
Example #13
0
 /// <summary>Creates a new UI RendererType sprite instance. </summary>
 /// <param name="sizePixels">Sprite size for UIObject in pixels.</param>
 /// <param name="color">Color used.</param>
 /// <param name="spriteTexture">SpriteTexture used to draw the UI element.</param>
 public UISprite(Point sizePixels, Color color, SpriteTexture spriteTexture)
 {
     unscaledSize  = sizePixels;
     Color         = color;
     SpriteTexture = spriteTexture;
     Origin        = Vector2.Zero;
 }
Example #14
0
 private void CreateMap()
 {
     _gumpTexture = FileManager.Gumps.GetTexture(_useLargeMap ? (ushort)5011 : (ushort)5010);
     Width        = _gumpTexture.Width;
     Height       = _gumpTexture.Height;
     CreateMiniMapTexture(true);
 }
Example #15
0
        public LoginComponent(D3DEngine engine, MainScreen screen, SandboxCommonResources commonResources)
            : base(engine, screen, commonResources)
        {
            if (engine == null)
            {
                throw new ArgumentNullException("engine");
            }
            if (screen == null)
            {
                throw new ArgumentNullException("screen");
            }
            _engine = engine;
            _screen = screen;

            _stEnter         = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\Login\\enter.png"));
            _stEnterHover    = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\Login\\enter_hover.png"));
            _stEnterDown     = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\Login\\enter_press.png"));
            _stEnterDisabled = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\Login\\enter_disabled.png"));

            _stSign      = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\Login\\sign.png"));
            _stSignHover = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\Login\\sign_hover.png"));

            _stInputBg  = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\Login\\login_input_bg.png"));
            _stEmail    = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\Login\\email.png"));
            _stPassword = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\Login\\password.png"));

            _stAutentification = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\Login\\authentication.png"));
            _stError           = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\Login\\error.png"));
        }
Example #16
0
        public CraftingInventory(
            D3DEngine engine,
            WorldConfiguration conf,
            PlayerEntityManager character,
            IconFactory iconFactory,
            InputsManager inputManager,
            SandboxCommonResources commonResources) :
            base(conf, character, iconFactory, inputManager)
        {
            _engine            = engine;
            _iconFactory       = iconFactory;
            _inputManager      = inputManager;
            _commonResources   = commonResources;
            _stInventoryWindow = ToDispose(new SpriteTexture(engine.Device, @"Images\Inventory\crafting_window.png"));

            _stLabelRecipes     = ToDispose(new SpriteTexture(engine.Device, @"Images\Inventory\label_crafting_recipes.png"));
            _stLabelIngredients = ToDispose(new SpriteTexture(engine.Device, @"Images\Inventory\label_ingredients.png"));
            _stLabelCraft       = ToDispose(new SpriteTexture(engine.Device, @"Images\Inventory\label_craft.png"));
            _stBtnCraft         = ToDispose(new SpriteTexture(engine.Device, @"Images\Inventory\inventory_close.png"));
            _stBtnCraftDown     = ToDispose(new SpriteTexture(engine.Device, @"Images\Inventory\inventory_close_down.png"));
            _stBtnCraftHover    = ToDispose(new SpriteTexture(engine.Device, @"Images\Inventory\inventory_close_hover.png"));

            CustomWindowImage = _stInventoryWindow;
            Bounds.Size       = new UniVector(627, 388);

            InitializeComponent();
        }
Example #17
0
        public static void ClearUnusedTextures()
        {
            int  count = 0;
            long ticks = CoreGame.Ticks - 3000;

            for (int i = 0; i < _usedIndex.Count; i++)
            {
                int           g       = _usedIndex[i];
                SpriteTexture texture = _textmapDictionary[g];
                //ref SpriteTexture texture = ref _textmapCache[_usedIndex[i]];

                if (texture.Ticks < ticks)
                {
                    texture.Dispose();
                    // texture = null;
                    _usedIndex.RemoveAt(i--);
                    _textmapDictionary.Remove(g);

                    if (++count >= 20)
                    {
                        break;
                    }
                }
            }
        }
Example #18
0
        public static SpriteTexture GetStaticTexture(ushort g)
        {
            if (!_artDictionary.TryGetValue(g, out SpriteTexture texture) || texture.IsDisposed)
            {
                ushort[] pixels = ReadStaticArt(g, out short w, out short h);
                texture = new SpriteTexture(w, h, false);
                texture.SetData(pixels);
                _usedIndex.Add(g);
                _picker.Set(g, w, h, pixels);
                _artDictionary.Add(g, texture);
            }

            //ref SpriteTexture texture = ref _artCache[g];

            //if (texture == null || texture.IsDisposed)
            //{
            //    ushort[] pixels = ReadStaticArt(g, out short w, out short h);
            //    texture = new SpriteTexture(w, h, false);
            //    texture.SetData(pixels);
            //    _usedIndex.Add(g);
            //    _picker.Set(g, w, h, pixels);
            //}

            return(texture);
        }
Example #19
0
        public QuestionGump(string message, Action <bool> result) : base(0, 0)
        {
            Add(new GumpPic(0, 0, 0x0816, 0));

            SpriteTexture t = FileManager.Gumps.GetTexture(0x0816);

            Width  = t.Width;
            Height = t.Height;


            Add(new Label(message, false, 0x0386, 165)
            {
                X = 33, Y = 30
            });

            Add(new Button((int)Buttons.Cancel, 0x817, 0x818, 0x0819)
            {
                X = 37, Y = 75, ButtonAction = ButtonAction.Activate
            });

            Add(new Button((int)Buttons.Ok, 0x81A, 0x81B, 0x081C)
            {
                X = 100, Y = 75, ButtonAction = ButtonAction.Activate
            });
            CanMove             = false;
            ControlInfo.IsModal = true;

            X = (Engine.WindowWidth - Width) >> 1;
            Y = (Engine.WindowHeight - Height) >> 1;

            WantUpdateSize = false;
            _result        = result;
        }
Example #20
0
        public static SpriteTexture GetTextmapTexture(ushort g)
        {
            if (!_textmapDictionary.TryGetValue(g, out SpriteTexture texture) || texture.IsDisposed)
            {
                ushort[] pixels = GetTextmapTexture(g, out int size);

                if (pixels == null || pixels.Length == 0)
                {
                    return(null);
                }
                texture = new SpriteTexture(size, size, false);
                texture.SetData(pixels);
                _usedIndex.Add(g);
                _textmapDictionary.Add(g, texture);
            }

            //ref SpriteTexture texture = ref _textmapCache[g];

            //if (texture == null || texture.IsDisposed)
            //{
            //    ushort[] pixels = GetTextmapTexture(g, out int size);

            //    if (pixels == null || pixels.Length == 0)
            //        return null;
            //    texture = new SpriteTexture(size, size, false);
            //    texture.SetData(pixels);
            //    _usedIndex.Add(g);
            //}

            return(texture);
        }
Example #21
0
        /// <inheritdoc/>
        protected internal override void Initialize()
        {
            LoadResource();

            SpriteTexture spriteTexture = InspectedObject as SpriteTexture;

            if (spriteTexture == null)
            {
                return;
            }

            textureField.OnChanged += (x) =>
            {
                Texture texture = Resources.Load <Texture>(x);
                spriteTexture.Texture = texture;
                EditorApplication.SetDirty(spriteTexture);
            };

            offsetField.OnChanged += (x) =>
            {
                spriteTexture.Offset = x;
                EditorApplication.SetDirty(spriteTexture);
            };

            scaleField.OnChanged += (x) =>
            {
                spriteTexture.Scale = x;
                EditorApplication.SetDirty(spriteTexture);
            };

            Layout.AddElement(textureField);
            Layout.AddElement(offsetField);
            Layout.AddElement(scaleField);
        }
Example #22
0
 public void Dispose()
 {
     if (VertexBuffer != null && !VertexBuffer.Disposed)
     {
         VertexBuffer.Dispose();
     }
     if (VertexInputLayout != null && !VertexInputLayout.Disposed)
     {
         VertexInputLayout.Dispose();
     }
     if (SpriteEffect != null && !SpriteEffect.Disposed)
     {
         SpriteEffect.Dispose();
     }
     if (SpriteTexture != null && !SpriteTexture.Disposed)
     {
         SpriteTexture.Dispose();
     }
     if (mapedBitmap != null)
     {
         mapedBitmap.Dispose();
     }
     if (mapedGraphic != null)
     {
         mapedGraphic.Dispose();
     }
 }
Example #23
0
 /// <summary>
 /// テクスチャを更新する必要が有る場合更新する
 /// レンダリングと同一タイミングで呼び出すこと。
 /// </summary>
 public void Update()
 {
     if (NeedRedraw)
     {
         using (MemoryStream ms = new MemoryStream())
         {
             lock (mapedBitmap)
             {
                 mapedBitmap.Save(ms, ImageFormat.Tiff);
             }
             ms.Seek(0, SeekOrigin.Begin);
             try
             {
                 if (SpriteTexture != null)
                 {
                     lock (SpriteTexture)
                     {
                         SpriteTexture.Dispose();
                         SpriteTexture = ShaderResourceView.FromStream(Context.DeviceManager.Device, ms, (int)ms.Length);
                     }
                 }
                 else
                 {
                     SpriteTexture = ShaderResourceView.FromStream(Context.DeviceManager.Device, ms, (int)ms.Length);
                 }
             }
             catch (Direct3D11Exception)
             {
                 //終了時になぜかスローされる。とりあえず無視
             }
         }
         NeedRedraw = false;
     }
 }
Example #24
0
        public MainMenuComponent(D3DEngine engine, MainScreen screen, RealmRuntimeVariables runtime, SandboxCommonResources commonResources)
            : base(engine, screen, commonResources)
        {
            if (engine == null)
            {
                throw new ArgumentNullException("engine");
            }
            if (screen == null)
            {
                throw new ArgumentNullException("screen");
            }
            _engine  = engine;
            _screen  = screen;
            _runtime = runtime;

            _engine.ScreenSize_Updated += UpdateLayout;


            _stLabelContinue     = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\MainMenu\\main_menu_label_continue.png"));
            _stLabelCredits      = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\MainMenu\\main_menu_label_credits.png"));
            _stLabelExit         = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\MainMenu\\main_menu_label_exit.png"));
            _stLabelLogOut       = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\MainMenu\\main_menu_label_logout.png"));
            _stLabelMultiplayer  = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\MainMenu\\main_menu_label_multiplayer.png"));
            _stLabelSingleplayer = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\MainMenu\\main_menu_label_singleplayer.png"));
            _stLabelSettings     = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\MainMenu\\main_menu_label_settings.png"));
            _stLabelEditor       = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\MainMenu\\main_menu_label_editor.png"));
            _stMainMenuLabel     = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\MainMenu\\main_menu.png"));
        }
Example #25
0
        public void LoadFontAndMenuImages(D3DEngine engine)
        {
            if (StShadow != null)
            {
                throw new InvalidOperationException("Common images is already loaded");
            }

            StLogo                  = LoadTexture(engine, @"Images\logo.png");
            StShadow                = LoadTexture(engine, @"Images\shadow.png");
            StGameName              = LoadTexture(engine, @"Images\version.png");
            StBackLabel             = LoadTexture(engine, @"Images\back_label.png");
            StCubesPattern          = LoadTexture(engine, @"Images\cubes.png");
            StLinenPattern          = LoadTexture(engine, @"Images\black-linen.png");
            StInputBackground       = LoadTexture(engine, @"Images\Login\login_input_bg.png");
            StButtonBackground      = LoadTexture(engine, @"Images\MainMenu\menu_button.png");
            StButtonBackgroundDown  = LoadTexture(engine, @"Images\MainMenu\menu_button_down.png");
            StButtonBackgroundHover = LoadTexture(engine, @"Images\MainMenu\menu_button_hover.png");


            FontCollection = new PrivateFontCollection();
            FontCollection.AddFontFile("Images\\BebasNeue.ttf");

            FontBebasNeue50 = new SpriteFont();
            FontBebasNeue50.Initialize(FontCollection.Families[0], 50, FontStyle.Regular, true, engine.Device);

            FontBebasNeue35 = new SpriteFont();
            FontBebasNeue35.Initialize(FontCollection.Families[0], 35, FontStyle.Regular, true, engine.Device);

            FontBebasNeue25 = new SpriteFont();
            FontBebasNeue25.Initialize(FontCollection.Families[0], 25, FontStyle.Regular, true, engine.Device);

            FontBebasNeue17 = new SpriteFont();
            FontBebasNeue17.Initialize(FontCollection.Families[0], 16, FontStyle.Regular, true, engine.Device);
        }
Example #26
0
 public void LoadInventoryImages(D3DEngine engine)
 {
     StInventoryEquipmentSlot      = LoadTexture(engine, @"Images\Inventory\equipment_slot.png");
     StInventoryEquipmentSlotHover = LoadTexture(engine, @"Images\Inventory\equipment_slot_hover.png");
     StInventoryInfo      = LoadTexture(engine, @"Images\Inventory\inventory_info.png");
     StInventorySlot      = LoadTexture(engine, @"Images\Inventory\inventory_slot.png");
     StInventorySlotHover = LoadTexture(engine, @"Images\Inventory\inventory_slot_active.png");
 }
Example #27
0
            public ClickableColorBox(int x, int y, int w, int h, ushort hue, uint color) : base(w, h, hue, color)
            {
                X = x + 3;
                Y = y + 3;
                WantUpdateSize = false;

                _background = FileManager.Gumps.GetTexture(0x00D4);
            }
Example #28
0
        public void SetMapTexture(SpriteTexture texture)
        {
            _textureControl.Texture?.Dispose();
            _textureControl.WantUpdateSize = true;
            _textureControl.Texture        = texture;

            WantUpdateSize = true;
        }
Example #29
0
        private void CreateTextureArray(DeviceContext context, List <Texture2D> textureArray)
        {
            //Create the Icon texture Array
            ArrayTexture.CreateTexture2D(context, textureArray.ToArray(), "Icon's ArrayTexture", out _iconsTextureArray);

            // indexes into array corresponds textures with modifier +1 (Air)
            _iconTextureArray = new SpriteTexture(IconSize, IconSize, _iconsTextureArray, new Vector2());
        }
 void OnEnable()
 {
     TI = target as SpriteTexture;
     if (TI.SpriteRenderer == null)
     {
         TI.SpriteRenderer = TI.GetComponent <SpriteRenderer>();
     }
 }
Example #31
0
 /// <summary>
 /// Constructor for Sprite
 /// </summary>
 /// <param name="_texture">Texture for sprite</param>
 public Sprite(Texture2D _texture)
 {
     texture = new SpriteTexture(_texture, this);
     iScale = 1;
     iWidth = texture.Width;
     iDepth = texture.Depth;
     position = new Vector2(0, 0);
     actualPosition = new Vector2(X, Y);
     width = iWidth;
     depth = iDepth;
     scale = iScale;
     rotation = 0;
 }
Example #32
0
 /// <summary>
 /// Constructor for Sprite
 /// </summary>
 /// <param name="_texture">Texture for sprite</param>
 /// <param name="_frames">Animation frames</param>
 /// <param name="_modes">Different modes</param>
 /// <param name="_position">Position of sprite center</param>
 public Sprite(Texture2D _texture, int _frames, int _modes, Vector2 _position)
 {
     texture = new SpriteTexture(_texture, _frames, _modes, this);
     iScale = 1;
     iWidth = texture.Width;
     iDepth = texture.Depth;
     position = _position;
     actualPosition = new Vector2(X, Y);
     width = iWidth;
     depth = iDepth;
     scale = iScale;
     rotation = 0;
 }
Example #33
0
 /// <summary>
 /// Constructor for Sprite
 /// </summary>
 /// <param name="_texture">Texture for sprite</param>
 /// <param name="_frames">Animation frames</param>
 /// <param name="_modes">Different modes</param>
 /// <param name="_position">Position of sprite center</param>
 /// <param name="_width">Width of sprite</param>
 /// <param name="_depth">Depth of sprite</param>
 /// <param name="_scale">Scale of sprite</param>
 public Sprite(Texture2D _texture, int _frames, int _modes, Vector2 _position, int _width, int _depth, float _scale)
 {
     texture = new SpriteTexture(_texture, _frames, _modes, this);
     iScale = 1;
     iWidth = texture.Width;
     iDepth = texture.Depth;
     position = _position;
     actualPosition = new Vector2(X, Y);
     Width = _width;
     Depth = _depth;
     Scale = _scale;
     rotation = 0;
 }
Example #34
0
 /// <summary>
 /// Constructor for Sprite
 /// </summary>
 /// <param name="_texture">Texture for sprite</param>
 /// <param name="_position">Position of sprite center</param>
 /// <param name="_width">Width of sprite</param>
 /// <param name="_depth">Depth of sprite</param>
 public Sprite(Texture2D _texture, Vector2 _position, int _width, int _depth)
 {
     texture = new SpriteTexture(_texture, this);
     iScale = 1;
     iWidth = texture.Width;
     iDepth = texture.Depth;
     position = _position;
     actualPosition = new Vector2(X, Y);
     Width = _width;
     Depth = _depth;
     scale = iScale;
     rotation = 0;
 }