예제 #1
0
        public T Load <T>(GraphicsDevice graphicsDevice, string path)
        {
            int uniqueKey = path.GetHashCode() + typeof(T).GetHashCode();

            IContentLoader contentReader;

            if (resourceList.ContainsKey(uniqueKey))
            {
                return((T)resourceList[uniqueKey]);
            }
            else
            {
                if (typeof(T) == typeof(LeaTexture2D))
                {
                    contentReader = new BitMapLoader();
                    var image = contentReader.Load(path) as Image;

                    var tex = LeaTexture2D.Create(graphicsDevice, image);

                    resourceList.Add(uniqueKey, tex);
                }

                if (typeof(T) == typeof(LeaEffect))
                {
                }


                return((T)resourceList[uniqueKey]);
            }
        }
예제 #2
0
 public Button(string text, Vector2 size, Vector2 position, LeaTexture2D texture, bool isHover, GraphicsDevice graphicsDevice)
 {
     base.graphicsDevice = graphicsDevice;
     base.text           = text;
     base.size           = size;
     base.position       = position;
     base.texture        = texture;
     base.color          = Color.White;
     base.isHover        = isHover;
     base.isMovable      = false;
 }
예제 #3
0
        public void Submit(LeaTexture2D tex, Vector2 position, Vector2 size, Color color)
        {
            spriteInfoList[ptr].position        = position;
            spriteInfoList[ptr].size            = new Vector2(tex.Width, tex.Height);
            spriteInfoList[ptr].offset          = Vector2.Zero;
            spriteInfoList[ptr].color           = color.ToVector4();
            spriteInfoList[ptr].srv             = tex.ShaderResourceView;
            spriteInfoList[ptr].textureHashCode = tex.GetHashCode();

            //var tmpSprite = new SpriteInfo
            //{
            //	position = position,
            //	size = new Vector2(tex.Width, tex.Height),
            //	offset = Vector2.Zero,
            //	color = color.ToVector4(),
            //	srv = tex.ShaderResourceView,
            //	textureHashCode = tex.GetHashCode()
            //};


            spriteBatcher.AddSpriteInfo(spriteInfoList[ptr], ref ptr);

            ptr++;
        }