예제 #1
0
파일: ListBase.cs 프로젝트: HaKDMoDz/geff
        public ListBase(UILogic uiLogic, UIComponent parent, TimeSpan creationTime, Rectangle rec, SpriteFont font, bool checkable)
            : base(uiLogic, parent, creationTime)
        {
            this.Font = font;
            this.IsCheckable = checkable;
            recInitial = rec;

            sizeText = font.MeasureString(new String(' ', 40)) + new Vector2(Ribbon.MARGE * 2, Ribbon.MARGE);

            countMaxItem = (rec.Height - 2 * MARGE) / (int)sizeText.Y;

            Rec = new Rectangle(
                recInitial.X,
                recInitial.Y,
                Math.Min((int)sizeText.X, recInitial.Width),
                (int)(countMaxItem * sizeText.Y + 2 * MARGE));

            if (sizeText.X > Rec.Width)
                sizeText.X = Rec.Width - 2 * MARGE;

            //--- Molette de la souris
            MouseManager mouseWheel = AddMouse(MouseButtons.Wheel);
            mouseWheel.MouseWheelChanged += new MouseManager.MouseWheelChangedHandler(mouseWheel_MouseWheelChanged);
            //---
        }
예제 #2
0
파일: Ribbon.cs 프로젝트: HaKDMoDz/geff
        public Ribbon(UILogic uiLogic, UIComponent parent, TimeSpan creationTime)
            : base(uiLogic, parent, creationTime)
        {
            CreationTime = creationTime;

            Visible = true;
            Alive = true;

            Init();
        }
예제 #3
0
파일: BPMMeter.cs 프로젝트: HaKDMoDz/geff
        public BPMMeter(Ribbon ribbon, UILogic uiLogic, TimeSpan creationTime)
            : base(uiLogic, ribbon, creationTime)
        {
            Alive = true;
            Visible = true;
            _ribbon = ribbon;

            MouseManager mouseLeftButton = AddMouse(MouseButtons.LeftButton);
            mouseLeftButton.MouseFirstPressed += new MouseManager.MouseFirstPressedHandler(mouseLeftButton_MouseFirstPressed);
            mouseLeftButton.MousePressed += new MouseManager.MousePressedHandler(mouseLeftButton_MousePressed);
            mouseLeftButton.MouseReleased += new MouseManager.MouseReleasedHandler(mouseLeftButton_MouseReleased);
        }
예제 #4
0
        public ListLibrary(UILogic uiLogic, UIComponent parent, TimeSpan creationTime, Rectangle rec, SpriteFont font, bool checkable)
            : base(uiLogic, parent, creationTime, rec, font, checkable)
        {
            this.Modal = true;
            this.Alive = true;
            this.Visible = true;
            this.ListUIChildren = new List<UIComponent>();

            LoadLibraries();

            //---
            KeyManager keyClose = AddKey(Keys.Escape);
            keyClose.KeyReleased += new KeyManager.KeyReleasedHandler(keyClose_KeyReleased);
            //---
        }
예제 #5
0
파일: ListSample.cs 프로젝트: HaKDMoDz/geff
        public ListSample(UILogic uiLogic, UIComponent parent, TimeSpan creationTime, Cell cell, Channel channel, Rectangle rec, SpriteFont font, bool checkable)
            : base(uiLogic, parent, creationTime, rec, font, checkable)
        {
            this.Alive = true;
            this.Visible = true;
            this.ListUIChildren = new List<UIComponent>();
            this._cell = cell;

            LoadSample(channel);

            //---
            KeyManager keyClose = AddKey(Keys.Escape);
            keyClose.KeyReleased += new KeyManager.KeyReleasedHandler(keyClose_KeyReleased);
            //---
        }
