示例#1
0
 static Assets()
 {
     Texture2D   = new Texture2DManager();
     SpriteFont  = new SpriteFontManager();
     SoundEffect = new SoundEffectManager();
     Song        = new SongManager();
 }
示例#2
0
            public Renderer(SpriteBatch batch, Texture2DManager textures)
            {
                ArgumentNullException.ThrowIfNull(batch);
                ArgumentNullException.ThrowIfNull(textures);

                _batch    = batch;
                _textures = textures;
            }
示例#3
0
 public static void Release()
 {
     if (m_instance != null)
     {
         m_instance.Destory();
     }
     m_instance = null;
 }
示例#4
0
        public MainWindow()
        {
            InitializeComponent();
            GameViewPort game = gameViewPort;

            GameCore.ContentManager = game.Content;
            //GameCore.DeviceManager = game.Graphics;
            GameCore.TextureManager = Texture2DManager.Create();
            GameCore.FontManager    = new FontManager();
            GameCore.SpriteBatch    = game.SpriteBatch;
        }
示例#5
0
 static void Main()
 {
     using (var game = new MainGame())
     {
         GameCore.ContentManager = game.Content;
         GameCore.DeviceManager  = game.Graphics;
         GameCore.TextureManager = Texture2DManager.Create();
         GameCore.FontManager    = new FontManager();
         GameCore.SpriteBatch    = game.SpriteBatch;
         game.Run();
     }
 }
示例#6
0
 static int Release(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 0);
         Texture2DManager.Release();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
示例#7
0
 static int ClearUnusedAllCache(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         Texture2DManager obj = (Texture2DManager)ToLua.CheckObject(L, 1, typeof(Texture2DManager));
         obj.ClearUnusedAllCache();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
示例#8
0
 static int CreateTextureByImage(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 4);
         Texture2DManager        obj  = (Texture2DManager)ToLua.CheckObject(L, 1, typeof(Texture2DManager));
         UnityEngine.UI.RawImage arg0 = (UnityEngine.UI.RawImage)ToLua.CheckUnityObject(L, 2, typeof(UnityEngine.UI.RawImage));
         string arg1 = ToLua.CheckString(L, 3);
         bool   arg2;
         UnityEngine.Texture2D o = obj.CreateTextureByImage(arg0, arg1, out arg2);
         ToLua.Push(L, o);
         LuaDLL.lua_pushboolean(L, arg2);
         return(2);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
示例#9
0
    static int _CreateTexture2DManager(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 0)
            {
                Texture2DManager obj = new Texture2DManager();
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: Texture2DManager.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
示例#10
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            var fontSystems    = new List <FontSystem>();
            var textureCreator = new Texture2DManager(GraphicsDevice);

            _renderer = new Renderer(_spriteBatch);

            // Simple
            var fontSystem = new FontSystem(textureCreator, 1024, 1024);

            LoadFontSystem(fontSystem);
            fontSystems.Add(fontSystem);

            // Blurry
            var blurryFontSystem = new FontSystem(textureCreator, 1024, 1024, EffectAmount);

            LoadFontSystem(blurryFontSystem);
            fontSystems.Add(blurryFontSystem);

            // Stroked
            var strokedFontSystem = new FontSystem(textureCreator, 1024, 1024, 0, EffectAmount);

            LoadFontSystem(strokedFontSystem);
            fontSystems.Add(strokedFontSystem);

            _fontSystems       = fontSystems.ToArray();
            _currentFontSystem = _fontSystems[0];

            _white = new Texture2D(GraphicsDevice, 1, 1);
            _white.SetData(new[] { Color.White });

            GC.Collect();
        }