/// <summary>
        /// Load an image from disk and split it into frames of given size.
        /// </summary>
        /// <param name="filePath">The name of the image to be loaded.</param>
        /// <param name="frameWidth">The width of one frame.</param>
        /// <param name="frameHeight">The height of one frame.</param>
        /// <returns>The loaded image.</returns>
        public Image LoadImage(string filePath, int frameWidth, int frameHeight)
        {
            FallenGE.File_System.File file = FallenGE.File_System.FileManager.OpenFile(filePath, FallenGE.File_System.AccessMode.READ);
            Image image = new Image(file, frameWidth, frameHeight, currentContext.MaskColor[0], currentContext.MaskColor[1], currentContext.MaskColor[2]);

            FallenGE.File_System.FileManager.CloseFile(file);
            return(image);
        }
Exemple #2
0
        /// <summary>
        /// Load a sound from search paths added to file manager.
        /// </summary>
        /// <param name="filePath">The name of the sound file.</param>
        /// <returns></returns>
        public Sound LoadSound(String filePath)
        {
            FallenGE.File_System.File file = FallenGE.File_System.FileManager.OpenFile(filePath, FallenGE.File_System.AccessMode.READ);
            Sound sound = new Sound(file);

            FallenGE.File_System.FileManager.CloseFile(file);
            return(sound);
        }
        /// <summary>
        /// Loads a font from disk.
        /// </summary>
        /// <param name="filePath">The name of the font to be loaded.</param>
        /// <param name="metricsPath">Path to the metrics data (REQUIRED).</param>
        /// <returns>The loaded font.</returns>
        public Font LoadFont(string filePath, string metricsPath)
        {
            FallenGE.File_System.File file1 = FallenGE.File_System.FileManager.OpenFile(filePath, FallenGE.File_System.AccessMode.READ);
            FallenGE.File_System.File file2 = FallenGE.File_System.FileManager.OpenFile(metricsPath, FallenGE.File_System.AccessMode.READ);
            Font font = new Font(file1, file2);

            FallenGE.File_System.FileManager.CloseFile(file1);
            FallenGE.File_System.FileManager.CloseFile(file2);
            return(font);
        }