Пример #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()
        {
            bloomFilter = new BloomFilter();

            var options = new ParallelOptions();

            options.MaxDegreeOfParallelism     = Environment.ProcessorCount;
            graphics.PreferredBackBufferHeight = 768;
            graphics.PreferredBackBufferWidth  = 1366;
            graphics.ApplyChanges();
            Galaxy.Instance = new Galaxy((double)int.MaxValue * 1000, (double)int.MaxValue * 1000, 10000, 0, 15);
            // TODO: Add your initialization logic here
            MonoMenu.Engine.Monitor.Initialize();
            monoRenderTarget       = new RenderTarget2D(GraphicsDevice, GraphicsDevice.PresentationParameters.BackBufferWidth, GraphicsDevice.PresentationParameters.BackBufferHeight);
            preProcessRenderTarget = new RenderTarget2D(GraphicsDevice, GraphicsDevice.PresentationParameters.BackBufferWidth, GraphicsDevice.PresentationParameters.BackBufferHeight);
            planetRenderTarget     = new RenderTarget2D(GraphicsDevice, GraphicsDevice.PresentationParameters.BackBufferWidth, GraphicsDevice.PresentationParameters.BackBufferHeight);
            gridRenderTarget       = new RenderTarget2D(GraphicsDevice, GraphicsDevice.PresentationParameters.BackBufferWidth, GraphicsDevice.PresentationParameters.BackBufferHeight);
            Menu            = new MonoMenu.Engine.MonoMenu(graphics.GraphicsDevice, Content);
            Camera.Instance = new Camera(graphics.GraphicsDevice.Viewport);
            Camera.Instance.Follow(Galaxy.Instance.GetBody(0));
            Camera.Instance.Zoom = (float)(100 / Galaxy.Instance.GetBody(0).size);
            MouseInput.LeftMouseButtonDoubleClick += InputLeftMouseDoubleClick;
            MouseInput.LeftMouseButtonClick       += InputLeftMouseClick;
            MouseInput.ScrollDown += InputScrollDown;
            MouseInput.ScrollUp   += InputScrollUp;
            MouseInput.Dragging   += InputDragging;

            base.Initialize();
        }
Пример #2
0
 /// <summary>
 /// LoadContent will be called once per game and is the place to load
 /// all of your content.
 /// </summary>
 protected override void LoadContent()
 {
     // Create a new SpriteBatch, which can be used to draw textures.
     spriteBatch = new SpriteBatch(GraphicsDevice);
     MonoMenu.Engine.MonoMenu.defaultFont = Content.Load <SpriteFont>("Arial");
     pixelText = new Texture2D(GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
     pixelText.SetData(new[] { Color.White });
     font  = Content.Load <SpriteFont>("Arial");
     xMenu = new MonoMenu.Engine.MonoMenu(GraphicsDevice, Content);
     xMenu.Load("text.xaml");
     // TODO: use this.Content to load your game content here
 }