Пример #1
0
        /// <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()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: Add your initialization logic here



            Win1 = new Applications.TestApp1(spriteBatch, Content);
            Win2 = new Applications.TestApp2(spriteBatch, Content);

            ClassicWindow Test1 = new ClassicWindow(spriteBatch, Content, GraphicsDevice, Win1);
            ClassicWindow Test2 = new ClassicWindow(spriteBatch, Content, GraphicsDevice, Win2);

            Components.Add(Test2);
            Components.Add(Win2);

            Components.Add(Test1);
            Components.Add(Win1);

            title = new MonoHackTitleScreen(spriteBatch, Content, GraphicsDevice);

            title.Initialize();

            Components.Add(title);

            base.Initialize();

            Console.Title = "MonoHack Engine Console";

            Console.WriteLine("[" + DateTime.Now.ToString("MM/dd/yyyy H:mm:ss") + "] MonoHack Engine Initialized.");
        }
Пример #2
0
        public ClassicWindow(SpriteBatch _spriteBatch, ContentManager _content, GraphicsDevice _graphicsDevice, IMonoHackApp App)
        {
            spriteBatch              = _spriteBatch;
            app                      = App;
            graphicsDevice           = _graphicsDevice;
            this.TitleBarLMBRelease += TitleMouseUp;
            this.TitleBarLMBDown    += TitleMouseDown;

            ///
            /// WindowPanel
            ///
            WindowPanel.SpriteBatch       = spriteBatch;
            WindowPanel.Bounds            = new Rectangle(new Point(50, 50), new Point(app.Bounds.Width, app.Bounds.Height + 26));
            WindowPanel.Theme             = new Engine.UI.Themes.ClassicTheme(_content, _spriteBatch);
            WindowPanel.Theme.BorderSize  = 4;
            WindowPanel.Theme.BorderColor = Color.FromNonPremultiplied(64, 64, 64, 255);
            WindowPanel.Color             = new Color(192, 192, 192);

            ///
            /// BackPanel
            ///
            BackPanel.SpriteBatch        = spriteBatch;
            BackPanel.Bounds             = new Rectangle(new Point(WindowPanel.Bounds.X - 2, WindowPanel.Bounds.Y - 2), new Point(WindowPanel.Bounds.Width + 4, WindowPanel.Bounds.Height + 4));
            BackPanel.Theme              = new Engine.UI.Themes.ClassicTheme(_content, _spriteBatch);
            BackPanel.Theme.ControlStyle = UI.Styles.ControlStyles.Flat;
            BackPanel.Color              = new Color(0, 0, 0);

            ///
            /// TitleBar
            ///
            TitleBar.SpriteBatch        = spriteBatch;
            TitleBar.Bounds             = new Rectangle(new Point(WindowPanel.Bounds.X + 2, WindowPanel.Bounds.Y + 2), new Point(WindowPanel.Bounds.Width - 4, 18));
            TitleBar.Theme              = new Engine.UI.Themes.ClassicTheme(_content, _spriteBatch);
            TitleBar.Theme.ActiveColor  = new Color(0, 0, 128);
            TitleBar.Theme.ControlStyle = UI.Styles.ControlStyles.Flat;

            ///
            /// Title
            ///
            Title.SpriteBatch     = spriteBatch;
            Title.Bounds          = new Rectangle(new Point(WindowPanel.Bounds.X + 7, WindowPanel.Bounds.Y + 4), new Point(0, 0));
            Title.Theme           = new Engine.UI.Themes.ClassicTheme(_content, _spriteBatch);
            Title.Font            = _content.Load <BitmapFont>("UI/Font/Classic/ClassicBold");
            Title.Theme.TextColor = Color.White;
            Title.Text            = App.Text;

            ///
            /// btnClose
            ///
            btnClose.SpriteBatch      = spriteBatch;
            btnClose.Bounds           = new Rectangle(new Point(WindowPanel.Bounds.X + WindowPanel.Bounds.Width - 19, WindowPanel.Bounds.Y + 5), new Point(13, 11));
            btnClose.Theme            = new Engine.UI.Themes.ClassicTheme(_content, _spriteBatch);
            btnClose.Theme.BorderSize = 0;
            btnClose.Image            = _content.Load <Texture2D>("UI/Images/ClassicTheme/ClassicClose");

            ///
            /// btnMax
            ///
            btnMax.SpriteBatch      = spriteBatch;
            btnMax.Bounds           = new Rectangle(new Point(WindowPanel.Bounds.X + WindowPanel.Bounds.Width - 37, WindowPanel.Bounds.Y + 5), new Point(13, 11));
            btnMax.Theme            = new Engine.UI.Themes.ClassicTheme(_content, _spriteBatch);
            btnMax.Theme.BorderSize = 0;
            btnMax.Image            = _content.Load <Texture2D>("UI/Images/ClassicTheme/ClassicMax");

            ///
            /// btnMin
            ///
            btnMin.SpriteBatch      = spriteBatch;
            btnMin.Bounds           = new Rectangle(new Point(WindowPanel.Bounds.X + WindowPanel.Bounds.Width - 53, WindowPanel.Bounds.Y + 5), new Point(13, 11));
            btnMin.Theme            = new Engine.UI.Themes.ClassicTheme(_content, _spriteBatch);
            btnMin.Image            = _content.Load <Texture2D>("UI/Images/ClassicTheme/ClassicMin");
            btnMin.Theme.BorderSize = 0;
        }
