コード例 #1
0
ファイル: Game.cs プロジェクト: ilezhnin/Roguelike-like-like
        public Game(uint width, uint height, string title)
        {
            videoMode = new VideoMode(width, height);
            this.title = title;

            Focused = true;
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: MrPhil/LD24
        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;
        }
コード例 #3
0
        public VideoSettings()
        {
            WindowStyle    = Styles.Default; // Titlebar + Resize + Close
            WindowSettings = VideoMode.DesktopMode;

            OpenGLSettings = new ContextSettings();
            RefreshRate    = 30;
        }
コード例 #4
0
ファイル: Game.cs プロジェクト: Raptor2277/CubePlatformer
        public Game()
        {
            videoMode = new VideoMode(960, 540);
            title = "SFML Game Window";
            style = Styles.Close;
            context = new ContextSettings();

            ScreenManager = new ScreenManager();
        }
コード例 #5
0
        public MainWindow()
        {
            var mode = new SFML.Window.VideoMode(1366, 768);

            this.Window = new SFML.Graphics.RenderWindow(SFML.Window.VideoMode.DesktopMode, "Astrategia", Styles.Fullscreen);
            //this.Window = new SFML.Graphics.RenderWindow(mode, "Astrategia");
            this.Window.SetVerticalSyncEnabled(true);

            this.World = new World();

            this.World2D = new World2D(this);

            this.WorldAI = new AIWorld(this);
        }
コード例 #6
0
        ////////////////////////////////////////////////////////////
        /// <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 = Encoding.UTF32.GetBytes(title + '\0');

            unsafe
            {
                fixed(byte *titlePtr = titleAsUtf32)
                {
                    CPointer = sfWindow_createUnicode(mode, (IntPtr)titlePtr, style, ref settings);
                }
            }
        }
コード例 #7
0
ファイル: Window.cs プロジェクト: kenygia/SFML.Net
            ////////////////////////////////////////////////////////////
            /// <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));
                    }
                }
           }
コード例 #8
0
ファイル: RenderWindow.cs プロジェクト: Gitii/SFML.Net
            ////////////////////////////////////////////////////////////
            /// <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();
           }
コード例 #9
0
ファイル: Game1.cs プロジェクト: Raptor2277/CubePlatformer
 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);
 }
コード例 #10
0
ファイル: Game.cs プロジェクト: DemoXinMC/SFXT
        private void CreateWindow()
        {
            Window?.Close();

            var videoMode = new SFML.Window.VideoMode((uint)this.Dimensions.X, (uint)this.Dimensions.Y);

            Window          = new SFML.Graphics.RenderWindow(videoMode, this.Title, this.Fullscreen ? SFML.Window.Styles.Fullscreen : SFML.Window.Styles.None);
            Window.Position = this.Location == null ? this.Location : new Vector2i((int)Math.Floor(((double)SFML.Window.VideoMode.DesktopMode.Width / 2) - (videoMode.Width / 2)), (int)Math.Floor(((double)SFML.Window.VideoMode.DesktopMode.Height / 2) - (videoMode.Height / 2)));

            if (FPS > 0)
            {
                Window.SetFramerateLimit(FPS);
            }

            WindowCreated?.Invoke(videoMode.Width, videoMode.Height);
            Window.Display();
        }
コード例 #11
0
ファイル: Program.cs プロジェクト: nikibobi/LD26-fail
        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();
            }
        }
コード例 #12
0
ファイル: Game.cs プロジェクト: pandadead/project-bubbles
        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);
        }
コード例 #13
0
        public void Run()
        {
            var mode   = new SFML.Window.VideoMode(WindowX, WindowY);
            var window = new SFML.Graphics.RenderWindow(mode, "Point Wrapper");

            window.KeyPressed += Window_KeyPressed;

            while (window.IsOpen)
            {
                window.DispatchEvents();
                for (int counter = 0; counter < drawables.Length; counter++)
                {
                    if (drawables[counter] != null)
                    {
                        window.Draw(drawables[counter]);
                    }
                }
                window.Display();
            }
        }
コード例 #14
0
ファイル: Program.cs プロジェクト: StanisInt/SoftUniHomeworks
        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();
            }
        }
コード例 #15
0
        static void Main(string[] args)
        {
            var mode   = new SFML.Window.VideoMode(800, 600);
            var window = new SFML.Graphics.RenderWindow(mode, "SFML works!");
            //window.KeyPressed += Window_KeyPressed;

            var circle = new SFML.Graphics.CircleShape(100f)
            {
                FillColor = SFML.Graphics.Color.Blue
            };

            // Start the game loop
            while (window.IsOpen)
            {
                // Process events
                window.DispatchEvents();
                window.Draw(circle);

                // Finally, display the rendered frame on screen
                window.Display();
            }
        }
