• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Graphics.RenderWindow类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: GameManager

        public GameManager(RenderWindow window, Display startingDisplay)
        {
            this.window = window;

            ActiveDisplay = startingDisplay;
            tex = new RenderTexture(window.Size.X, window.Size.Y);
        }
开发者ID:Sprunth,项目名称:Planetary-Explorers,代码行数:7,代码来源:GameManager.cs


示例2: Client

        public Client(RenderWindow window, ImageManager imageManager)
            : base(window, imageManager)
        {
            this.window = window;
            world = new RenderImage(800, 600);

            inputManager = new InputManager(this);

            ticker = new Ticker();

            window.ShowMouseCursor (false);
            window.SetFramerateLimit (60);

            NetPeerConfiguration netConfiguration = new NetPeerConfiguration("2dThing");
            client = new NetClient(netConfiguration);

            uMsgBuffer = new UserMessageBuffer();
            otherClients = new Dictionary<int, NetworkClient>();
            chat = new Chat(this);

            LoadRessources();

            blockTypeDisplay = new Cube(blockType, imageManager);
            blockTypeDisplay.Position = new Vector2f(window.Width - 2*Cube.WIDTH, window.Height - 2* Cube.HEIGHT);
            layerDisplay = new LayerDisplay(imageManager);
            layerDisplay.Position = blockTypeDisplay.Position - new Vector2f(0, 50);

            mouse = new Sprite (imageManager.GetImage("mouse"));
        }
开发者ID:CyrilPaulus,项目名称:2dThing,代码行数:29,代码来源:Client.cs


示例3: Context

 public Context(RenderWindow window, ResourceHolder<Texture, ResourceID> textures, ResourceHolder<Font, FontID> fonts, Player player) 
 {
     this.window = window;
     this.textures = textures;
     this.fonts = fonts;
     this.player = player;
 }
开发者ID:pixeltasim,项目名称:SFML.NET_Gamedev,代码行数:7,代码来源:State.cs


示例4: CharacterCreationFace

 public CharacterCreationFace(RenderWindow rw, int id, int x, int y)
 {
     _screen = rw;
     ID = id;
     X = x;
     Y = y;
 }
开发者ID:ComposerCookie,项目名称:WanderingSoul,代码行数:7,代码来源:CharacterCreationFace.cs


示例5: PickWorldDeleteButton

 public PickWorldDeleteButton(RenderWindow rw, int id, int x, int y)
 {
     _screen = rw;
     ID = id;
     X = x;
     Y = y;
 }
开发者ID:ComposerCookie,项目名称:WanderingSoul,代码行数:7,代码来源:PickWorldDeleteButton.cs


示例6: MainMenuState

 public MainMenuState(RenderWindow rw)
 {
     GameGUI = new List<GUI>();
     _screen = rw;
     GameGUI.Add(new MainMenuGUI(_screen, 0));
     CurrentGUI = 0;
 }