예제 #6
0
파일: ListFile.cs 프로젝트: HaKDMoDz/geff
        public ListFile(UILogic uiLogic, UIComponent parent, TimeSpan creationTime, string directory, Rectangle rec, SpriteFont font)
            : base(uiLogic, parent, creationTime, rec, font, false)
        {
            this.Modal = true;
            this.Alive = true;
            this.Visible = true;
            this.Directory = directory;
            this.ListUIChildren = new List<UIComponent>();

            LoadFile();

            //---
            KeyManager keyClose = AddKey(Keys.Escape);
            keyClose.KeyReleased += new KeyManager.KeyReleasedHandler(keyClose_KeyReleased);
            //---
        }
예제 #7
0
        public EffectPropertyChanger(UILogic uiLogic, UIComponent parent, TimeSpan creationTime, EffectProperty effectProperty)
            : base(uiLogic, parent, creationTime)
        {
            this.Modal = false;
            this.Alive = true;
            this.Visible = true;
            this.ListUIChildren = new List<UIComponent>();
            this.effectProperty = effectProperty;

            //---
            MouseManager mouseLeft = AddMouse(MouseButtons.LeftButton);
            mouseLeft.MouseFirstPressed += new MouseManager.MouseFirstPressedHandler(mouseLeft_MouseFirstPressed);
            mouseLeft.MousePressed += new MouseManager.MousePressedHandler(mouseLeft_MousePressed);
            mouseLeft.MouseReleased += new MouseManager.MouseReleasedHandler(mouseLeft_MouseReleased);
            //---
        }
예제 #8
0
파일: Keyboard.cs 프로젝트: HaKDMoDz/geff
        public Keyboard(NotePanel notePannel, UILogic uiLogic, TimeSpan creationTime)
            : base(uiLogic, notePannel, creationTime)
        {
            Alive = true;
            Visible = true;

            _notePannel = notePannel;

            Rec = new Rectangle((int)notePannel.leftPartWidth, notePannel.Rec.Top, (int)((float)notePannel.Rec.Width - notePannel.leftPartWidth), (int)notePannel.Rec.Height);

            CreateNoteTable();
            CreateKeys();

            MouseManager mouseRightButton = AddMouse(MouseButtons.RightButton);
            mouseRightButton.MouseFirstPressed += new MouseManager.MouseFirstPressedHandler(mouseRightButton_MouseFirstPressed);
            mouseRightButton.MousePressed += new MouseManager.MousePressedHandler(mouseRightButton_MousePressed);
            mouseRightButton.MouseReleased += new MouseManager.MouseReleasedHandler(mouseRightButton_MouseReleased);

            UI.GameEngine.Sound.MidiNoteEvent += new SoundLogic.MidiNoteEventHandler(Sound_MidiNoteEvent);
        }
예제 #9
0
        public ClickableText(UILogic uiLogic, UIComponent parent, TimeSpan creationTime, SpriteFont spriteFont, string text, Vector2 position, Color colorOut, Color colorIn, Color backColorOut, Color backColorIn, bool isCheckable)
            : base(uiLogic, parent, creationTime)
        {
            this._spriteFont = spriteFont;// uiLogic.GameEngine.Content.Load<SpriteFont>(@"Font\" + spriteFont);
            this.Text = text;
            this._position = position;
            this.Rec = new Rectangle((int)this.Position.X, (int)this.Position.Y, (int)this._spriteFont.MeasureString(text).X, (int)this._spriteFont.MeasureString(text).Y);

            this.Alive = true;
            this.Visible = true;
            this._colorIn = colorIn;
            this._colorOut = colorOut;
            this._backColorIn = backColorIn;
            this._backColorOut = backColorOut;
            this.IsCheckable = isCheckable;

            MouseManager mouseLeftButton = AddMouse(MouseButtons.LeftButton);
            MouseManager mouseMiddleButton = AddMouse(MouseButtons.MiddleButton);

            mouseLeftButton.MouseReleased += new MouseManager.MouseReleasedHandler(MouseLeftButton_MouseReleased);
            mouseMiddleButton.MouseFirstPressed += new MouseManager.MouseFirstPressedHandler(mouseMiddleButton_MouseFirstPressed);
        }
