Ejemplo n.º 1
0
        public MainMenuView()
        {
            scene = new Scene(ScrollInputs.None);

            (playButton = new FastButton(new Font("Content/font.ttf"), 22, "Content/button.png", "Content/button_hover.png", "Content/button_pressed.png")
            {
                Position = new Vector2f(500, 200),
                Size = new Vector2f(280, 49),
                Text = "Play",
                Anchor = AnchorPoints.Left | AnchorPoints.Top
            }).OnClick += PlayButton_OnClick;

            (settingsButton = new FastButton(new Font("Content/font.ttf"), 22, "Content/button.png", "Content/button_hover.png", "Content/button_pressed.png")
            {
                Position = new Vector2f(500, 260),
                Size = new Vector2f(280, 49),
                Text = "Settings",
                Anchor = AnchorPoints.Left | AnchorPoints.Top
            }).OnClick += SettingsButton_OnClick;

            (quitButton = new FastButton(new Font("Content/font.ttf"), 22, "Content/button.png", "Content/button_hover.png", "Content/button_pressed.png")
            {
                Position = new Vector2f(500, 320),
                Size = new Vector2f(280, 49),
                Text = "Quit",
                Anchor = AnchorPoints.Left | AnchorPoints.Top
            }).OnClick += QuitButton_OnClick;

            scene.AddComponent(playButton);
            scene.AddComponent(settingsButton);
            scene.AddComponent(quitButton);

            particles = new IndexedParticleSystem();
            particle = new Sprite(new Texture("Content/particle.png"));
            particle.Origin = new Vector2f(32, 32);

            particleEmitter = new Emitter();
            particleEmitter.Position = new Vector2f(50, 50);
            particleEmitter.ParticlesSpawnRate = 200;
            particleEmitter.Spread = 30;
            particleEmitter.Color = Color.Blue;
            particles.AddEmitter(particleEmitter);

            greenEmitter = new Emitter();
            greenEmitter.Position = new Vector2f(50, 50);
            greenEmitter.ParticlesSpawnRate = 150;
            greenEmitter.Spread = 30;
            greenEmitter.Color = Colors.Lime;
            particles.AddEmitter(greenEmitter);

            bg = new Sprite();
            particleTexture = new RenderTexture(1280, 720);
            particleTexture.Clear(Color.Blue);
        }
Ejemplo n.º 2
0
 public void AddEmitter(Emitter emitter)
 {
     Emitters.Add(emitter);
 }