Beispiel #1
0
        public VistaPaused()
        {
            var button1 = new Button("return", 0.05f, 0.0f, 0.95f);

            AddEntity(new Background(ResourceTextures.GetGlobalResource(ResourceTextures.Key.Background)));
            AddEntity(new Title("Paused"));
            AddEntity(new CenteredField(0.9f, 0.75f));
            AddEntity(new Logo(ResourceTextures.GetGlobalResource(ResourceTextures.Key.Logo)));
            AddEntity(button1).AsEventSink().WhenMousePressed = ((sender, args) =>
            {
                var rectangle = button1.Field;
                var argument = (MouseButtonEventArgs)args;
                if (rectangle.Contains(argument.X, argument.Y))
                {
                    Engine.Vista = new VistaRunning();
                }
            });
        }
 public VistaRunning()
 {
     AddEntity(new Title("Running"));
     AddEntity(new Logo(ResourceTextures.GetGlobalResource(ResourceTextures.Key.Logo)));
 }
        public VistaMenu()
        {
            OnLoad = ((state, target) =>
            {
                if (count == 0)
                {
                    foreach (var entity in Entities)
                    {
                        if (entity is ITransparent e)
                        {
                            e.Transparency = (PGPercent)0;
                        }
                    }
                }
                foreach (var entity in Entities)
                {
                    if (entity is ITransparent e)
                    {
                        e.Transparency = (PGPercent)((float)e.Transparency + 0.02);
                    }
                }
                count++;
                if (count >= 100)
                {
                    count = 0;
                    OnDraw = DefaultOnDraw;
                }
            });

            OnDraw += OnLoad;

            var button1 = new Button("Continue", 0.05f, 0.3f, 0.1f);
            var button2 = new Button("New", 0.05f, 0.3f, 0.15f);
            var button3 = new Button("Load", 0.05f, 0.3f, 0.2f);
            var button4 = new Button("Settings", 0.05f, 0.3f, 0.25f);
            var bg      = new Background(ResourceTextures.GetGlobalResource(ResourceTextures.Key.Background));
            var title   = new Title("Main Menu");
            var logo    = new Logo(ResourceTextures.GetGlobalResource(ResourceTextures.Key.Logo));
            var field   = new CenteredField(0.4f, 0.8f);

            AddEntity(bg);
            AddEntity(title);
            AddEntity(logo);
            AddEntity(field);
            AddEntity(button1).AsEventSink().WhenMousePressed = ((sender, args) =>
            {
                var rectangle = button1.Field;
                var argument = (MouseButtonEventArgs)args;
                if (rectangle.Contains(argument.X, argument.Y))
                {
                    Engine.Vista = Engine.SP_Running;
                }
            });
            AddEntity(button2).AsEventSink().WhenMousePressed = ((sender, args) =>
            {
                var rectangle = button2.Field;
                var argument = (MouseButtonEventArgs)args;
                if (rectangle.Contains(argument.X, argument.Y))
                {
                    Engine.Vista = new VistaNotImplemented();
                }
            });
            AddEntity(button3).AsEventSink().WhenMousePressed = ((sender, args) =>
            {
                var rectangle = button3.Field;
                var argument = (MouseButtonEventArgs)args;
                if (rectangle.Contains(argument.X, argument.Y))
                {
                    Engine.Vista = new VistaMenuLoad();
                }
            });
            AddEntity(button4).AsEventSink().WhenMousePressed = ((sender, args) =>
            {
                var rectangle = button4.Field;
                var argument = (MouseButtonEventArgs)args;
                if (rectangle.Contains(argument.X, argument.Y))
                {
                    Engine.Vista = new VistaMenuSettings();
                }
            });
        }
Beispiel #4
0
 public VistaStarted()
 {
     AddEntity(new Background(ResourceTextures.GetGlobalResource(ResourceTextures.Key.Background)));
     AddEntity(new Background(textures.GetResource(TextureEnum.background), true, false));
 }