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


C# Window.VideoMode类代码示例

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


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


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