示例#1
0
        static void Main()
        {
            V.window.SetMouseCursorVisible(false);

            V.window.Closed              += new EventHandler(OnClose);
            V.window.Resized             += new EventHandler <SizeEventArgs>(OnResize);
            V.window.MouseMoved          += new EventHandler <MouseMoveEventArgs>(OnMouseMoved);
            V.window.MouseButtonPressed  += new EventHandler <MouseButtonEventArgs>(OnMouseClicked);
            V.window.MouseButtonReleased += new EventHandler <MouseButtonEventArgs>(OnMouseReleased);
            V.window.MouseWheelScrolled  += new EventHandler <MouseWheelScrollEventArgs>(OnMouseWheel);
            V.window.TextEntered         += new EventHandler <TextEventArgs>(OnTextEntered);
            V.window.KeyPressed          += new EventHandler <SFML.Window.KeyEventArgs>(OnKeyPressed);

            V.ImgLoad();
            windowColor = new Color(255, 255, 255);

            CurrentScreen.Add("login", new LoginState());
            CurrentScreen.Add("intro", new IntroState());
            CurrentScreen.Add("mainmenu", new MainMenuState());
            CurrentScreen.Add("loadfile", new LoadFileState());
            CurrentScreen.Add("config", new ConfigState());
            CurrentScreen.Add("controles", new ControlesState());
            CurrentScreen.Add("joystick", new JoystickState());
            CurrentScreen.Add("createmap", new CreateMapState());
            CurrentScreen.Add("localmap", new LocalMapState());
            CurrentScreen.Add("worldmap", new WorldMapState());
            CurrentScreen.Add("battle", new BattleState());
            CurrentScreen.Add("video", new VideoState());
            CurrentScreen.Add("fimdemo", new FimDemoState());

            CurrentScreen.Set("intro");

            Image image = new Image("res/icon.png");

            V.window.SetIcon(image.Size.X, image.Size.Y, image.Pixels);

            while (V.window.IsOpen)
            {
                V.window.DispatchEvents();
                V.window.Clear(windowColor);

                try{
                    Draw();
                    CurrentScreen.Draw();
                    DrawHUD();
                }
                catch (Exception e) {
                    Console.WriteLine(e);
                }

                V.window.Display();
            }
        }
示例#2
0
        static void Main()
        {
            V.window.SetMouseCursorVisible(false);

            V.window.Closed  += new EventHandler(OnClose);
            V.window.Resized += new EventHandler <SizeEventArgs>(OnResize);

            V.ImgLoad();
            windowColor = new Color(255, 255, 255);

            CurrentScreen.Add("intro", new IntroState());
            CurrentScreen.Add("mainmenu", new MainMenuState());
            CurrentScreen.Add("instrucoes", new InstrucoesState());
            CurrentScreen.Add("credits", new CreditsState());
            CurrentScreen.Add("play", new PlayState());

            CurrentScreen.Set("intro");

            Image image = new Image("res/icon.png");

            V.window.SetIcon(image.Size.X, image.Size.Y, image.Pixels);
            V.window.SetFramerateLimit((uint)120);

            while (V.window.IsOpen)
            {
                V.window.DispatchEvents();
                V.window.Clear(windowColor);

                try{
                    Draw();
                    CurrentScreen.Draw();
                    DrawHUD();
                }
                catch (Exception e) {
                    Console.WriteLine(e);
                }

                V.window.Display();
            }
        }