コード例 #16
0
ファイル: Window.cs プロジェクト: kenygia/SFML.Net
 ////////////////////////////////////////////////////////////
 /// <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 Window(VideoMode mode, string title, Styles style) :
     this(mode, title, style, new ContextSettings(0, 0))
 {
 }
コード例 #17
0
 public CluwneWindow(VideoMode mode, string title, Styles style, ContextSettings settings) : base(mode, title, style, settings)
 {
 }
コード例 #18
0
ファイル: Program.cs プロジェクト: Phyxius/Maze-Gen
        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();
            }
        }
コード例 #19
0
        public void Run()
        {
            var mode = new SFML.Window.VideoMode(800, 600);
            //var window = new SFML.Graphics.RenderWindow(SFML.Window.VideoMode.FullscreenModes[0], "Pokemon Union", SFML.Window.Styles.Fullscreen);
            var window = new SFML.Graphics.RenderWindow(mode, "Pokemon Union");

            window.KeyPressed += Window_KeyPressed;

            window.MouseButtonPressed  += OnMouseButtonPressed;
            window.MouseButtonReleased += OnMouseButtonReleased;
            window.MouseMoved          += OnMouseMoved;

            //this.object2DManager.SizeScreen = window.GetView().Size;


            SFML.Graphics.View view = window.GetView();

            view.Size = new Vector2f(400, 300);

            this.resolutionScreen = new Vector2f(view.Size.X, view.Size.Y);
            view.Center           = new Vector2f(9492, -12595);
            this.SetView(window, view);

            window.SetVerticalSyncEnabled(true);

            Clock clock = new Clock();

            this.landWorld.OnFocusAreaChanged(view.Center / MODEL_TO_VIEW, this.resolutionScreen / MODEL_TO_VIEW);

            // Start the game loop
            while (window.IsOpen)
            {
                Time deltaTime = clock.Restart();

                // Game logic update
                this.landWorld.UpdateLogic(null, deltaTime);

                // Draw window
                AObject2D.UpdateZoomAnimationManager(deltaTime);

                window.Clear();

                this.landWorld2D.DrawIn(window, ref this.boundsView);

                // Process events
                window.DispatchEvents();


                //// To remove after.
                //if (Keyboard.IsKeyPressed(Keyboard.Key.Z))
                //{
                //    view.Center += new Vector2f(0, -2f);
                //}
                //else if(Keyboard.IsKeyPressed(Keyboard.Key.S))
                //{
                //    view.Center += new Vector2f(0, 2f);
                //}

                //if (Keyboard.IsKeyPressed(Keyboard.Key.D))
                //{
                //    view.Center += new Vector2f(2f, 0);
                //}
                //else if (Keyboard.IsKeyPressed(Keyboard.Key.Q))
                //{
                //    view.Center += new Vector2f(-2f, 0);
                //}
                //// Console.WriteLine(view.Center.X + " : " + view.Center.Y);

                //this.landWorld.OnFocusAreaChanged(view.Center / MODEL_TO_VIEW, this.resolutionScreen / MODEL_TO_VIEW, 0);

                //this.SetView(window, view);

                // Finally, display the rendered frame on screen
                window.Display();
            }

            this.landWorld2D.Dispose(this.landWorld);
            this.landWorld.Dispose();

            AObject2D.StopAnimationManager();
        }
コード例 #20
0
ファイル: RenderWindow.cs プロジェクト: Vizzini/netgore
 ////////////////////////////////////////////////////////////
 /// <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(sfRenderWindow_Create(mode, title, style, ref settings), 0)
 {
     Initialize();
 }
コード例 #21
0
ファイル: GameBase.cs プロジェクト: Furt/netgore
        /// <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;
        }
コード例 #22
0
ファイル: GameBase.cs プロジェクト: Furt/netgore
        /// <summary>
        /// Switches to windowed mode.
        /// </summary>
        /// <param name="force">If true, the <see cref="RenderWindow"/> will be recreated even if already in windowed mode.</param>
        void SwitchToWindowed(bool force = false)
        {
            if (!force && !_isFullscreen)
                return;

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

            RenderWindow = null;

            RenderWindow newRW;

            // Get the new display container
            var displayHandle = CreateWindowedDisplayHandle(out _displayContainer);

            if (displayHandle == IntPtr.Zero)
            {
                // Not using custom handle
                _usingCustomDisplayContainer = false;
                _displayContainer = null;
                var videoMode = new VideoMode((uint)WindowedResolution.X, (uint)WindowedResolution.Y);
                newRW = new RenderWindow(videoMode, Title, Styles.Titlebar | Styles.Close);
                _callEnterAppRun = false;
            }
            else
            {
                // Using custom handle
                _usingCustomDisplayContainer = true;
                newRW = new RenderWindow(displayHandle);
                _callEnterAppRun = true;
            }

            _isFullscreen = false;

            RenderWindow = newRW;
        }