Пример #3
0
        public DefaultWindow(SpriteBatch _spriteBatch, ContentManager _content, GraphicsDevice _graphicsDevice, IMonoHackApp App)
        {
            spriteBatch              = _spriteBatch;
            app                      = App;
            graphicsDevice           = _graphicsDevice;
            this.TitleBarLMBRelease += TitleMouseUp;
            this.TitleBarLMBDown    += TitleMouseDown;

            ///
            /// WindowPanel
            ///
            WindowPanel.SpriteBatch       = spriteBatch;
            WindowPanel.Bounds            = new Rectangle(new Point(50, 50), new Point(app.Bounds.Width, app.Bounds.Height + 26));
            WindowPanel.Theme             = new Engine.UI.Themes.DefaultTheme(_content, _spriteBatch);
            WindowPanel.Theme.BorderSize  = 4;
            WindowPanel.Theme.BorderColor = Color.FromNonPremultiplied(64, 64, 64, 255);

            ///
            /// TitleBar
            ///
            TitleBar.SpriteBatch       = spriteBatch;
            TitleBar.Bounds            = new Rectangle(new Point(WindowPanel.Bounds.X, WindowPanel.Bounds.Y), new Point(WindowPanel.Bounds.Width, 26));
            TitleBar.Theme             = new Engine.UI.Themes.DefaultTheme(_content, _spriteBatch);
            TitleBar.Theme.ActiveColor = Color.FromNonPremultiplied(64, 64, 64, 255);
            TitleBar.Theme.BorderSize  = 0;

            ///
            /// Title
            ///
            Title.SpriteBatch     = spriteBatch;
            Title.Bounds          = new Rectangle(new Point(WindowPanel.Bounds.X + 5, WindowPanel.Bounds.Y + 4), new Point(0, 0));
            Title.Theme           = new Engine.UI.Themes.DefaultTheme(_content, _spriteBatch);
            Title.Font            = Title.Theme.Font;
            Title.Theme.TextColor = Color.White;
            Title.Text            = App.Text;

            ///
            /// btnClose
            ///
            btnClose.SpriteBatch       = spriteBatch;
            btnClose.Bounds            = new Rectangle(new Point(WindowPanel.Bounds.X + WindowPanel.Bounds.Width - 22, WindowPanel.Bounds.Y), new Point(22, 22));
            btnClose.Theme             = new Engine.UI.Themes.DefaultTheme(_content, _spriteBatch);
            btnClose.Theme.BorderSize  = 0;
            btnClose.Theme.ActiveColor = Color.Black;
            btnClose.Text = "";

            ///
            /// btnMax
            ///
            btnMax.SpriteBatch       = spriteBatch;
            btnMax.Bounds            = new Rectangle(new Point(WindowPanel.Bounds.X + WindowPanel.Bounds.Width - 48, WindowPanel.Bounds.Y), new Point(22, 22));
            btnMax.Theme             = new Engine.UI.Themes.DefaultTheme(_content, _spriteBatch);
            btnMax.Theme.BorderSize  = 0;
            btnMax.Theme.ActiveColor = Color.Black;
            btnMax.Text = "";

            ///
            /// btnMin
            ///
            btnMin.SpriteBatch       = spriteBatch;
            btnMin.Bounds            = new Rectangle(new Point(WindowPanel.Bounds.X + WindowPanel.Bounds.Width - 74, WindowPanel.Bounds.Y), new Point(22, 22));
            btnMin.Theme             = new Engine.UI.Themes.DefaultTheme(_content, _spriteBatch);
            btnMin.Theme.BorderSize  = 0;
            btnMin.Theme.ActiveColor = Color.Black;
            btnMin.Text = "";
        }