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


C# Graphics.View类代码示例

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


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

示例1: MapRenderer

        public MapRenderer(IntPtr mapRenderWindowHandle, IntPtr tileSetRenderHandle, MapEditor.MapEditorProperties mapEditorProperties)
        {
            _mapRenderWindow = new RenderWindow(mapRenderWindowHandle);
            _tileSetRenderWindow = new RenderWindow(tileSetRenderHandle);
            _mapRenderWindow.MouseButtonPressed += mapRenderWindow_MouseButtonPressed;
            _mapRenderWindow.MouseMoved += mapRenderWindow_MouseMoved;
            _tileSetRenderWindow.MouseButtonPressed += tileSetRenderWindow_MouseButtonPressed;
            _tileSetRenderWindow.MouseMoved += tileSetRenderWindow_MouseMoved;
            _tileSetRenderWindow.MouseButtonReleased += tileSetRenderWindow_MouseButtonReleased;

            _mapEditorProperties = mapEditorProperties;
            _mapEditorProperties.CurrentLayer = World.Map.Layers.Ground;
            _mapEditorProperties.MapView = new View(this._mapRenderWindow.DefaultView);

            _mousePositionText = new Text("", new Font(AppDomain.CurrentDomain.BaseDirectory + "/Data/Graphics/Fonts/MainFont.ttf"), 20);

            this.LoadTileSets();

            _tileSetView = this._tileSetRenderWindow.DefaultView;

            this.Running = true;

            this._mapRenderWindow.SetActive(false);
            this._tileSetRenderWindow.SetActive(false);

            new Thread(UpdateLoop).Start();
        }
开发者ID:JohnLamontagne,项目名称:CEngineSharp,代码行数:27,代码来源:MapRenderer.cs

示例2: Main

        static void Main(string[] args)
        {
            // initialize window and view
            win = new RenderWindow(new VideoMode(1000, 700), "Hadoken!!!");
            view = new View();
            resetView();
            gui = new GUI(win, view);

            // exit Program, when window is being closed
            //win.Closed += new EventHandler(closeWindow);
            win.Closed += (sender, e) => { (sender as Window).Close(); };

            // initialize GameState
            handleNewGameState();

            // initialize GameTime
            GameTime gameTime = new GameTime();
            gameTime.Start();

            // debug Text
            Text debugText = new Text("debug Text", new Font("Fonts/calibri.ttf"));

            while (running && win.IsOpen())
            {
                KeyboardInputManager.update();

                currentGameState = state.update();

                // gather draw-stuff
                win.Clear(new Color(100, 149, 237));    //cornflowerblue ftw!!! 1337
                state.draw(win, view);
                state.drawGUI(gui);

                // first the state must be drawn, before I can change the currentState
                if (currentGameState != prevGameState)
                {
                    handleNewGameState();
                }

                // do the actual drawing
                win.SetView(view);
                win.Display();

                // check for window-events. e.g. window closed        
                win.DispatchEvents();

                // update GameTime
                gameTime.Update();
                float deltaTime = (float)gameTime.EllapsedTime.TotalSeconds;

                // idleLoop for fixed FrameRate
                float deltaPlusIdleTime = deltaTime;
                while (deltaPlusIdleTime < (1F / fixedFps))
                {
                    gameTime.Update();
                    deltaPlusIdleTime += (float)gameTime.EllapsedTime.TotalSeconds;
                }
                Console.WriteLine("real fps: " + (int)(1F / deltaPlusIdleTime) + ", theo fps: " + (int)(1F / deltaTime));
            }
        }
开发者ID:Greaka,项目名称:RuneShift,代码行数:60,代码来源:Program.cs

示例3: SetupGrid

        private void SetupGrid(Vector2u mapSize)
        {
            const int gridSize = 16;
            _gridTexture = new RenderTexture(2000, 2000);
            var col = new Color(120, 120, 120);
            var verticies = new List<Vertex>();
            for (int x = 0; x < mapSize.X; x += gridSize)
            {
                verticies.Add(new Vertex(new Vector2f(x, 0), col));
                verticies.Add(new Vertex(new Vector2f(x, mapSize.Y), col));
            }
            for (int y = 0; y < mapSize.Y; y += gridSize)
            {
                verticies.Add(new Vertex(new Vector2f(0, y), col));
                verticies.Add(new Vertex(new Vector2f(mapSize.X, y), col));
            }
            _gridlines = verticies.ToArray();

            _gridTexture.Clear(new Color(190, 190, 190));
            //_view = new View(new FloatRect(0,0,displaySize.X, displaySize.Y));
            _view = new View(new FloatRect(0, 0, DisplayView.Size.X, DisplayView.Size.Y));
            DisplayView = _view;
            //_gridTexture.SetView(_view);
            _gridTexture.Draw(_gridlines, PrimitiveType.Lines);
            _gridTexture.Display();

            _grid = new Sprite(_gridTexture.Texture);
            AddItemToDraw(_grid, 0);
        }
