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

C# Window.VideoMode类代码示例

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

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



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

示例1: Main

        static int Main(string[] args)
        {
            // The Screen or Window
            VideoMode videoMode = new VideoMode(1024, 768);
            RenderWindow window = new RenderWindow(videoMode,
                "Learn SFML");
            window.Closed += new EventHandler(window_Closed);
            window.MouseButtonPressed += new EventHandler<MouseButtonEventArgs>(window_MouseButtonPressed);
            window.MouseMoved += new EventHandler<MouseMoveEventArgs>(window_MouseMoved);
            window.KeyPressed += new EventHandler<KeyEventArgs>(window_KeyPressed);

            Start();

            Console.Out.WriteLine("Engine Started Successfully!");

            while (window.IsOpen()
                && !quit)
            {
                window.DispatchEvents();

                // Draw
                currentScreen.Draw(window);
                window.Display();
            }
            window.Close();

            return 0;
        }
开发者ID:MrPhil,项目名称:LD24,代码行数:28,代码来源:Program.cs


示例2: Game

        public Game(uint width, uint height, string title)
        {
            videoMode = new VideoMode(width, height);
            this.title = title;

            Focused = true;
        }
开发者ID:ilezhnin,项目名称:Roguelike-like-like,代码行数:7,代码来源:Game.cs


示例3: VideoSettings

        public VideoSettings()
        {
            WindowStyle    = Styles.Default; // Titlebar + Resize + Close
            WindowSettings = VideoMode.DesktopMode;

            OpenGLSettings = new ContextSettings();
            RefreshRate    = 30;
        }
开发者ID:MSylvia,项目名称:space-station-14,代码行数:8,代码来源:VideoSettings.cs


示例4: Game

        public Game()
        {
            videoMode = new VideoMode(960, 540);
            title = "SFML Game Window";
            style = Styles.Close;
            context = new ContextSettings();

            ScreenManager = new ScreenManager();
        }
开发者ID:Raptor2277,项目名称:CubePlatformer,代码行数:9,代码来源:Game.cs


示例5: Window

            ////////////////////////////////////////////////////////////
            /// <summary>
            /// Create the window
            /// </summary>
            /// <param name="mode">Video mode to use</param>
            /// <param name="title">Title of the window</param>
            /// <param name="style">Window style (Resize | Close by default)</param>
            /// <param name="settings">Creation parameters</param>
            ////////////////////////////////////////////////////////////
            public Window(VideoMode mode, string title, Styles style, ContextSettings settings) :
                base(IntPtr.Zero)
            {
                 // Copy the title to a null-terminated UTF-32 byte array
                byte[] titleAsUtf32 = System.Text.Encoding.UTF32.GetBytes(title + '\0');

                unsafe
                {
                    fixed (byte* titlePtr = titleAsUtf32)
                    {
                        SetThis(sfWindow_createUnicode(mode, (IntPtr)titlePtr, style, ref settings));
                    }
                }
           }
开发者ID:kenygia,项目名称:SFML.Net,代码行数:23,代码来源:Window.cs


示例6: RenderWindow

            ////////////////////////////////////////////////////////////
            /// <summary>
            /// Create the window
            /// </summary>
            /// <param name="mode">Video mode to use</param>
            /// <param name="title">Title of the window</param>
            /// <param name="style">Window style (Resize | Close by default)</param>
            /// <param name="settings">Creation parameters</param>
            ////////////////////////////////////////////////////////////
            public RenderWindow(VideoMode mode, string title, Styles style, ContextSettings settings) :
                base(IntPtr.Zero, 0)
            {
                 // Copy the string to a null-terminated UTF-32 byte array
                byte[] titleAsUtf32 = Encoding.UTF32.GetBytes(title + '\0');

                unsafe
                {
                    fixed (byte* titlePtr = titleAsUtf32)
                    {
                        CPointer = sfRenderWindow_createUnicode(mode, (IntPtr)titlePtr, style, ref settings);
                    }
                }
                Initialize();
           }
开发者ID:Gitii,项目名称:SFML.Net,代码行数:24,代码来源:RenderWindow.cs


