Example #1
0
        protected void Initialize(Options options,GraphicsDevice graphics)
        {
            basicTarget = new RenderTarget2D(graphics,
                graphics.PresentationParameters.BackBufferWidth,
                graphics.PresentationParameters.BackBufferHeight,
                false,
                SurfaceFormat.Color,
                DepthFormat.None,
                graphics.PresentationParameters.MultiSampleCount,
                RenderTargetUsage.PreserveContents);
            player = new Player(new Vector2(100, 100), Content);
            blur = content.Load<Effect>("Stuff/Effects/Blur");
            waether = content.Load<Effect>("Stuff/Effects/Weather");
            waether.CurrentTechnique = waether.Techniques["Technique1"];
            motionblur = content.Load<Effect>("Stuff/Effects/MotionBlur");
            waether.Parameters["effectTexture"].SetValue(content.Load<Texture2D>("Stuff/Effects/Rain"));
            level = new Level();
            level.LoadLevel(content.ServiceProvider,graphics,options);
            InitializeLayer(options,graphics);
            player.Pos = level.Startpos;
            bg_rect = new Rectangle(0, 0, options.ScreenWidth, options.ScreenHeight);

            gamelogic = new GameLogic();
            gamelogic.Initialize(content.ServiceProvider,graphics, level.LevelVariables, options);
            camera = new Camera(options.ScreenWidth,
                options.ScreenHeight,
                level.Startpos,
                (float)options.ScaleFactor);
            debugscreen = new DebugScreen(Content, level.Startpos);
            Matrix viewMatrix = Matrix.CreateLookAt(
                   new Vector3(0.0f, 0.0f, 1.0f),
                   Vector3.Zero,
                   Vector3.Up
                   );

            Matrix projectionMatrix = Matrix.CreateOrthographicOffCenter(
                0,
                (float)options.ScreenWidth,
                (float)options.ScreenHeight,
                0,
                1.0f, 1000.0f);

            effect = new BasicEffect(graphics);
            effect.Alpha = 1.0f;
            effect.View = viewMatrix;
            effect.Projection = projectionMatrix;
            effect.VertexColorEnabled = true;

            colorizePost = new ColorizeLUT();
            colorizeBackground = new ColorizeLUT();
            JumpPad pad = new JumpPad();
            pad.Initialize(content.ServiceProvider, options, graphics, "0,0,32,32,0,-5000,0.95");
            iObjectManager.AddObject(pad);
            target = new RenderTarget2D(graphics,
                graphics.PresentationParameters.BackBufferWidth,
                graphics.PresentationParameters.BackBufferHeight,
                false,
                SurfaceFormat.Color,
                DepthFormat.None,
                graphics.PresentationParameters.MultiSampleCount,
                RenderTargetUsage.PreserveContents);

            toonShader = new ToonShader();
            toonShader.Initialize(Content.ServiceProvider, graphics, options);
            toonShader.Enabled = true;
        }
Example #2
0
 protected override DrawPosition InitializeEvent(IServiceProvider serviceProvider,GraphicsDevice device,LevelVariables levelVariables, Options options)
 {
     this.options = options;
     blank = Content.Load<Texture2D>("Stuff/Blank");
     killeffect = new KillEffect();
     killeffect.Initialize(serviceProvider, device, options);
     traceEffect = new Trace();
     traceEffect.Initialize(serviceProvider, device, options);
     rect = new Rectangle(0, 0, options.ScreenWidth, options.ScreenHeight);
     screenwidth = options.ScreenWidth;
     coord = new Vector2(options.ScreenWidth / 2, options.ScreenHeight / 2 + options.ScreenHeight * 0.35f);
     frontrect = new Rectangle(0, 0, options.ScreenWidth, options.ScreenHeight);
     shakeDivider = 10;
     manager = new ParticleSystem();
     gameOverText.font = Content.Load<SpriteFont>("Stuff\\Font");
     gameOverText.Text = gameOver;
     gameOverText.color = new Color(1f,1f,1f, 0);
     blackScreenColor = new Color(0f,0f,0f, 0);
     toonShader = new ToonShader();
     toonShader.Initialize(serviceProvider, device, options);
     toonShader.CurrentTechnique = ToonShaderEffects.BrightEdgesColored;
     return DrawPosition.Post;
 }