/// <summary>
        /// Load a content from a asset file name
        /// </summary>
        /// <param name="assetFileName">Asset name, relative to the loader root directory, and including the file extension.</param>
        /// <returns>Return a Configuration file instance corresponding to the asset file name</returns>
        public override object Load(string assetFileName)
        {
            GraphicsConfiguration config = null;

            if (assetFileName.Length > 4 && assetFileName[assetFileName.Length - 4] == '.') // need to have 5 char mini x.xxx and a point before the format suffix.
            {
                //get the 4 last char
                string fileFormat = assetFileName.Substring(assetFileName.Length - 3, 3).ToUpper();

                if (this._supportFormat.Contains(fileFormat))
                {
                    try
                    {
                        config = SerializerHelper.Load <GraphicsConfiguration>(assetFileName);
                    }
                    catch
                    {
                        throw;
                    }
                }
                else
                {
                    throw new ContentLoadException(typeof(GraphicsCfgContentResolver).FullName, string.Format(Pulsar.Resources.Exceptions.ContentManager.FormatNotSupportByResolver, assetFileName, typeof(GraphicsCfgContentResolver).FullName));
                }
            }
            else
            {
                throw new ContentLoadException(typeof(GraphicsCfgContentResolver).FullName, string.Format(Pulsar.Resources.Exceptions.ContentManager.FileNameIncorrect, assetFileName));
            }

            return(config);
        }
Exemple #2
0
        public static void Init()
        {
            // Load config file
            GraphicsConfiguration graphicsConfig = new GraphicsConfiguration();
            Configuration         config         = graphicsConfig.LoadConfiguration();

            // Declare variables to correct
            Resolution      resolution  = config.Resolution;
            RefreshRate     refreshRate = config.RefreshRate;
            GraphicsAdapter adapter;

            // Load existing adapters
            List <GraphicsAdapter> adapters = DevicesHandler.GetGraphicsAdapters();

            // Find corresponding monitor ID
            adapter = FindAdapter(adapters, config);

            if (adapter == null)
            {
                // Unable to find adapter, use the default one
                adapter     = adapters[0];
                resolution  = adapter.Resolutions[0];
                refreshRate = resolution.RefreshRates[0];
            }

            // Change config
            config.GraphicsAdapter = adapter;
            config.Resolution      = resolution;
            config.RefreshRate     = refreshRate;

            // Re-save
            graphicsConfig.SaveConfiguration(config);
        }
        public void Init()
        {
            if (Directory.Exists(path + "/" + application))
            {
                string[] files = Directory.GetFiles(path + "/" + application);
                if (files.Length > 0)
                {
                    foreach (string file in files)
                    {
                        File.Delete(file);
                    }
                }
            }

            if (!Directory.Exists("Content"))
            {
                Directory.CreateDirectory("Content");
            }

            this._graphics = new GraphicsConfiguration();
            this._graphics.BitsPerPixel            = 32;
            this._graphics.IsMouseVisible          = true;
            this._graphics.IsVerticalSync          = false;
            this._graphics.Resolution              = new Resolution(800, 600);
            this._graphics.Styles                  = Styles.Default;
            this._graphics.IsLightEngineActive     = false;
            this._graphics.IsParticuleEngineActive = false;

            this._audio              = new AudioConfiguration();
            this._audio.FadeMusic    = false;
            this._audio.FxVolume     = 0f;
            this._audio.MasterVolume = 0f;
            this._audio.MaxSounds    = 0;
            this._audio.MusicVolume  = 0f;
            this._audio.Mute         = true;

            this._game          = new GameConfiguration();
            this._game.Culture  = CultureInfo.CurrentCulture.Name;
            this._game.Skin     = string.Empty;
            this._game.SkinFont = string.Empty;

            this._hotKeys = new HotKeyConfiguration();

            SerializerHelper.Save("Content/graphics.xml", this._graphics);
            SerializerHelper.Save("Content/audio.xml", this._audio);
            SerializerHelper.Save("Content/game.xml", this._game);
            SerializerHelper.Save("Content/keys.xml", this._hotKeys);
        }
Exemple #4
0
 /// <summary>
 /// Creates a <code>JFrame</code> with the specified title and the
 /// specified <code>GraphicsConfiguration</code> of a screen device.
 /// </summary>
 public JFrame(string @title, GraphicsConfiguration @gc)
 {
 }
Exemple #5
0
 /// <summary>
 /// Creates a <code>Frame</code> in the specified
 /// <code>GraphicsConfiguration</code> of
 /// a screen device and a blank title.
 /// </summary>
 public JFrame(GraphicsConfiguration @gc)
 {
 }
