当前位置: 首页>>代码示例>>C#>>正文


C# Graphics.Texture类代码示例

本文整理汇总了C#中SFML.Graphics.Texture的典型用法代码示例。如果您正苦于以下问题:C# Texture类的具体用法?C# Texture怎么用?C# Texture使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Texture类属于SFML.Graphics命名空间,在下文中一共展示了Texture类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: load_batch_textures

        public static void load_batch_textures(string folder)
        {
            //Debug.Log("Loading textures from folder " + folder);
            Debug.StartLogGroup();

                DirectoryInfo dir = new DirectoryInfo(folder);

                if (dir.Exists)
                {

                    FileInfo[] bmpfiles = dir.GetFiles("*.bmp", System.IO.SearchOption.AllDirectories);
                    FileInfo[] pngfiles = dir.GetFiles("*.png", System.IO.SearchOption.AllDirectories);
                    FileInfo[] files = new FileInfo[bmpfiles.Length + pngfiles.Length];

                    bmpfiles.CopyTo(files, 0);
                    pngfiles.CopyTo(files, bmpfiles.Length);

                    if (files.Length > 0) FileWatch.add_folder(folder);

                    for (int f = 0; f < files.Length; f++)
                    {
                        Texture tex = new Texture();
                        tex.assign_path(files[f].FullName);
                        textures.Add(tex.identifier, tex);
                    }
                }

            Debug.EndLogGroup();
        }
开发者ID:AllMyKilobits,项目名称:XFramework,代码行数:29,代码来源:Loader.cs

示例2: Sprite

 public Sprite(string name, int type)
 {
     _path = name;
     _type = type;
     _texture = new Texture(name);
     _loaded = (_texture == null) ? false : true;
 }
开发者ID:ComposerCookie,项目名称:WanderingSoul,代码行数:7,代码来源:Sprite.cs

示例3: ButtonControl

        public ButtonControl(Font font, uint size, Texture button, Texture hover, Texture press)
        {
            left = new RectangleShape();
            middle = new RectangleShape();
            right = new RectangleShape();

            left.Texture = button;
            middle.Texture = button;
            right.Texture = button;

            left.TextureRect = new IntRect(0, 0, (int)button.Size.X / 2 - 1, (int)button.Size.Y);
            middle.TextureRect = new IntRect((int)button.Size.X / 2 - 1, 0, 2, (int)button.Size.Y);
            right.TextureRect = new IntRect((int)button.Size.X / 2 + 1, 0, (int)button.Size.X / 2, (int)button.Size.Y);

            text = new TextControl(font, size) { TextAlignment = Alignment.MiddleCenter, Bold = true };
            text.BackgroundColor = Color.Transparent;

            IsHovered = false;
            IsPressed = false;
            ClickYOffset = 4.0f;

            buttonTexture = button;
            hoverTexture = hover;
            pressedTexture = press;
        }
开发者ID:Scellow,项目名称:sfml-ui,代码行数:25,代码来源:ButtonControl.cs

示例4: SetImage

 public void SetImage(string _source, int _imageWidth, int _imageHeight)
 {
     source = _source;
     imageWidth = _imageWidth;
     imageHeight = _imageHeight;
     image = new Texture("./assets/" + source);
 }
开发者ID:riordanp,项目名称:panjin,代码行数:7,代码来源:TileSet.cs

示例5: Edge

        public Edge()
            : base("edge post-effect")
        {
            // Create the off-screen surface
            mySurface = new RenderTexture(800, 600);
            mySurface.Smooth = true;

            // Load the textures
            myBackgroundTexture = new Texture("resources/sfml.png");
            myBackgroundTexture.Smooth = true;
            myEntityTexture = new Texture("resources/devices.png");
            myEntityTexture.Smooth = true;

            // Initialize the background sprite
            myBackgroundSprite = new Sprite(myBackgroundTexture);
            myBackgroundSprite.Position = new Vector2f(135, 100);

            // Load the moving entities
            myEntities = new Sprite[6];
            for (int i = 0; i < myEntities.Length; ++i)
            {
                myEntities[i] = new Sprite(myEntityTexture, new IntRect(96 * i, 0, 96, 96));
            }

            // Load the shader
            myShader = new Shader(null, "resources/edge.frag");
            myShader.SetParameter("texture", Shader.CurrentTexture);
        }