开发者ID:ComposerCookie,项目名称:WanderingSoul,代码行数:7,代码来源:MainMenuState+(Jacqueline+Tran's+conflicted+copy+2014-10-27).cs


示例7: PickPartyNewParty

 public PickPartyNewParty(RenderWindow rw, int id, int x, int y)
 {
     _screen = rw;
     ID = id;
     X = x;
     Y = y;
 }
开发者ID:ComposerCookie,项目名称:WanderingSoul,代码行数:7,代码来源:PickPartyNewParty.cs


示例8: Draw

 public void Draw(RenderWindow rw)
 {
     for (int i = Animating.Count - 1; i >= 0; i--)
     {
         Animating[i].Draw(rw);
     }
 }
开发者ID:ComposerCookie,项目名称:WanderingSoul,代码行数:7,代码来源:AnimationManager.cs


示例9: NewPartyNewCharacter

 public NewPartyNewCharacter(RenderWindow rw, int id, int x, int y)
 {
     _screen = rw;
     ID = id;
     X = x;
     Y = y;
 }
开发者ID:ComposerCookie,项目名称:WanderingSoul,代码行数:7,代码来源:NewPartyNewCharacter.cs


示例10: RightClickGUI

        public RightClickGUI(RenderWindow rw, int x, int y, int corX, int corY)
        {
            MyButton = new List<GUIButton>();
            _screen = rw;
            ID = -1;
            CurrentButton = 0;
            X = x;
            Y = y;
            Visibility = true;

            MyButton.Add(new RightClickExamineButton(rw, 37, X, Y + MyButton.Count * 20, corX + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinX, corY + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinY));

            if (Logic.CurrentParty.MainParty.MyParty[0].CurMap.SpawnedSpawnableLocation[corY + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinY][corX + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinX] > -1)
            {
                int i = Logic.CurrentParty.MainParty.MyParty[0].CurMap.SpawnedSpawnableLocation[corY + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinY][corX + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinX];
                if (Logic.CurrentParty.MainParty.MyParty[0].CurMap.SpawnedSpawnable[i] is SpawnBuildable)
                {
                    if (Logic.CurrentParty.MainParty.MyParty[0].CurMap.SpawnedSpawnable[i] is SpawnBuildable)
                    {
                        MyButton.Add(new RightClickLitFireButton(rw, 37, X, Y + MyButton.Count * 20, corX + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinX, corY + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinY));
                    }
                }
                else if (Logic.CurrentParty.MainParty.MyParty[0].CurMap.SpawnedSpawnable[i] is SpawnResource)
                {
                    MyButton.Add(new RightClickWalkHarvest(rw, 37, X, Y + MyButton.Count * 20, corX + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinX, corY + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinY));
                }
            }
            if (Logic.CurrentParty.MainParty.MyParty[0].CurMap.SpawnedLivingThing[corY + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinY][corX + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinX].Count > 0)
            {
                MyButton.Add(new RightClickWalkAttack(rw, 37, X, Y + MyButton.Count * 20, corX + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinX, corY + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinY));
            }

            MyButton.Add(new RightClickWalk(rw, 37, X, Y + MyButton.Count * 20, corX + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinX, corY + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinY));
            MyButton.Add(new RightClickPickButton(rw, 37, X, Y + MyButton.Count * 20, corX + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinX, corY + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinY));
        }
开发者ID:ComposerCookie,项目名称:WanderingSoul,代码行数:35,代码来源:RightClickGUI.cs


示例11: 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


示例12: Run

        public void Run()
        {
            window = new RenderWindow(new VideoMode(800, 480), "sfml-ui Examples", Styles.Default);
            window.Closed += window_OnCloseRequest;
            window.Resized += window_Resized;

            uimanager = new UISceneManager();
            uimanager.Init(window);

            scene1 = new Scene(ScrollInputs.None);
            scene1.Size = new Vector2f(window.Size.X, window.Size.Y);
            scene1.AddComponent(new TextControl(new Font("font.ttf"), 50) { Size = new Vector2f(800, 100), Color = Color.White, Text = "Hello World", TextAlignment = Alignment.MiddleCenter, Anchor = AnchorPoints.Left | AnchorPoints.Right | AnchorPoints.Top, BackgroundColor = Colors.SteelBlue });
            scene1.AddComponent(new TextControl(new Font("font.ttf"), 16) { Size = new Vector2f(600, 100), Position = new Vector2f(100, 150), Color = Color.Black, Text = "This is an example of sfml-ui, an ui library for SFML.Net", TextAlignment = Alignment.MiddleCenter, Anchor = AnchorPoints.Left | AnchorPoints.Right | AnchorPoints.Top });
            scene1.AddComponent(new PictureControl("example-100.png") { Size = new Vector2f(100, 100), Position = new Vector2f(0, 0), Anchor = AnchorPoints.Left | AnchorPoints.Top });
            scene1.AddComponent(new ButtonControl(new Font("font.ttf"), 16, "button.png", "button_hover.png", "button_pressed.png") { Size = new Vector2f(150, 49), Position = new Vector2f(50, 250), Anchor = AnchorPoints.Left | AnchorPoints.Top, Text = "Press Me :)" });

            uimanager.CurrentScene = scene1;

            while (window.IsOpen())
            {
                window.DispatchEvents();
                window.Clear(Colors.WhiteSmoke);

                uimanager.Render(window);

                window.Display();
            }
        }
开发者ID:Scellow,项目名称:sfml-ui,代码行数:28,代码来源:Example.cs


示例13: Init

        public static void Init()
        {
            ContextSettings settings = new ContextSettings (32, 8, 4, 3, 3);
              Styles windowStyle = Styles.Close;

              if (FULLSCREEN) {
            windowStyle = Styles.Fullscreen;
            Game.Width = FULLSCREEN_WIDTH;
            Game.Height = FULLSCREEN_HEIGHT;
            Game.CameraWidth = FULLSCREEN_WIDTH;
            Game.CameraHeight = FULLSCREEN_HEIGHT;
              }

              Context = new RenderWindow (new VideoMode ((uint)Game.Width, (uint)Game.Height), WindowTitleText, windowStyle, settings);

              Context.Closed += OnClose;
              Context.KeyPressed += KeyPressed;
              Context.KeyReleased += KeyReleased;
              Context.SetKeyRepeatEnabled (true);

              Rand = new Random ();
              EventMgr = new EventManager ();
              World = new GameWorld ();

              Camera = new View ();
              Camera.Center = new Vector2f (CameraWidth / 2, CameraHeight / 2);
              Camera.Size = new Vector2f (CameraWidth, CameraHeight); // Half Size
              Context.SetView (Camera);
        }
开发者ID:colincapurso,项目名称:GlobalGameJam2013,代码行数:29,代码来源:Game.cs


示例14: MainMenu

        public MainMenu(RenderWindow window, ImageManager imageManager, Client client, Server server)
            : base(window, imageManager)
        {
            imageManager = new ImageManager();
            p = new Player(null, imageManager);
            mouse = new Sprite(imageManager.GetImage("mouse"));
            pImage = new RenderImage(window.Width, window.Height);
            pImage.DefaultView.Zoom(0.08F);
            pImage.DefaultView.Center = p.Center + new Vector2f(0, -30);
            pImage.SetView(pImage.DefaultView);

            this.window = window;
            this.client = client;
            this.server = server;
            items = new MenuItem[nbrItem];
            items[0] = new MenuItem("Local Game", new Vector2f(0, 100), StartLocal);
            items[1] = new MenuItem("Connect", new Vector2f(0, 130), Connect);
            items[2] = new MenuItem("Options", new Vector2f(0, 160), Option);
            items[3] = new MenuItem("Load map", new Vector2f(0, 190), LoadMap);
            items[4] = new MenuItem("Save map", new Vector2f(0, 220), SaveMap);
            items[5] = new MenuItem("Exit", new Vector2f(0, 280), Exit);

            foreach (MenuItem i in items)
                i.CenterX((int)window.Width);
        }
开发者ID:CyrilPaulus,项目名称:2dThing,代码行数:25,代码来源:MainMenu.cs


示例15: PickWorldNewWorld

 public PickWorldNewWorld(RenderWindow rw, int id, int x, int y)
 {
     _screen = rw;
     ID = id;
     X = x;
     Y = y;
 }
开发者ID:ComposerCookie,项目名称:WanderingSoul,代码行数:7,代码来源:PickWorldNewWorld.cs


示例16: Initialize

        static void Initialize()
        {
            Environment.SetEnvironmentVariable("PATH", Environment.GetEnvironmentVariable("PATH") + ";" + Environment.CurrentDirectory + "\\libs");
            dtClock = new Stopwatch();
            textFps = new Text("0", new Font(new FileStream("assets\\fonts\\arial.ttf", FileMode.Open, FileAccess.Read)));
            window = new RenderWindow(new VideoMode(1280, 768), "Test", Styles.Default);
            window.SetFramerateLimit(60);
            window.SetTitle("NATE");
            tiles = new TileManager("assets\\tilemaps\\rpgtiles.png", 32);
            iMap = new MapInterface();
            //map = new Map(new Vector2i(32, 32), ((int)tiles.image.Size.X / tiles.tileSize) * ((int)tiles.image.Size.Y / tiles.tileSize), true); -- for random
            //map = new Map(new Vector2i(32, 32), ((int)tiles.image.Size.X / tiles.tileSize) * ((int)tiles.image.Size.Y / tiles.tileSize), false); -- blank
            map = iMap.ReadMap("map1.ntm");
            
            scaling = new Vector2f(2, 2);
            textureCollection = new Texture[(tiles.image.Size.X / tiles.tileSize) * (tiles.image.Size.Y / tiles.tileSize)];
            camera = new Camera();
            camera.speed = 1000;

            window.Closed += (s, a) => window.Close();
            window.KeyPressed += (s, a) => { if (a.Code == Keyboard.Key.Z) { iMap.WriteMap("map0.ntm", map); } };
            window.MouseWheelMoved += (s, a) => { scaling.X += a.Delta * 0.075f; scaling.Y += a.Delta * 0.075f; };

            dtClock.Start();

            for (int i = 0; i < (tiles.image.Size.X / tiles.tileSize) * (tiles.image.Size.Y / tiles.tileSize); i++)
            {
                textureCollection[i] = tiles.GetTile(i);
                textureCollection[i].Smooth = false;
            }
        }
开发者ID:leontodd,项目名称:NATE,代码行数:31,代码来源:Program.cs


示例17: Draw

 public void Draw(RenderWindow win)
 {
     foreach (Enemy enemy in Enemies)
     {
         enemy.Draw(win);
     }
 }
开发者ID:Greaka,项目名称:RuneShift,代码行数:7,代码来源:EnemyManager.cs


示例18: NewPartyBackButton

 public NewPartyBackButton(RenderWindow rw, int id, int x, int y)
 {
     _screen = rw;
     ID = id;
     X = x;
     Y = y;
 }
开发者ID:ComposerCookie,项目名称:WanderingSoul,代码行数:7,代码来源:NewPartyBackButton.cs


示例19: Main

        public static void Main(string[] args)
        {
            var win = new RenderWindow(new VideoMode(800, 600), "Some Crappy Zombie Thing");
            win.Closed += (sender, e) => win.Close ();
            var curtime = DateTime.Now;
            double dt = 0;
            double frametime;
            win.SetVisible (true);
            EntityManager.Add (new RectangleTestEntity(true));
            EntityManager.Add (new DebugInfo());
            EntityManager.Add (new TileEntity("data/graphics/test_tileset.xml", 0, 1));
            EntityManager.Add (new TileEntity("data/graphics/test_tileset.xml", "45down", new Vector2f(35, 40), 1));
            Entity ent = new Entity();
            ent.OnDraw += (sender, e) => e.Surface.Draw (new Text("Loooooonnnnggg Teeeexxxttt") {Position = new Vector2f(700, 500)});
            EntityManager.Add (ent);
            EntityManager.InitializeWindow (win);

            while(win.IsOpen ())
            {
                win.DispatchEvents();
                EntityManager.Draw (win);
                win.Display ();
                frametime = (DateTime.Now-curtime).TotalMilliseconds;
                dt += frametime;
                while (dt >= EntityManager.TimeStep)
                {
                    //Console.WriteLine (dt.ToString ());
                    EntityManager.Update (dt, frametime);
                    dt -= EntityManager.TimeStep;
                }
                curtime = DateTime.Now;
            }
        }
开发者ID:Phyxius,项目名称:SomeZombieGame,代码行数:33,代码来源:Main.cs


示例20: Core

        public Core(string path)
        {
            // Load Game from file path
            this.Game = ShootEmUpMaker.Serialization.ImportGame(path);

            // Inits
            this.Quit = false;
            this.CurrentSection = ShootEmUp.Enumrations.eSection.MAIN_MENU;

            // Window creation
            var ScreenSizes = new List<Tuple<eOrientation, uint, uint>>();
            ScreenSizes.Add(new Tuple<eOrientation, uint, uint>(eOrientation.HORIZONTAL, 1024, 600));
            ScreenSizes.Add(new Tuple<eOrientation, uint, uint>(eOrientation.VERTICAL, 700, 400));

            uint w = ScreenSizes.Find(a => a.Item1 == this.Game._orientation).Item2;
            uint h = ScreenSizes.Find(a => a.Item1 == this.Game._orientation).Item3;

            this.VideoMode = new VideoMode(w, h, 32);
            this.Window = new RenderWindow(this.VideoMode, this.Game._name);

            // Init events
            this.Window.Closed += new EventHandler(OnClose);
            this.Window.KeyPressed += new EventHandler<KeyEventArgs>(OnKeyPressed);

            //_lastTouch = new Stopwatch();
            //_lastTouch.Start();

            //_lastShot = new Stopwatch();
            //_lastShot.Start();

            //_timer = new Stopwatch();
            //_timer.Start();
            //_background = new Sprite();
        }
开发者ID:CostardRouge,项目名称:ShootEmUpMaker,代码行数:34,代码来源:Core.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Graphics.Shader类代码示例发布时间:2022-05-26
下一篇:
C# Graphics.RenderStates类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap