Exemple #1
0
 /// <summary>
 /// This is called when the game should draw itself.
 /// </summary>
 /// <param name="gameTime">Provides a snapshot of timing values.</param>
 protected override void Draw(GameTime gameTime)
 {
     if (SaveQ.Count >= TexQ.Count && SaveQ.Count > 0)
     {
         (string path, string clean, Texture2D tex) = SaveQ.Dequeue();
         Save(path, clean, tex);
     }
     if (SaveQ.Count < TexQ.Count && TexQ.Count > 0)
     {
         // TODO: Add your drawing code here
         Tex = TexQ.Dequeue();
         if (Tex != null)
         {
             GraphicsDevice.Clear(Color.CornflowerBlue);
             spriteBatch.Begin();
             float s  = (float)graphics.PreferredBackBufferWidth / Tex.Width;
             float s2 = (float)graphics.PreferredBackBufferHeight / Tex.Height;
             spriteBatch.Draw(Tex, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, new Vector2(s <= s2 ? s : s2), SpriteEffects.None, 0);
             spriteBatch.End();
             Tex.Dispose();
             Tex = null;
         }
         base.Draw(gameTime);
         //Thread.Sleep(250);
     }
 }
Exemple #2
0
 public void UnloadTexture()
 {
     if (TexView != null)
     {
         TexView.Dispose();
         TexView = null;
     }
     if (Tex != null)
     {
         Tex.Dispose();
         Tex = null;
     }
 }
        /// <summary>
        /// Command to reset the Output Texture
        /// </summary>
        /// <param name="args">None</param>
        /// <returns>Function Result</returns>
        private string cmd_FLReset(string[] args)
        {
            Tex.Dispose();
            SpecularTex.Dispose();
            Tex                 = TextureLoader.ParameterToTexture(width, height, "FLGeneratorMainTexture");
            SpecularTex         = TextureLoader.ParameterToTexture(width, height, "FLGeneratorSpecularTexture");
            SpecularTex.TexType = TextureType.Specular;
            for (int i = 0; i < previews.Count; i++)
            {
                previews[i].Textures[0] = Tex;
            }


            return("Texture Reset.");
        }