示例7: createWindow

 public override void createWindow(SFML.Window.VideoMode mode, string title, SFML.Window.Styles styles, SFML.Window.ContextSettings context)
 {
     if (fullScreen)
     {
         screenResolution = new Vector2u(VideoMode.DesktopMode.Width, VideoMode.DesktopMode.Height);
         styles = Styles.None;
     }
     else
     {
         styles = Styles.Close;
     }
     //context.AntialiasingLevel = 4;
     title = "Platformer";
     mode = new VideoMode(Game1.screenResolution.X, Game1.screenResolution.Y);
     base.createWindow(mode, title, styles, context);
 }
开发者ID:Raptor2277,项目名称:CubePlatformer,代码行数:16,代码来源:Game1.cs


示例8: Main

        static void Main(string[] args)
        {
            var videoMode = new VideoMode(1000, 700);
            var contextSettings = new ContextSettings(0, 0, 4);
            RenderWindow window = new RenderWindow(videoMode, "Luda Diaria", Styles.Default, contextSettings);
            window.SetActive(true);
            window.Closed += (sender, e) => window.Close();
            Global.Window = window;

            Randomizer.Generator = new Random(42);

            var input = InputManager.Instance;
            input.Init();

            StateManager.Instance.CurrentState = new LoadingState();

            var lastTick = DateTime.Now;
            const float maxTimeStep = 0.5f;

            while (window.IsOpen())
            {
                float dt = (float)((DateTime.Now - lastTick).TotalSeconds);
                lastTick = DateTime.Now;

                window.DispatchEvents();
                window.Clear(Color.Black);

                if (input.IsKeyPressed(Keyboard.Key.Escape))
                {
                    window.Close();
                }

                while (dt > 0)
                {
                    //---UPDATE
                    var deltatTime = dt < maxTimeStep ? dt : maxTimeStep;
                    StateManager.Instance.CurrentState.Update(deltatTime);
                    dt -= maxTimeStep;
                }
                //---DRAW

                StateManager.Instance.CurrentState.Draw(window, RenderStates.Default);
                window.Display();
            }
        }
开发者ID:nikibobi,项目名称:LD26-fail,代码行数:45,代码来源:Program.cs


示例9: Game

        public Game()
        {
            _mode = new VideoMode(768, 540);
            _title = "Bubble Buster";
            _style = Styles.Close;
            _window = new RenderWindow(_mode, _title, _style);

            System.Drawing.Icon icon = ResourceUtility.GetIconResource("ProjectBubbles.Resources.gamepad.ico");
            if (icon != null) {
                _window.SetIcon((uint) icon.Width, (uint) icon.Height, ResourceUtility.GetPixelBytes(icon.ToBitmap()));
            }

            SetupContent();
            Setup();

            _window.Closed += new EventHandler(OnClose);
            _window.MouseButtonPressed += new EventHandler<MouseButtonEventArgs>(MousePressed);
        }
开发者ID:pandadead,项目名称:project-bubbles,代码行数:18,代码来源:Game.cs


示例10: Main

        public static void Main()
        {
            var resolution = new VideoMode(WIDTH, HEIGHT, 32);
            var windowSettings = new ContextSettings(32, 0, 4);
            var window = new RenderWindow(resolution, "Lockheed the Game", Styles.Close, windowSettings);

            window.Closed += Events.OnClose;
            window.KeyPressed += Events.OnKeyPressed;
            window.KeyReleased += Events.OnKeyReleased;
            window.MouseButtonPressed += Events.OnMouseButtonPressed;
            window.SetActive();

            Level.Level newLevel = Level.Level.GenerateSingleLevel();
            Character.Character glava = new Rogue("glava");

            glava.CurrentSkill = new ProjectileSkill(
                "fireball", 10, 10, 10, Tier.Beginner, 5, "weapons/projectiles/fireBall.png", 5);

            EntityManager.CurrentLevel = newLevel;
            EntityManager.Character = glava;

            DateTime lastTick = DateTime.Now;
            while (window.IsOpen())
            {
                float dt = (float)(DateTime.Now - lastTick).TotalMilliseconds;
                lastTick = DateTime.Now;
                window.DispatchEvents();

                while (dt > 0)
                {
                    EntityManager.Update();
                    dt -= MAX_TIMESTEP;
                }

                window.Clear(Color.Black);
                EntityManager.Draw(window);
                window.Display();
            }
        }
