Example #1
0
 private void InitializeMapLight()
 {
     //make sure to initialize krypton, unless it has been added to the Game's list of Components
     Penumbra.Initialize();
     Penumbra.AmbientColor = AmbientColor;
     Penumbra.Game.GraphicsDevice.RasterizerState = RasterizerState.CullClockwise;
 }
        //-----------------------------------------------------------------------------------------------------------------------------------------------------------

        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            screenCenter = new Vector2(graphics.GraphicsDevice.Viewport.Width / 2, graphics.GraphicsDevice.Viewport.Height / 2);

            // load or create new world
            map.LoadMap("new_world.world"); // will create map everytime
            //map.CreateMap(420);

            Cell.blockCells.Clear();

            player.LoadContent(Content);

            //playerSprite = Content.Load<Texture2D>("player");

            if (multiplayer)
            {
                net.LoadMultiplayer(player);
            }

            penumbra.Initialize();
            //penumbra.Transform = player.camera.view;
            //Components.Add(penumbra);
            penumbra.Lights.Add(sun);
        }
Example #3
0
        protected override void Initialize()
        {
            IsMouseVisible = true;

            // Initialize the lighting system
            penumbra.Initialize();
            penumbra.AmbientColor = new Color(new Vector3(0.7f));
            //penumbra.Debug = true;

            // Our world for the physics body
            world = new World(Vector2.Zero);

            // Initialize the physics debug view
            PhysicsDebugView = new DebugViewXNA(world);
            PhysicsDebugView.LoadContent(GraphicsDevice, Content);
            PhysicsDebugView.RemoveFlags(DebugViewFlags.Controllers);
            PhysicsDebugView.RemoveFlags(DebugViewFlags.Joint);
            PhysicsDebugView.RemoveFlags(DebugViewFlags.Shape);
            PhysicsDebugView.DefaultShapeColor = new Color(255, 255, 0);

            graphics.PreferredBackBufferWidth  = 1280;
            graphics.PreferredBackBufferHeight = 720;

            graphics.SynchronizeWithVerticalRetrace = true;
            IsFixedTimeStep = false;
            base.Initialize();
        }
Example #4
0
        public void Initialize()
        {
            Console.WriteLine("GameManager - Initialize");

            Penumbra = new PenumbraComponent(Game1.Game)
            {
                AmbientColor = new Color(50, 50, 50, 255)
            };

            Game1.Game.Services.AddService(Penumbra);

            ParticleManager   = new ParticleManager();
            SoundManager      = new SoundManager();
            ItemManager       = new ItemManager();
            CreatureManager   = new CreatureManager();
            ProjectileManager = new ProjectileManager();
            ScreenManager     = new ScreenManager();

            Managers = new List <IManager>
            {
                ParticleManager,
                SoundManager,
                ItemManager,
                CreatureManager,
                ProjectileManager,
                ScreenManager
            };

            Managers.ForEach(x => x.Initialize());
            Penumbra.Initialize();
        }
        /// <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()
        {
            // TODO: Add your initialization logic here

            windowWidth  = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
            windowHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;

            //renderSize = windowWidth;

            graphics.PreferredBackBufferHeight = windowHeight;
            graphics.PreferredBackBufferWidth  = windowWidth;

            //graphics.IsFullScreen = true;

            graphics.SynchronizeWithVerticalRetrace = false;
            graphics.ApplyChanges();

            //IsFixedTimeStep = false;

            IsMouseVisible = true;

            penumbra.Initialize();

            penumbra.Lights.Add(Player.playerLight);
            penumbra.Lights.Add(Player.playerLight2);
            worlds.Add(new World(75, 250, 0.10f));

            base.Initialize();
        }
Example #6
0
 public void InitLighting()
 {
     Penumbra = new PenumbraComponent(ThisGame);
     ThisGame.Services.AddService(Penumbra);
     Penumbra.Initialize();
     Penumbra.AmbientColor = Color.Black;
 }
Example #7
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()
        {
            // TODO: Add your initialization logic here

            base.Initialize();
            world = new World(256, 256, Content);
            EditorGui.init();
            player = new Player(Content);

            World.themeNames = new string[Directory.GetDirectories(Content.RootDirectory + "/themes").Length];
            int i = 0;

            foreach (string folder in Directory.GetDirectories(Content.RootDirectory + "/themes"))
            {
                World.themeNames[i] = Path.GetFileName(folder);
                i++;
            }

            cam.Zoom       = 1f;
            rt             = new RenderTarget2D(graphics.GraphicsDevice, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);
            preBloomTarget = new RenderTarget2D(graphics.GraphicsDevice, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);
            bloomMipmap    = new Mipmap(preBloomTarget, 5, GraphicsDevice);
            blurPass       = new BlurPass(GraphicsDevice, Content, bloomMipmap.getLevel(4).Width, bloomMipmap.getLevel(4).Height, 1.5f);
            blurPass1      = new BlurPass(GraphicsDevice, Content, bloomMipmap.getLevel(3).Width, bloomMipmap.getLevel(3).Height, 2.5f);
            blurPass2      = new BlurPass(GraphicsDevice, Content, bloomMipmap.getLevel(1).Width, bloomMipmap.getLevel(1).Height, 1.2f);
            graphicsDevice = graphics.GraphicsDevice;
            //graphicsDevice.Viewport = new Viewport(0, 0, 1600, 900);

            penumbra.Initialize();
        }