Exemple #6
0
        public void Init()
        {
            if (Directory.Exists(path + "/" + application))
            {
                string[] files = Directory.GetFiles(path + "/" + application);
                if (files.Length > 0)
                {
                    foreach (string file in files)
                    {
                        File.Delete(file);
                    }
                }
            }

            if (!Directory.Exists("Content"))
            {
                Directory.CreateDirectory("Content");
            }

            this._graphics = new GraphicsConfiguration();
            this._graphics.BitsPerPixel            = 32;
            this._graphics.IsMouseVisible          = true;
            this._graphics.IsVerticalSync          = false;
            this._graphics.Resolution              = new Resolution(800, 600);
            this._graphics.Styles                  = Styles.Default;
            this._graphics.IsLightEngineActive     = false;
            this._graphics.IsParticuleEngineActive = false;

            this._audio              = new AudioConfiguration();
            this._audio.FadeMusic    = false;
            this._audio.FxVolume     = 0f;
            this._audio.MasterVolume = 0f;
            this._audio.MaxSounds    = 0;
            this._audio.MusicVolume  = 0f;
            this._audio.Mute         = true;

            this._game         = new GameConfiguration();
            this._game.Culture = CultureInfo.CurrentCulture.Name;
            this._game.Skin    = string.Empty;

            this._hotKeys = new HotKeyConfiguration();

            this._language      = new Language();
            this._language.Key  = CultureInfo.CurrentCulture.Name;
            this._language.Name = CultureInfo.CurrentCulture.NativeName;

            FunctionTranslation func = new FunctionTranslation();

            func.Key = "DEFAULT";

            Translation trans = new Translation();

            trans.Key   = "HELLO_WORLD";
            trans.Value = "Bonjour le monde !";

            func.Translations.Add(trans);
            this._language.Functions.Add(func);

            SerializerHelper.Save("Content/graphics.xml", this._graphics);
            SerializerHelper.Save("Content/audio.xml", this._audio);
            SerializerHelper.Save("Content/game.xml", this._game);
            SerializerHelper.Save("Content/keys.xml", this._hotKeys);
            SerializerHelper.Save("Content/" + this._language.Key + ".xml", this._language);
        }
Exemple #7
0
 /// <summary>
 /// Constructs a new Canvas given a GraphicsConfiguration object.
 /// </summary>
 /// <param name="config"> a reference to a GraphicsConfiguration object.
 /// </param>
 /// <seealso cref= GraphicsConfiguration </seealso>
 public Canvas(GraphicsConfiguration config) : this()
 {
     GraphicsConfiguration = config;
 }
 /// <summary>
 /// Attempts to restore the drawing surface of the image if the surface
 /// had been lost since the last <code>validate</code> call.
 /// </summary>
 abstract public int validate(GraphicsConfiguration @gc);
Exemple #9
0
        // Volatile management methods

        /// <summary>
        /// Attempts to restore the drawing surface of the image if the surface
        /// had been lost since the last <code>validate</code> call.  Also
        /// validates this image against the given GraphicsConfiguration
        /// parameter to see whether operations from this image to the
        /// GraphicsConfiguration are compatible.  An example of an
        /// incompatible combination might be a situation where a VolatileImage
        /// object was created on one graphics device and then was used
        /// to render to a different graphics device.  Since VolatileImage
        /// objects tend to be very device-specific, this operation might
        /// not work as intended, so the return code from this validate
        /// call would note that incompatibility.  A null or incorrect
        /// value for gc may cause incorrect values to be returned from
        /// <code>validate</code> and may cause later problems with rendering.
        /// </summary>
        /// <param name="gc">   a <code>GraphicsConfiguration</code> object for this
        ///          image to be validated against.  A null gc implies that the
        ///          validate method should skip the compatibility test. </param>
        /// <returns>  <code>IMAGE_OK</code> if the image did not need validation<BR>
        ///          <code>IMAGE_RESTORED</code> if the image needed restoration.
        ///          Restoration implies that the contents of the image may have
        ///          been affected and the image may need to be re-rendered.<BR>
        ///          <code>IMAGE_INCOMPATIBLE</code> if the image is incompatible
        ///          with the <code>GraphicsConfiguration</code> object passed
        ///          into the <code>validate</code> method.  Incompatibility
        ///          implies that the image may need to be recreated with a
        ///          new <code>Component</code> or
        ///          <code>GraphicsConfiguration</code> in order to get an image
        ///          that can be used successfully with this
        ///          <code>GraphicsConfiguration</code>.
        ///          An incompatible image is not checked for whether restoration
        ///          was necessary, so the state of the image is unchanged
        ///          after a return value of <code>IMAGE_INCOMPATIBLE</code>
        ///          and this return value implies nothing about whether the
        ///          image needs to be restored. </returns>
        /// <seealso cref= java.awt.GraphicsConfiguration </seealso>
        /// <seealso cref= java.awt.Component </seealso>
        /// <seealso cref= #IMAGE_OK </seealso>
        /// <seealso cref= #IMAGE_RESTORED </seealso>
        /// <seealso cref= #IMAGE_INCOMPATIBLE </seealso>
        public abstract int Validate(GraphicsConfiguration gc);
Exemple #10
0
 //UPGRADE_ISSUE: Class 'java.awt.GraphicsConfiguration' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGraphicsConfiguration_3"'
 public virtual int validate(GraphicsConfiguration gc)
 {
     return 0;
 }
 /// <summary>
 /// Creates a modal or non-modal dialog with the specified title,
 /// owner <code>Dialog</code>, and <code>GraphicsConfiguration</code>.
 /// </summary>
 public JDialog(Dialog @owner, string @title, bool @modal, GraphicsConfiguration @gc)
     : base(@owner)
 {
 }
Exemple #12
0
 //UPGRADE_ISSUE: Class 'java.awt.GraphicsConfiguration' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtGraphicsConfiguration_3"'
 public virtual int validate(GraphicsConfiguration gc)
 {
     return(0);
 }