开发者ID:StanisInt,项目名称:SoftUniHomeworks,代码行数:39,代码来源:Program.cs


示例11: CluwneWindow

 public CluwneWindow(VideoMode mode, string title, Styles style) : base(mode, title, style)
 {
 }
开发者ID:millpond,项目名称:space-station-14,代码行数:3,代码来源:CluwneWindow.cs


示例12: sfVideoMode_isValid

 private static extern bool sfVideoMode_isValid(VideoMode Mode);
开发者ID:Yozer,项目名称:NanoWar,代码行数:1,代码来源:VideoMode.cs


示例13: LoadWindow

        private void LoadWindow()
        {
            // Determine settings
            var vmode = new VideoMode(
                (uint)Settings.ReadInt("Video", "ResX", 1024),
                (uint)Settings.ReadInt("Video", "ResY", 600),
                24);
            bool fscreen = Settings.ReadInt("Video", "Fullscreen", 0) == 1;
            bool vsync = Settings.ReadInt("Video", "VSync", 1) == 1;

            // Setup the new window
            window = new RenderWindow(vmode, "FTL: Overdrive", fscreen ? Styles.Fullscreen : Styles.Close, new ContextSettings(24, 8, 8));
            window.SetVisible(true);
            window.SetVerticalSyncEnabled(vsync);
            window.MouseMoved += new EventHandler<MouseMoveEventArgs>(window_MouseMoved);
            window.Closed += new EventHandler(window_Closed);
            window.MouseButtonPressed += new EventHandler<MouseButtonEventArgs>(window_MouseButtonPressed);
            window.MouseButtonReleased += new EventHandler<MouseButtonEventArgs>(window_MouseButtonReleased);
            window.KeyPressed += new EventHandler<KeyEventArgs>(window_KeyPressed);
            window.KeyReleased += new EventHandler<KeyEventArgs>(window_KeyReleased);
            window.TextEntered += new EventHandler<TextEventArgs>(window_TextEntered);

            // Init UI
            Canvas = new UI.Canvas();
            var screenrect = Util.ScreenRect(window.Size.X, window.Size.Y, 1.77778f);
            Canvas.X = screenrect.Left;
            Canvas.Y = screenrect.Top;
            Canvas.Width = screenrect.Width;
            Canvas.Height = screenrect.Height;

            // Load icon
            using (var bmp = new System.Drawing.Bitmap(Resource("img/exe_icon.bmp")))
            {
                byte[] data = new byte[bmp.Width * bmp.Height * 4];
                int i = 0;
                for (int y = 0; y < bmp.Height; y++)
                    for (int x = 0; x < bmp.Width; x++)
                    {
                        var c = bmp.GetPixel(x, y);
                        data[i++] = c.R;
                        data[i++] = c.G;
                        data[i++] = c.B;
                        data[i++] = c.A;
                    }
                window.SetIcon((uint)bmp.Width, (uint)bmp.Height, data);
            }
        }
开发者ID:Arovix,项目名称:ftl-overdrive,代码行数:47,代码来源:Root.cs


示例14: sfRenderWindow_Create

 static extern IntPtr sfRenderWindow_Create(VideoMode Mode, string Title, Styles Style, ref ContextSettings Params);
开发者ID:Vizzini,项目名称:netgore,代码行数:1,代码来源:RenderWindow.cs