コード例 #23
0
 ////////////////////////////////////////////////////////////
 /// <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(sfWindow_create(mode, title, style, ref settings))
 {
 }
コード例 #24
0
ファイル: MainForm.cs プロジェクト: Roger08/unpointzerosharp
 internal static void Create(VideoMode videoMode, string title)
 {
     renderWindow = new RenderWindow(videoMode, title);
 }
コード例 #25
0
ファイル: Game.cs プロジェクト: snowfox0x/2D-Lighting-Sample
 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));
 }
コード例 #26
0
ファイル: Game.cs プロジェクト: Wezthal/GameProject
        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;

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

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

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

            menu.Add(btnStart);
            menu.Add(btnQuit);
            menu.Add(btnDiffEasy);
            menu.Add(btnDiffMedium);
            menu.Add(btnDiffHard);
            menu.Add(btnInfoText);
            menu.Add(highscoreList);
        }
コード例 #27
0
 ////////////////////////////////////////////////////////////
 /// <summary>
 /// Create the window with default style and creation settings
 /// </summary>
 /// <param name="mode">Video mode to use</param>
 /// <param name="title">Title of the window</param>
 ////////////////////////////////////////////////////////////
 public Window(VideoMode mode, string title) :
     this(mode, title, Styles.Default, new ContextSettings(24, 8))
 {
 }
コード例 #28
0
ファイル: Window.cs プロジェクト: havenow/vbam-libretro
 ////////////////////////////////////////////////////////////
 /// <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 Window(VideoMode mode, string title, Styles style) :
     this(mode, title, style, new WindowSettings(24, 8, 0))
 {
 }
コード例 #29
0
ファイル: Window.cs プロジェクト: wtfcolt/game
 ////////////////////////////////////////////////////////////
 /// <summary>
 /// Create the window with default style and creation settings
 /// </summary>
 /// <param name="mode">Video mode to use</param>
 /// <param name="title">Title of the window</param>
 ////////////////////////////////////////////////////////////
 public Window(VideoMode mode, string title) :
     this(mode, title, Styles.Default, new ContextSettings(24, 8))
 {
 }
コード例 #30
0
ファイル: Window.cs プロジェクト: havenow/vbam-libretro
 ////////////////////////////////////////////////////////////
 /// <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, WindowSettings settings) :
     base(sfWindow_Create(mode, title, style, settings))
 {
     myInput = new Input(sfWindow_GetInput(This));
 }
コード例 #31
0
ファイル: Root.cs プロジェクト: Arovix/ftl-overdrive
        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);
            }
        }
コード例 #32
0
ファイル: RenderWindow.cs プロジェクト: Vizzini/netgore
 /// <summary>
 /// Create the window with default style and creation settings
 /// </summary>
 /// <param name="mode">Video mode to use</param>
 /// <param name="title">Title of the window</param>
 ////////////////////////////////////////////////////////////
 public RenderWindow(VideoMode mode, string title) : this(mode, title, Styles.Default, new ContextSettings(0, 0))
 {
 }
コード例 #33
0
 ////////////////////////////////////////////////////////////
 /// <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 Window(VideoMode mode, string title, Styles style) :
     this(mode, title, style, new ContextSettings(0, 0))
 {
 }
コード例 #34
0
ファイル: RenderWindow.cs プロジェクト: Vizzini/netgore
 static extern IntPtr sfRenderWindow_Create(VideoMode Mode, string Title, Styles Style, ref ContextSettings Params);
コード例 #35
0
 static extern IntPtr sfWindow_createUnicode(VideoMode Mode, IntPtr Title, Styles Style, ref ContextSettings Params);
コード例 #36
0
ファイル: VideoMode.cs プロジェクト: Yozer/NanoWar
 private static extern bool sfVideoMode_isValid(VideoMode Mode);
コード例 #37
0
ファイル: Window.cs プロジェクト: hlepps/LTD.NET
        public Window()
        {
            var mode = new SFML.Window.VideoMode((uint)Engine.conf.screenWidth, (uint)Engine.conf.screenHeight);

            renderWindow = new SFML.Graphics.RenderWindow(mode, "LTD", Styles.Close);
        }
コード例 #38
0
ファイル: VideoMode.cs プロジェクト: yCatDev/Minima
 static extern bool sfVideoMode_isValid(VideoMode Mode);
コード例 #39
0
ファイル: Window.cs プロジェクト: Furt/netgore
 ////////////////////////////////////////////////////////////
 /// <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(sfWindow_create(mode, title, style, ref settings))
 {
 }