开发者ID:kaldhu,项目名称:MyGameEngine,代码行数:28,代码来源:Shader.cs

示例6: MainTitleScreen

        public MainTitleScreen(RenderWindow window)
            : base(window)
        {
            Type = ScreenType.MainTitleScreen;

            base.Init();
               // Gui.AddGameWidget(imb);

            initMenu();

            StraightLineVariableData slvd = new StraightLineVariableData(200F, 100 * 4);
               // slvd.AddKeyData(.25F, 100F);
            slvd.AddKeyData(.5F, 300F);
               // slvd.AddKeyData(.75F, 100F);
            slvd.ComputeData();

            img = new Image(800, 600, new Color(0, 0, 0, 0));
            for (int i = 0; i < slvd.GetCount(); ++i)
            {
               // Log.Cl(slvd.GetData(i));
                img.SetPixel((uint)(100 + i / 4), (uint)slvd.GetData(i), Color.Red);
               // img.SetPixel((uint)(100 + i / 4), (uint)slvd.GetData(i) + 4, Color.Blue);
            }

            tex = new SFML.Graphics.Texture(img);
            spre = new Sprite(tex);

            imb.AddMessage("hoy hoy !");
            imb.OnStopping += new MessageBox.EventHandler(imb_OnStopping);
        }
开发者ID:eickegao,项目名称:Blazera,代码行数:30,代码来源:MainTitleScreen.cs

示例7: TileMap

        public TileMap(int width, int height, Texture texture)
        {
            Width = width;
            Height = height;

            var lastTile = texture == null ? ushort.MaxValue : (ushort)((texture.Size.X / GameOptions.TileSize) * (texture.Size.Y / GameOptions.TileSize) - 1);

            tiles = new Tile[width, height];

            for (var y = 0; y < height; y++)
            {
                for (var x = 0; x < width; x++)
                {
                    tiles[x, y].Index = lastTile;
                    tiles[x, y].Solid = false;
                }
            }

            var chunkWidth = (width / GameOptions.TileChunkSize) + 1;
            var chunkHeight = (height / GameOptions.TileChunkSize) + 1;

            chunks = new Chunk[chunkWidth, chunkHeight];

            for (var y = 0; y < chunkHeight; y++)
            {
                for (var x = 0; x < chunkWidth; x++)
                {
                    chunks[x, y] = new Chunk(x, y, tiles, texture);
                }
            }
        }
开发者ID:DatZach,项目名称:HumanityAgainstCards,代码行数:31,代码来源:TileMap.cs

示例8: loadContent

        public override void loadContent()
        {
            float logoScale;

            _logoTexture = ResourceManager.getResource<Texture>("logo_1");
            _logoShape = new RectangleShape();
            _logoShape.Texture = _logoTexture;
            _logoShape.Size = new Vector2f(_logoTexture.Size.X, _logoTexture.Size.Y);
            logoScale = Game.window.GetView().Size.X / (float)_logoTexture.Size.X;
            _logoShape.Scale = new Vector2f(logoScale, logoScale);

            _font = ResourceManager.getResource<Font>("immortal_font");
            _options = new List<Text>();
            _options.Add(new Text("New Game", _font, 48));
            _options.Add(new Text("Continue", _font, 48));
            _options.Add(new Text("Options", _font, 48));
            _options.Add(new Text("Exit", _font, 48));

            for (int i = 0; i < _options.Count; i++)
            {
                Text text = _options[i];

                text.Position = new Vector2f(128, i * 48 + _logoShape.Size.Y * _logoShape.Scale.Y + 64);
            }
        }
开发者ID:klutch,项目名称:Loderpit,代码行数:25,代码来源:MainMenuScreen.cs

