示例#1
0
        public static void ReloadTextures(EventHandler <LoadProgressUpdatedEventArgs> updateEventHandler)
        {
            ITextureLoadStrategy resourceLoadStrategy;

            if (!LoadingWindowViewModel.Settings.GraphicsIsPackedResource)
            {
                resourceLoadStrategy = new FolderLoadStrategy(LoadingWindowViewModel.Settings.GraphicsFormat);
            }
            else
            {
                resourceLoadStrategy = new TCDLoadStrategy(
                    LoadingWindowViewModel.Settings.GraphicsResourceFile,
                    LoadingWindowViewModel.Settings.GraphicsResourceFilePassword,
                    LoadingWindowViewModel.Settings.GraphicsResourceFileFormat);
            }

            var progressUpdateAction = default(EventHandler <LoadProgressUpdatedEventArgs>);

            progressUpdateAction = (sender, args) =>
            {
                updateEventHandler(sender, args);
                if (args == null)
                {
                    resourceLoadStrategy.ProgressUpdated -= progressUpdateAction;
                }
            };
            resourceLoadStrategy.ProgressUpdated += progressUpdateAction;
            resourceLoadStrategy.Load();

            Constants.TextureLoadStrategy = resourceLoadStrategy;
        }
示例#2
0
        public SpriteRendererPanel(ITextureLoadStrategy textureLoadStrategy, double?initialScaleX, double?initialScaleY)
        {
            this.textureLoadStrategy = textureLoadStrategy;

            this.initialScaleX = initialScaleX;
            this.initialScaleY = initialScaleY;
            this.Load         += this.GLControlOnLoad;
            this.Resize       += this.GLControlOnResize;

            this.renderedObjects = new Dictionary <int, RenderedObjectCollection>();

            this.renderScaleX = 1;
            this.renderScaleY = 1;

            this.MouseDown  += SpriteRendererPanel_MouseDown;
            this.MouseMove  += SpriteRendererPanel_MouseMove;
            this.MouseUp    += SpriteRendererPanel_MouseUp;
            this.MouseEnter += SpriteRendererPanel_MouseEnter;
            this.MouseHover += SpriteRendererPanel_MouseHover;
            this.MouseLeave += SpriteRendererPanel_MouseLeave;
        }
示例#3
0
 public SpriteRendererPanel(ITextureLoadStrategy textureLoadStrategy, double?initialScale) : this(textureLoadStrategy, initialScale, initialScale)
 {
 }
示例#4
0
 public SpriteRendererPanel(ITextureLoadStrategy textureLoadStrategy) : this(textureLoadStrategy, null)
 {
     this.backgroundColor = SpriteRendererPanel.DefaultBackgroundColor;
 }