Example #8
0
        public override void Initialize()
        {
            log.Info("Intitialising Penumbra");
            penumbra.Initialize();

            base.Initialize();
        }
Example #9
0
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);


            Penumbra.Initialize();
            Penumbra.Visible = true;
        }
Example #10
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()
        {
            // TODO: Add your initialization logic here

            // Initialize the lighting system.
            penumbra.Initialize();

            base.Initialize();
        }
Example #11
0
        protected override void Initialize()
        {
            base.Initialize();

            _graphics.PreferredBackBufferWidth  = 1920;
            _graphics.PreferredBackBufferHeight = 1080;

            _graphics.PreferMultiSampling = true;
            _graphics.IsFullScreen        = false;
            _graphics.HardwareModeSwitch  = false;
            _graphics.ApplyChanges();

            _penumbra.Initialize();
            _penumbra.AmbientColor = Color.FromNonPremultiplied(255, 255, 255, 255);
        }
Example #12
0
 protected override void Initialize()
 {
     penumbra.Initialize();
     camera = new Camera(GraphicsDevice.Viewport);
     vars   = new Variables();
     height = GraphicsDevice.DisplayMode.Height;
     width  = GraphicsDevice.DisplayMode.Width;
     UserInterface.Initialize(Content, BuiltinThemes.hd);
     UserInterface.Active.SetCursor(CursorType.Default);
     graphics.PreferredBackBufferWidth  = (int)width;
     graphics.PreferredBackBufferHeight = (int)height;
     graphics.IsFullScreen = false;
     graphics.ApplyChanges();
     game   = true;
     menu   = true;
     combat = true;
     base.Initialize();
 }
Example #13
0
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            camera = new Camera();
            gsm    = new GameStateManager();
            lua    = new Lua();

            var c = new Constants();

            lua["Constants"] = c;


            // Initialize the lighting system
            penumbra.Initialize();
            penumbra.AmbientColor = new Color(0.9f, 0.9f, 0.9f, 1.0f);

            base.Initialize();
        }
        protected override void LoadContent()
        {
            Dictionary <string, Texture2D> textures = new Dictionary <string, Texture2D>();

            spriteBatch = new SpriteBatch(GraphicsDevice);

            string[] files = Directory.GetFiles(Content.RootDirectory + "\\Sprites", "*.xnb", SearchOption.AllDirectories);

            foreach (string file in files)
            {
                string filename = Path.GetFileNameWithoutExtension(file);
                textures[filename] = Content.Load <Texture2D>("Sprites\\" + filename);
            }

            penumbra.Initialize();
            camera.LoadContent();
            AudioManager.LoadContent(Content);
            renderer.LoadContent(Content, textures);
        }
        // This method is used to initialize the penumbra instance, and add
        // all the entities that have an associated instance of light component.
        public PenumbraComponent Initialize(GameDependencies gameDependencies)
        {
            var penumbra = new PenumbraComponent(gameDependencies.Game)
            {
                // Ambient color will determine how dark everything else
                // except for the light will be.
                AmbientColor = new Color(new Vector3(0.5f)) // should be an entity?
            };
            var lights = ComponentManager.Instance.GetEntitiesWithComponent(typeof(LightComponent));

            foreach (var instance in lights)
            {
                var lightComponent = instance.Value as LightComponent;
                penumbra.Lights.Add(lightComponent.Light);
            }

            penumbra.Initialize();
            return(penumbra);
        }
Example #16
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);

            // Load fonts
            hudFont = Content.Load <SpriteFont>("Fonts/Hud");

            // Load overlay textures
            winOverlay  = Content.Load <Texture2D>("Overlays/you_win");
            loseOverlay = Content.Load <Texture2D>("Overlays/you_lose");
            diedOverlay = Content.Load <Texture2D>("Overlays/you_died");

            //Work out how much we need to scale our graphics to fill the screen
            float   horScaling          = GraphicsDevice.PresentationParameters.BackBufferWidth / baseScreenSize.X;
            float   verScaling          = GraphicsDevice.PresentationParameters.BackBufferHeight / baseScreenSize.Y;
            Vector3 screenScalingFactor = new Vector3(horScaling, verScaling, 1);

            globalTransformation = Matrix.CreateScale(screenScalingFactor);

            virtualGamePad = new VirtualGamePad(baseScreenSize, globalTransformation, Content.Load <Texture2D>("Sprites/VirtualControlArrow"));

            //Known issue that you get exceptions if you use Media PLayer while connected to your PC
            //See http://social.msdn.microsoft.com/Forums/en/windowsphone7series/thread/c8a243d2-d360-46b1-96bd-62b1ef268c66
            //Which means its impossible to test this from VS.
            //So we have to catch the exception and throw it away
            try
            {
                MediaPlayer.IsRepeating = true;
                MediaPlayer.Play(Content.Load <Song>("Sounds/Music"));
            }
            catch { }

            // Load penumbra
            penumbra.Initialize();
            penumbra.Transform = globalTransformation;

            LoadNextLevel();
        }
Example #17
0
 protected override void Initialize()
 {
     // Initialize the lighting system.
     penumbra.Initialize();
 }