示例9: LoadContent

        public void LoadContent()
        {
            Texture tex = new Texture("Assets/Textures/TitelScreen.png");
            Background = new Sprite(tex);

            Background.Scale = Game.WindowSize / new Vec2f(Background.Texture.Size.X, Background.Texture.Size.Y);
        }
开发者ID:Kedreals,项目名称:MicrosoftGameJam2015AwesomeHurray,代码行数:7,代码来源:TitleScreen.cs

示例10: Enemy

        /// <summary>
        /// initializes a new Enemy
        /// </summary>
        /// <param name="direction">the direction to the texture as a string</param>
        /// <param name="sPosition">start position</param>
        public Enemy(string direction, Vector2f sPosition)
        {
            textur = new Texture(direction);
            sprite = new Sprite(textur);

            sprite.Position = sPosition;
        }
开发者ID:endert,项目名称:Intro2D,代码行数:12,代码来源:Enemy.cs

示例11: EmoteBubble

 public EmoteBubble(string emote, Actor parent)
 {
     this.emote = emote.ToLower();
     this.parent = parent;
     this.texture = Content.GetTexture("emote_" + emote +".png");
     life = 60 * 4;
 }
开发者ID:libjared,项目名称:iris,代码行数:7,代码来源:EmoteBubble.cs

示例12: GResource

 public GResource(string path, int type)
 {
     _path = path;
     _loaded = false;
     _myTexture = null;
     _type = type;
 }
开发者ID:ComposerCookie,项目名称:JRPDragon,代码行数:7,代码来源:GResource.cs

示例13: HWSurfaceInstance

 static HWSurfaceInstance()
 {
     _atlas = new RenderTexture(_aw, _ah);
     _atlastex = _atlas.Texture;
     _batch = new SpriteBatch(_atlas);
     _batch.SetBlendMode(BlendMode.None);
 }
开发者ID:Radnen,项目名称:sphere-sfml,代码行数:7,代码来源:HWSurfaceInstance2.cs

示例14: Player

        public Player(Vector2f _position, String _file, GameWorld _world)
        {
            create(_position, _file, 1);
            mWorld      = _world;

            mEntityType = EntityType.Player;
            mHealth     = 100;
            mSegment    = 10;

            mInvicible = false;
            mOnce      = false;
            mTimer     = new Stopwatch();

            mShoot     = new Stopwatch();
            mShoot.Start();

            for (int i = 0; i < 11; i++)
            {
                Texture tex = new Texture("resources/health/health" + i + ".png");
                mHealthBar[i] = new Sprite(tex);

                Vector2f pos = new Vector2f();
                pos.X -= 17f;
                pos.Y -= 10f;
                mHealthBar[i].Position = mPosition - pos;
            }
        }
开发者ID:Jamsterx1,项目名称:Titan,代码行数:27,代码来源:Player.cs

示例15: Menu

        public Menu()
            : base()
        {
            hoverCursor = Content.GetTexture("cursorHover.png");
            defaultCursor = Content.GetTexture("cursorPointer.png");
            currentCursor = defaultCursor;
            char1 = new Animation(Content.GetTexture("idle.png"), 4, 0, 0, true);
            char2 = new Animation(Content.GetTexture("char2_idle.png"), 4, 0, 0, true);
            shader = new RenderStates(new Shader(null, "Content/bgPrlx.frag"));

            rectConnect = new RectangleShape()
            {
                Size = new Vector2f(150, 30),
                Position = new Vector2f(-25, 70)
            };
            rectIP = new RectangleShape()
            {
                Size = new Vector2f(150, 20),
                Position = new Vector2f(-25, 40)
            };
            rectUsername = new RectangleShape()
            {
                Size = new Vector2f(150, 20),
                Position = new Vector2f(-25, 10)
            };

            MainGame.window.TextEntered += TextEnteredEvent;
        }
开发者ID:libjared,项目名称:iris,代码行数:28,代码来源:Menu.cs


注:本文中的SFML.Graphics.Texture类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。