예제 #1
0
        /// <
        ///     summary>
        ///     Draws a marker at the specified position.
        /// </summary>
        /// <param name="position">The position.</param>
        public static void DrawSpriteAt(Vector3 position,
                                        string textureDict, string textureName, Size size, Color color)
        {
            Streaming.RequestTextureDictionary(textureDict);
            var timer = 0.25f;

            while (!Function.Call <bool>(Hash.HAS_STREAMED_TEXTURE_DICT_LOADED, textureDict) && timer > 0f)
            {
                timer -= Time.UnscaledDeltaTime;
                Script.Yield();
            }
            var res    = Game.ScreenResolution;
            var width  = (float)size.Width / res.Width;
            var height = (float)size.Height / res.Height;

            Function.Call(Hash.SET_DRAW_ORIGIN, position.X, position.Y, position.Z, 0);
            Function.Call(Hash.DRAW_SPRITE, textureDict, textureName, 0.0f, 0.0f,
                          width, height, 0, color.R, color.G, color.B, color.A);
            Function.Call(Hash.CLEAR_DRAW_ORIGIN);
        }