public void DrawImageSource(ImageSource source, Rectangle rectangle, float rotation, Color color)
 {
     Vector2 origin = new Vector2(source.Texture.Width / 2f, source.Texture.Height / 2f);
     rectangle.X += rectangle.Width / 2;
     rectangle.Y += rectangle.Height / 2;
     dataAccess.SpriteBatch.Draw(source.Texture, rectangle, null, color, rotation, origin, SpriteEffects.None, 0);
 }
Beispiel #2
0
 public TexturedButton(DataAccess dataAccess, string fileName, Point position)
 {
     this.dataAccess = dataAccess;
     this.source = new ImageSource(dataAccess.GraphicsDevice, fileName);
     this.source.Load();
     rectangle = new Rectangle(position.X, position.Y, source.Width, source.Height);
 }
Beispiel #3
0
 public void LoadImagesSource(string fileName, string sourceName)
 {
     if(!imageSources.ContainsKey(sourceName))
     {
         ImageSource imageSource = new ImageSource(graphicsDevice, fileName);
         imageSource.Load();
         imageSources.Add(sourceName, imageSource);
     }
 }
Beispiel #4
0
        public ContentHelper(GraphicsDevice graphicsDevice, ContentManager content)
        {
            this.graphicsDevice = graphicsDevice;
            this.content = content;

            effects = new Dictionary<string, Effect>();
            imageSources = new Dictionary<string, ImageSource>();
            spriteFonts = new Dictionary<string, SpriteFont>();

            ImageSource emptySource = new ImageSource(graphicsDevice, 1, 1, Color.White);
            imageSources.Add("empty", emptySource);
        }
 public void DrawImageSource(ImageSource source, Rectangle rectangle, float rotation, bool loadFullSize)
 {
     Texture2D texture = source.Texture;
     if (source.FileName != "" && loadFullSize) texture = source.GetBigVersion(Math.Max(rectangle.Width, rectangle.Height));
     Vector2 origin = new Vector2(texture.Width / 2f, texture.Height / 2f);
     rectangle.X += rectangle.Width / 2;
     rectangle.Y += rectangle.Height / 2;
     dataAccess.SpriteBatch.Draw(texture, rectangle, null, Color.White, rotation, origin, SpriteEffects.None, 0);
     if (source.FileName != "" && loadFullSize)
     {
         texture.Dispose();
         texture = null;
         GC.Collect();
     }
 }
Beispiel #6
0
 public TexturedButton(DataAccess dataAccess, ImageSource source)
 {
     this.dataAccess = dataAccess;
     this.source = source;
     rectangle = new Rectangle(0, 0, 100, 100);
 }
Beispiel #7
0
 public TexturedButton(DataAccess dataAccess, ImageSource source, Point position)
 {
     this.dataAccess = dataAccess;
     this.source = source;
     rectangle = new Rectangle(position.X, position.Y, source.Width, source.Height);
 }
Beispiel #8
0
 public Image(ImageSource source, Vector2 center)
     : this(source)
 {
     data.Center = center;
 }
Beispiel #9
0
 public Image(ImageSource source)
 {
     this.source = source;
     SetDefaultData();
 }
Beispiel #10
0
 public Image(DataAccess dataAccess, string fileName)
 {
     this.source = new ImageSource(dataAccess.GraphicsDevice, fileName);
     SetDefaultData();
 }