开发者ID:Sprunth,项目名称:Planetary-Explorers,代码行数:29,代码来源:SpaceMap.cs

示例4: CluwneView

 public CluwneView(CluwneWindow window)
 {
     this._window = window;
     _worldView = new View(new FloatRect(0.0f, 0.0f, window.Size.X, window.Size.Y));
     _interfaceView = new View(new FloatRect(0.0f, 0.0f, window.Size.X, window.Size.Y));
     window.SetView(_worldView);
 }
开发者ID:millpond,项目名称:space-station-14,代码行数:7,代码来源:CluwneView.cs

示例5: Init

 public override void Init(Entity entity)
 {
     base.Init(entity);
     camera = new View(Target.Transform.Position, Global.Screen);
     camera.Zoom(2f);
     //camera.Rotate(45f);
 }
开发者ID:nikibobi,项目名称:LD26-fail,代码行数:7,代码来源:Camera.cs

示例6: Camera

        public Camera(GameWindow mGameWindow, int mWidth, int mHeight)
        {
            Debug.Assert(mGameWindow != null);

            _renderWindow = mGameWindow.RenderWindow;
            View = new View(new FloatRect(0, 0, mWidth, mHeight));
        }
开发者ID:Scellow,项目名称:SFMLStart,代码行数:7,代码来源:Camera.cs

示例7: ViewAnimateSprite

 public ViewAnimateSprite(IntPtr handle)
 {
     _animatedSpriteViewer = new RenderWindow(handle);
     _view = new View(new FloatRect(0, 0, Editor.Instance.curGame.TileX, Editor.Instance.curGame.TileY));
     _curFrame = 0;
     _animatedSpriteViewer.SetView(_view);
 }
开发者ID:ComposerCookie,项目名称:JRPDragon,代码行数:7,代码来源:ViewAnimateSprite.cs

示例8: Camera

 public Camera(View view)
 {
     View = new View(view);
     Position = View.Size / 2;
     originalSize = View.Size;
     ActualPosition = Position;
 }
开发者ID:DatZach,项目名称:Californium,代码行数:7,代码来源:Camera.cs

示例9: RenderImage

 ////////////////////////////////////////////////////////////
 /// <summary>
 /// Create the render image with the given dimensions and
 /// an optional depth-buffer attached
 /// </summary>
 /// <param name="width">Width of the render image</param>
 /// <param name="height">Height of the render image</param>
 /// <param name="depthBuffer">Do you want a depth-buffer attached?</param>
 ////////////////////////////////////////////////////////////
 public RenderImage(uint width, uint height, bool depthBuffer) :
     base(sfRenderImage_Create(width, height, depthBuffer))
 {
     myDefaultView = new View(sfRenderImage_GetDefaultView(This));
     myImage       = new Image(sfRenderImage_GetImage(This));
     GC.SuppressFinalize(myDefaultView);
     GC.SuppressFinalize(myImage);
 }
开发者ID:wtfcolt,项目名称:game,代码行数:17,代码来源:RenderImage.cs

示例10: RenderTexture

 ////////////////////////////////////////////////////////////
 /// <summary>
 /// Create the render-texture with the given dimensions and
 /// an optional depth-buffer attached
 /// </summary>
 /// <param name="width">Width of the render-texture</param>
 /// <param name="height">Height of the render-texture</param>
 /// <param name="depthBuffer">Do you want a depth-buffer attached?</param>
 ////////////////////////////////////////////////////////////
 public RenderTexture(uint width, uint height, bool depthBuffer) :
     base(sfRenderTexture_create(width, height, depthBuffer))
 {
     myDefaultView = new View(sfRenderTexture_getDefaultView(CPointer));
     myTexture = new Texture(sfRenderTexture_getTexture(CPointer));
     GC.SuppressFinalize(myDefaultView);
     GC.SuppressFinalize(myTexture);
 }
开发者ID:Furt,项目名称:netgore,代码行数:17,代码来源:RenderTexture.cs