示例15: Main

        private static void Main(string[] args)
        {
            var form = new SettingsDialog();
            Application.EnableVisualStyles();
            Application.Run(form);
            videoMode = VideoMode.DesktopMode;
            RenderWindow window = new RenderWindow(videoMode, "Maze Crap", Styles.Fullscreen);
            window.EnableVerticalSync(Settings.Default.VerticalSync);
            window.ShowMouseCursor(false);
            window.Closed += (sender, e) => Application.Exit();
            window.KeyPressed += (sender, e) => ((RenderWindow) sender).Close();
            SetUpMaze();
            target = new Image(VideoMode.DesktopMode.Width/10, VideoMode.DesktopMode.Height/10) {Smooth = false};
            float accumulator = 0;
            float WaitTime = 0;
            var fps = (float) Settings.Default.Framerate;
            window.Show(true);
            bool hasrun = false;
            while (window.IsOpened())
            {
                accumulator += window.GetFrameTime();
                while (accumulator > fps)
                {
                    if (FinishedGenerating && !Solving)
                    {
                        if (WaitTime < Settings.Default.WaitTime && hasrun)
                        {
                            WaitTime += window.GetFrameTime();
                        }
                        else
                        {
                            WaitTime = 0;
                            CurrentCell = StartCell*2;
                            VisitedWalls[CurrentCell.X, CurrentCell.Y] = true;
                            CellStack.Clear();
                            Solving = true;
                            hasrun = true;
                        }
                        accumulator -= fps;
                        continue;
                    }
                    if (Solving && FinishedSolving)
                    {
                        if (WaitTime < Settings.Default.WaitTime)
                            WaitTime += window.GetFrameTime();
                        else
                        {
                            Solving = false;
                            FinishedGenerating = false;
                            FinishedSolving = false;
                            SetUpMaze();
                            continue;
                        }
                        continue;
                    }
                    if (Solving && !FinishedSolving)
                    {
                        if (Settings.Default.ShowSolving)
                            FinishedSolving = !SolveIterate(CellStack, Cells, Walls, StartCell, EndCell);
                        else
                        {
                            while (SolveIterate(CellStack, Cells, Walls, StartCell, EndCell)) ;
                            FinishedSolving = true;
                        }
                        accumulator -= fps;
                        continue;
                    }

                    if (Settings.Default.ShowGeneration)
                    {
                        FinishedGenerating = !GenerateIterate(CellStack, Cells, Walls);
                        hasrun = true;
                    }
                    else
                    {
                        while (GenerateIterate(CellStack, Cells, Walls)) ;
                        FinishedGenerating = true;
                    }
                    accumulator -= fps;
                    NeedsRedraw = true;
                }
                Render(window);
                window.Display();
                window.DispatchEvents();
            }
        }
开发者ID:Phyxius,项目名称:Maze-Gen,代码行数:86,代码来源:Program.cs


示例16: SwitchToFullscreen

        /// <summary>
        /// Switches to fullscreen mode.
        /// </summary>
        /// <param name="force">If true, the <see cref="RenderWindow"/> will be recreated even if already in fullscreen mode.</param>
        void SwitchToFullscreen(bool force = false)
        {
            if (!force && _isFullscreen)
                return;

            if (log.IsInfoEnabled)
                log.Info("Changing to fullscreen mode.");

            RenderWindow = null;

            var videoMode = new VideoMode((uint)FullscreenResolution.X, (uint)FullscreenResolution.Y);
            var newRW = new RenderWindow(videoMode, Title, Styles.Fullscreen);

            _isFullscreen = true;
            _usingCustomDisplayContainer = false;
            _displayContainer = null;

            RenderWindow = newRW;
        }
开发者ID:Furt,项目名称:netgore,代码行数:23,代码来源:GameBase.cs


示例17: RenderWindow

 ////////////////////////////////////////////////////////////
 /// <summary>
 /// Create the window with default creation settings
 /// </summary>
 /// <param name="mode">Video mode to use</param>
 /// <param name="title">Title of the window</param>
 /// <param name="style">Window style (Resize | Close by default)</param>
 ////////////////////////////////////////////////////////////
 public RenderWindow(VideoMode mode, string title, Styles style) :
     this(mode, title, style, new ContextSettings(24, 8))
 {
 }
开发者ID:wtfcolt,项目名称:game,代码行数:12,代码来源:RenderWindow.cs


