Exemple #1
0
        /// <summary>
        /// Loads content on a separate thread, thus allowing the game to do other stuff (such as show a splash screen).
        /// </summary>
        private void LoadContentThreaded()
        {
            if (Directory.Exists(Main.contentpath + "\\Sprites"))
            {
                //Load all the sprites with the following extensions.
                string[] spriteextensions = { ".xml", ".sprite.gmx", ".json" };

                foreach (string file in Directory.GetFiles(Main.contentpath + "\\Sprites", "*.*").Where(file => spriteextensions.Contains(Path.GetExtension(file).ToLower())))
                {
                    GMSprite.LoadSprite(file);
                    //sprites.Add(new GMSprite(Content.Load<Texture2D>(Path.GetFileNameWithoutExtension(file)),"");
                }
            }

            contentloaded = true;
        }
Exemple #2
0
        //TODO: Code the following functions/variables/constants (delete each line when implemented):
        //game_load
        //game_load_buffer
        //game_save
        //game_save_buffer
        //script_exists
        //script_get_name
        //script_execute
        //gml_release_mode
        //gml_pragma
        //parameter_count
        //parameter_string
        //environment_get_variable
        //external_define
        //external_call
        //external_free
        //cursor_sprite
        //alarm_set
        //alarm_get
        //GM_build_date
        //GM_version

        #endregion

        #region Sprite-related GML functions/variables/constants

        /// <summary>
        /// Draws a sprite at a given position.
        /// </summary>
        /// <param name="sprite">The index of the sprite to draw.</param>
        /// <param name="subimg">The sub-img (frame) of the sprite to draw (image_index or -1 correlate to the current frame of animation in the object).</param>
        /// <param name="x">The x coordinate of where to draw the sprite.</param>
        /// <param name="y">The y coordinate of where to draw the sprite.</param>
        public static void draw_sprite(GMSprite sprite, int subimg, float x, float y)
        {
            //TODO: This
        }