コード例 #40
0
        static void Main(string[] args)
        {
            Console.WriteLine("Enter your fleet Name");
            string fleet = Console.ReadLine();
            Player p     = new Player(fleet);

            game = new Game("battleship", "NBCC", p, fleet);
            var mode   = new SFML.Window.VideoMode(1000, 600);
            var window = new SFML.Graphics.RenderWindow(mode, "SFML works!");

            game.me.Battlefield.Ready += Battlefield_Ready;
            game.OpponentFound        += Game_OpponentFound;
            game.Lost += Game_Lost;
            game.Won  += Game_Won;
            //game.me.Battlefield.Ready += Battlefield_Ready;
            window.SetFramerateLimit(60);
            //m.connect();
            //window.MouseMoved += Window_MouseMoved;
            window.MouseButtonPressed += Window_MouseButtonPressed;
            //m.gotHit += M_gotHit;

            //window.KeyPressed += Window_KeyPressed;

            //var circle = new SFML.Graphics.CircleShape(100f)
            //{
            //    FillColor = SFML.Graphics.Color.Blue
            //};


            // Start the game loop



            mainName.Font            = main;
            mainName.DisplayedString = game.me.Battlefield.Name;
            mainName.CharacterSize   = 65;
            mainName.FillColor       = Color.Green;
            mainName.Position        = new Vector2f(PLAYER_START_X, PLAYER_START_Y - mainName.CharacterSize - 20);


            mainStatus.Font            = main;
            mainStatus.DisplayedString = game.me.Status.ToString();
            mainStatus.CharacterSize   = 40;
            mainStatus.FillColor       = Color.Yellow;
            mainStatus.Position        = new Vector2f(PLAYER_START_X + (SQUARE_SIZE + SPACING_SIZE) * 6, PLAYER_START_Y - mainName.CharacterSize - 20);



            initEmptyField(fieldMain);
            initEmptyField(fieldOpponent);

            DrawBattlefield(game.me.Battlefield, PLAYER_START_X, PLAYER_START_Y, fieldMain);
            //DrawBattlefield(game.opponent.Battlefield, OPPONENT_START_X, OPPONENT_START_Y, fieldOpponent);


            while (window.IsOpen)
            {
                window.Clear();
                // Process events

                window.DispatchEvents();

                Field f = GetMouseField(Mouse.GetPosition(window));
                switch (f.Player)
                {
                case 1:
                    fieldMain[f.X, f.Y].FillColor = Color.White;
                    break;

                case 2:
                    fieldOpponent[f.X, f.Y].FillColor = Color.White;
                    break;

                default:
                    DrawBattlefield(game.me.Battlefield, PLAYER_START_X, PLAYER_START_Y, fieldMain);
                    if (gameRunning)
                    {
                        DrawBattlefield(game.opponent.Battlefield, OPPONENT_START_X, OPPONENT_START_Y, fieldOpponent);
                    }
                    break;
                }
                //window.Draw(circle);
                if (!(game.opponent is null))        //change to check if ene,y present
                {
                    DisplayBF(window, fieldOpponent, SIZE, opponentName, opponentStatus);
                }
                DisplayBF(window, fieldMain, SIZE, mainName, mainStatus);
                DrawShips(window);
                if (chosenShip != null)
                {
                    DrawShip(Mouse.GetPosition(window), window, chosenShip, Color.Red);
                }
                // Finally, display the rendered frame on screen

                window.Display();
            }
        }
コード例 #41
0
 private string GetVmString(VideoMode vm)
 {
     return vm.Width.ToString() + "x" + vm.Height.ToString() + " @ " + vm.BitsPerPixel+ " hz";
 }
コード例 #42
0
 public CluwneWindow(VideoMode mode, string title, Styles style) : base(mode, title, style)
 {
 }
コード例 #43
0
ファイル: RenderWindow.cs プロジェクト: wtfcolt/game
 ////////////////////////////////////////////////////////////
 /// <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))
 {
 }
コード例 #44
0
ファイル: Window.cs プロジェクト: kenygia/SFML.Net
 static extern IntPtr sfWindow_createUnicode(VideoMode Mode, IntPtr Title, Styles Style, ref ContextSettings Params);
コード例 #45
0
ファイル: Window.cs プロジェクト: havenow/vbam-libretro
 static extern IntPtr sfWindow_Create(VideoMode Mode, string Title, Styles Style, WindowSettings Params);
コード例 #46
0
ファイル: Window.cs プロジェクト: wtfcolt/game
 ////////////////////////////////////////////////////////////
 /// <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(sfWindow_Create(mode, title, style, ref settings))
 {
     myInput = new Input(sfWindow_GetInput(This));
 }
コード例 #47
0
 static VideoMode()
 {
     // TODO: no const size
     CanvasMode = new VideoMode(320, 200);
 }