예제 #10
0
파일: Key.cs 프로젝트: HaKDMoDz/geff
        public Key(Keyboard keyboard, UILogic uiLogic, TimeSpan creationTime, string name, int octave, int index, int countPreviousWhite, float frequency)
            : base(uiLogic, keyboard, creationTime)
        {
            Alive = true;
            Visible = true;

            _keyboard = keyboard;
            _name = name;
            NoteName = name + octave.ToString();
            _octave = octave;
            NoteKey = index;
            Frequency = frequency;
            if (name.EndsWith("#"))
                White = false;

            int indexImage = (index + 4) % 12;
            _texKey = GetKeyImage(White, typeKey[indexImage]);
            int whiteWidth = GetKeyImage(true, 1).Width * keyboard.Rec.Height / GetKeyImage(true, 1).Height;

            int height = (int)((float)keyboard.Rec.Height * (White ? 1f : 0.64f));
            Width = _texKey.Width * height / _texKey.Height;
            int deltaLeft = 0;

            if (!White)
            {
                deltaLeft = -(int)((float)Width * (deltaBlack[indexImage]));
            }

            Rec = new Rectangle(keyboard.Rec.Left + countPreviousWhite * whiteWidth + deltaLeft, keyboard.Rec.Top, Width, height);

            //---
            MouseManager mouseLeftButton = AddMouse(MouseButtons.LeftButton);
            mouseLeftButton.MouseReleased += new MouseManager.MouseReleasedHandler(MouseLeftButton_MouseReleased);

            MouseManager mouseMiddleButton = AddMouse(MouseButtons.MiddleButton);
            mouseMiddleButton.MouseFirstPressed += new MouseManager.MouseFirstPressedHandler(mouseMiddleButton_MouseFirstPressed);
            //---
        }
예제 #11
0
        public EffectPanel(UILogic uiLogic, UIComponent parent, TimeSpan creationTime, ChannelEffect channelEffect, Cell cell)
            : base(uiLogic, parent, creationTime)
        {
            this.Modal = true;
            this.Alive = true;
            this.Visible = true;
            this._channelEffect = new ChannelEffect(channelEffect.Channel, channelEffect.Name);
            this._cell = cell;

            this.ListUIChildren = new List<UIComponent>();

            //--- Clonage des valeurs du channelEffect en entrée dans le channelEffect courant
            for (int i = 0; i < channelEffect.ListEffectProperty.Count; i++)
            {
                _channelEffect.ListEffectProperty[i].Value = channelEffect.ListEffectProperty[i].Value;
            }
            //---

            Vector2 sizeWindow = new Vector2(_widthChannelChooser + Math.Min(channelEffect.ListEffectProperty.Count, 3) * (EffectPropertyChanger.WIDTH + Ribbon.MARGE), (int)Math.Round((float)channelEffect.ListEffectProperty.Count / 3f, MidpointRounding.AwayFromZero) * EffectPropertyChanger.HEIGHT);

            Rec = new Rectangle((int)(Render.ScreenWidth / 2 - sizeWindow.X / 2), Ribbon.HEIGHT + Ribbon.MARGE, (int)sizeWindow.X, (int)(sizeWindow.Y));

            Vector2 vec = new Vector2(Rec.X + _widthChannelChooser + Ribbon.MARGE, Rec.Y);
            int nb = 0;

            foreach (EffectProperty effectProperty in _channelEffect.ListEffectProperty)
            {
                EffectPropertyChanger effectPropertyChanger = new EffectPropertyChanger(UI, this, GetNewTimeSpan(), effectProperty);
                effectPropertyChanger.Rec = new Rectangle((int)vec.X, (int)vec.Y, EffectPropertyChanger.WIDTH, EffectPropertyChanger.HEIGHT);
                effectPropertyChanger.Init();

                nb++;

                if (nb % 3 == 0)
                {
                    vec.X = Rec.X + _widthChannelChooser + Ribbon.MARGE;
                    vec.Y += EffectPropertyChanger.HEIGHT + Ribbon.MARGE;
                }
                else
                    vec.X += EffectPropertyChanger.WIDTH + Ribbon.MARGE;

                this.ListUIChildren.Add(effectPropertyChanger);
            }

            //CreateChannelMenu();

            //--- Bouton Valider
            ClickableText txtOk = new ClickableText(UI, this, GetNewTimeSpan(), Render.FontText, "Ok", new Vector2(Rec.X + _widthChannelChooser * 0.3f, Rec.Y + Rec.Height * 0.8f), VisualStyle.ForeColor, VisualStyle.ForeColor, VisualStyle.BackColorLight, VisualStyle.BackForeColorMouseOver, false);
            txtOk.ClickText += new ClickableText.ClickTextHandler(txtOk_ClickText);
            ListUIChildren.Add(txtOk);

            ClickableText txtCancel = new ClickableText(UI, this, GetNewTimeSpan(), Render.FontText, "Cancel", new Vector2(Rec.X + _widthChannelChooser * 0.5f, Rec.Y + Rec.Height * 0.8f), VisualStyle.ForeColor, VisualStyle.ForeColor, VisualStyle.BackColorLight, VisualStyle.BackForeColorMouseOver, false);
            txtCancel.ClickText += new ClickableText.ClickTextHandler(txtCancel_ClickText);
            ListUIChildren.Add(txtCancel);
            //---

            //--- Bouton Annuler
            //---

            //---
            KeyManager keyClose = AddKey(Keys.Escape);
            keyClose.KeyReleased += new KeyManager.KeyReleasedHandler(keyClose_KeyReleased);
            //---
        }