示例18: Init

        private void Init()
        {
            Music = new MusicPlayer();
            Sounds = new SoundManager();
            Assets = new Assets();
            Assets.Load();

            var vm = new SFML.Window.VideoMode(1000, 750, 32);
            var style = Styles.Close;
            var settings = new ContextSettings(0, 0, 8);

            Window = new SFML.Graphics.RenderWindow(vm, "", style, settings);
            Window.SetView(View);
            Window.SetVerticalSyncEnabled(true);
            Window.Closed += (sender, e) => { IsAppExited = true; };
            Window.LostFocus += (sender, e) => { IsPaused = true; };
            Window.GainedFocus += (sender, e) => { IsPaused = false; };
            Window.SetMouseCursorVisible(true);

            var splash = new Space("Splash", true);
            var menu = new Space("Menu");
            var inGame = new Space("InGame");
            var gameOver = new Space("GameOver");

            //  ----- ----- ----- Splash ----- ----- -----

            var images = new SplashImage[]
            {
                new SplashImage(Assets.Textures["sfml"], 3, 1, 1),
                new SplashImage(Assets.Textures["rsas"], 5, 1, 1)
            };

            SplashImage.Prepare(images, e =>
            {
                splash.IsActive = false;
                menu.IsActive = true;
            });

            foreach(var image in images)
                splash.Add(image);

            //  ----- ----- ----- Menu ----- ----- -----
            var btnStart = new MenuButton("Play", 40, new Vector(100, 100));
            var btnQuit = new MenuButton("Quit", 40, new Vector(100, 200));

            var btnDiffEasy = new MenuButton("Easy", 30, new Vector(250, 100));
            var btnDiffMedium = new MenuButton("Medium", 30, new Vector(250, 150));
            var btnDiffHard = new MenuButton("Hard", 30, new Vector(250, 200));

            var infoText =
                "- Instructions -\n" +
                "- Run, shoot and survive as long as possible.\n" +
                "- Collect white powersups to recover health.\n" +
                "- New weapons are unlocked after each 1000 kills.\n" +
                "\n" +
                "- Use WASD keys to move, and mouse to aim and shoot.\n" +
                "- Use the numbers keys to change weapons.\n" +
                "- During gameplay, press ESC to pause or F1 to give up.";
            var btnInfoText = new MenuButton(infoText, 20, new Vector(450, 125));

            var highscoreList = new HighscoreList(new Vector2f(50, 300));

            Difficulty = RSaS.Difficulty.Medium;
            btnDiffMedium.Text.Color = Color.Red;

            btnStart.Click += e =>
            {
                if (IsGameOver)
                {
                    IsGameOver = false;
                    InitInGame(inGame);
                }

                Music.Play("music");
                menu.IsActive = false;
                inGame.IsActive = true;
                IsOSCursorVisible = false;
            };

            btnQuit.Click += e =>
            {
                IsAppExited = true;
            };

            btnDiffEasy.Click += e =>
            {
                if (!IsGameOver)
                    return;

                Difficulty = RSaS.Difficulty.Easy;
                btnDiffEasy.Text.Color = Color.Red;
                btnDiffMedium.Text.Color = Color.White;
                btnDiffHard.Text.Color = Color.White;
            };

            btnDiffMedium.Click += e =>
            {
                if (!IsGameOver)
                    return;

//.........这里部分代码省略.........
开发者ID:Wezthal,项目名称:GameProject,代码行数:101,代码来源:Game.cs


示例19: Game

 public Game(string title, uint width, uint height)
 {
     this.title = title;
     mode = new VideoMode(width, height);
     windowBounds = new FloatRect(new Vector2f(0, 0), new Vector2f(width, height));
 }
开发者ID:snowfox0x,项目名称:2D-Lighting-Sample,代码行数:6,代码来源:Game.cs


示例20: GetVmString

 private string GetVmString(VideoMode vm)
 {
     return vm.Width.ToString() + "x" + vm.Height.ToString() + " @ " + vm.BitsPerPixel+ " hz";
 }
开发者ID:millpond,项目名称:space-station-14,代码行数:4,代码来源:OptionsMenu.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Administracion.Sesion类代码示例发布时间:2022-05-26
下一篇:
C# Window.MouseMoveEventArgs类代码示例发布时间: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