示例11: ExploringState

 public ExploringState()
 {
     //Pretty loading here
     map = new TileMap();
     player = new PlayerCharacter(map, new Vector2i(15,15));
     exploringView = new View(Program.Window.GetView());
     defaultView = Program.Window.DefaultView;
 }
开发者ID:Blezzing,项目名称:Orbs,代码行数:8,代码来源:ExploringState.cs

示例12: IngameShipState

 public IngameShipState(WindowManager WM)
     : base(WM)
 {
     CurrentMap = new IngameObjects.NetworkWorld(this);
     GameView = new View();
     //WM.AddWindow(new Windows.MainMenu(WM, this, 100, 100, 250, 200));
     Chat = new Windows.ChatBox(WM, this, 100, 100, 250, 200);
     WM.AddWindow(Chat);
 }
开发者ID:Tricon2-Elf,项目名称:SpaceHybridTest,代码行数:9,代码来源:IngameShipState.cs

示例13: Run

        public void Run()
        {
            TextureLoader.Init();

            Window = new RenderWindow(videoMode, title, Styles.Close);
            States = new RenderStates(RenderStates.Default);

            Window.Closed += (s, e) =>
            {
                Console.WriteLine("Closing...");
                Window.Close();
            };

            Window.SetVerticalSyncEnabled(true);

            defaultView = Window.DefaultView;
            gameView = Window.DefaultView;
            gameView.Viewport = new FloatRect(0, 0, .85f, .85f);

            BackgroundColor = new Color(100, 149, 237); // dat cornflower blue
            Tilemap = new Tilemap(this);

            SelectedTileID = 1;

            var timer = new Stopwatch();
            while (Window.IsOpen)
            {
                timer.Restart();

                Window.DispatchEvents();

                var mouse = Mouse.GetPosition(Window);

                //if (Mouse.IsButtonPressed(Mouse.Button.Right))
                //    gameView.Move(new Vector2f(prevMouse.X - mouse.X, prevMouse.Y - mouse.Y));

                Tilemap.Update(Frametime);

                Window.Clear(BackgroundColor);

                Window.SetView(gameView);
                Tilemap.Draw(Window, States);
                Window.SetView(defaultView);

                Debug.Draw(Window);

                Window.Display();

                prevMouse = mouse;

                timer.Stop();
                Frametime = (float)timer.Elapsed.TotalMilliseconds;
                Window.SetTitle($"{title} ({(1d / timer.Elapsed.TotalSeconds):0}fps)");
            }
        }
开发者ID:Spanfile,项目名称:LD33,代码行数:55,代码来源:Game.cs

示例14: Main

        public static void Main(string[] args)
        {
            Window = new RenderWindow(new VideoMode(640, 480), "", Styles.Close);
            Window.SetFramerateLimit(60);

            Window.Closed += (sender, eventArgs) => Window.Close();

            Window.Resized += (sender, eventArgs) =>
            {
                var view = new View();
                view.Size = new Vector2f(eventArgs.Width, eventArgs.Height);
                view.Center = view.Size / 2;
                Window.SetView(view);
            };

            Machine = new VirtualMachine(512 * 1024);

            var prog = File.ReadAllBytes("bios.bin");
            for (var i = 0; i < prog.Length; i++)
                Machine.Memory[i] = prog[i];

            var kbd = new Devices.Keyboard(0x02, Window);
            Machine.Attach(kbd);

            var display = new Devices.Display(0x06, Machine, Window);
            Machine.Attach(display);

            var hdd = new Devices.HardDrive(0x08, "disk.img");
            Machine.Attach(hdd);

            var running = true;

            var stepThread = new Thread(() =>
            {
                while (running)
                {
                    Machine.Step();
                }
            });

            stepThread.Start();

            while (Window.IsOpen())
            {
                Window.DispatchEvents();

                Window.Clear();
                Window.Draw(display);
                Window.Display();
            }

            running = false;
            stepThread.Join();
            Machine.Dispose();
        }
开发者ID:Rohansi,项目名称:LoonyVM,代码行数:55,代码来源:Program.cs

示例15: Initialize

        public void Initialize()
        {
            world = (LayeredWorld)WorldManager.Worlds["first_world"];

            view = new View(new Vector2f(100, 0), new Vector2f(50, 50));
            view.Zoom(10);

            player = new Player(world.PlayerStartPosition);

            Program.RenderWindow.KeyPressed += RenderWindow_KeyPressed;
        }
开发者ID:Chiheb2013,项目名称:GameLibs,代码行数:11,代码来源:TopViewMapState.cs


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