예제 #12
0
파일: GameEngine.cs 프로젝트: HaKDMoDz/geff
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            if (Mini)
            {
                Control window = Control.FromHandle(this.Window.Handle);
                window.Location = new System.Drawing.Point(1950, 350);
                window.Location = new System.Drawing.Point(1950, 350);
            }

            base.Initialize();

            Context.GameEngine = this;
            //VisualStyle.OpenVisualStyle("LightGray");
            VisualStyle.OpenVisualStyle("AlmostDarkGrayBlue");

            Render = new RenderLogic(this);
            Render.InitRender();
            UI = new UILogic(this);
            Sound = new SoundLogic(this);
            GamePlay = new GamePlayLogic(this);
            Controller = new ControllerLogic(this);
        }
예제 #13
0
파일: NotePanel.cs 프로젝트: HaKDMoDz/geff
        public NotePanel(UILogic uiLogic, TimeSpan creationTime)
            : base(uiLogic, null, creationTime)
        {
            Alive = true;
            Visible = true;
            Context.NextCellNote = Context.SelectedCell;

            leftPartWidth = 350f;// 0.3f * UI.GameEngine.Render.ScreenWidth;
            Rec = new Rectangle(0, (int)(0.6f * UI.GameEngine.Render.ScreenHeight), (int)UI.GameEngine.Render.ScreenWidth, (int)(0.4f * UI.GameEngine.Render.ScreenHeight));

            keyboard = new Keyboard(this, UI, GetNewTimeSpan());
            ListUIChildren = new List<UIComponent>();
            ListUIChildren.Add(keyboard);

            //--- Boutons
            Vector2 vec = new Vector2(0, Rec.Top + MARGE);

            ClickableText txtSilence = new ClickableText(UI, this, GetNewTimeSpan(), Render.FontTextSmall, "Silence", new Vector2(MARGE, vec.Y), VisualStyle.ForeColor, VisualStyle.ForeColor, VisualStyle.BackColorLight, VisualStyle.BackForeColorMouseOver, false);
            txtSilence.ClickText += new ClickableText.ClickTextHandler(txtSilence_ClickText);
            ListUIChildren.Add(txtSilence);
            vec.Y += MARGE + txtSilence.Rec.Height;

            ClickableText txtCapture = new ClickableText(UI, this, GetNewTimeSpan(), Render.FontTextSmall, "Capture", new Vector2(MARGE, vec.Y), VisualStyle.ForeColor, VisualStyle.ForeColor, VisualStyle.BackColorLight, VisualStyle.BackForeColorMouseOver, false);
            txtCapture.ClickText += new ClickableText.ClickTextHandler(txtCapture_ClickText);
            ListUIChildren.Add(txtCapture);
            vec.Y += MARGE + txtCapture.Rec.Height;

            ClickableText txtEntrainement = new ClickableText(UI, this, GetNewTimeSpan(), Render.FontTextSmall, "Entraînement", new Vector2(MARGE, vec.Y), VisualStyle.ForeColor, VisualStyle.ForeColor, VisualStyle.BackColorLight, VisualStyle.BackForeColorMouseOver, true);
            txtEntrainement.ClickText += new ClickableText.ClickTextHandler(txtEntrainement_ClickText);
            ListUIChildren.Add(txtEntrainement);
            vec.Y += MARGE + txtEntrainement.Rec.Height;

            ClickableText txtOpenMidi = new ClickableText(UI, this, GetNewTimeSpan(), Render.FontTextSmall, "Midi", new Vector2(MARGE, vec.Y), VisualStyle.ForeColor, VisualStyle.ForeColor, VisualStyle.BackColorLight, VisualStyle.BackForeColorMouseOver, false);
            txtOpenMidi.ClickText += new ClickableText.ClickTextHandler(txtOpenMidi_ClickText);
            ListUIChildren.Add(txtOpenMidi);
            vec.Y += MARGE + txtOpenMidi.Rec.Height;
            //---

            //--- Note duration
            CreateNoteDurationMenu();
            //---

            //--- Channel
            CreateChannelMenu();
            //---

            //--- Liste des samples
            listSample = new ListSample(UI,this, GetNewTimeSpan(), null, Context.Map.Channels[1],
                new Rectangle(MARGE + (int)leftPartWidth / 2, Rec.Top + Rec.Height / 2 + MARGE, (int)leftPartWidth / 2-MARGE*2, Rec.Height / 2-MARGE*2)
                , Render.FontTextSmall, true);
            listSample.SelectedItemChanged += new ListBase.SelectedItemChangedHandler(listSample_SelectedItemChanged);
            ListUIChildren.Add(listSample);
            //---

            //---
            KeyManager keyClose = AddKey(Keys.Escape);
            keyClose.KeyReleased += new KeyManager.KeyReleasedHandler(keyClose_KeyReleased);
            //---

            //---
            MouseManager mouseLeftButton = AddMouse(MouseButtons.LeftButton);
            mouseLeftButton.MouseFirstPressed += new MouseManager.MouseFirstPressedHandler(mouseIgnoreActionFirstPressed);
            //mouseLeftButton.MousePressed += new MouseManager.MousePressedHandler(mouseIgnoreAction);
            mouseLeftButton.MouseReleased += new MouseManager.MouseReleasedHandler(mouseIgnoreAction);

            MouseManager mouseRightButton = AddMouse(MouseButtons.RightButton);
            mouseRightButton.MouseFirstPressed += new MouseManager.MouseFirstPressedHandler(mouseIgnoreActionFirstPressed);
            //mouseRightButton.MousePressed += new MouseManager.MousePressedHandler(mouseIgnoreAction);
            mouseRightButton.MouseReleased += new MouseManager.MouseReleasedHandler(mouseIgnoreAction);
            //---

            Context.SelectedCellChanged += new Context.SelectedCellChangedHandler(Context_SelectedCellChanged);
        }