public override void Start()
        {
            base.Start();

            customEffect = EffectSystem.LoadEffect("Effect").WaitForResult();
            customEffectInstance = new EffectInstance(customEffect);

            spriteBatch = new SpriteBatch(GraphicsDevice) { VirtualResolution = new Vector3(1) };

            // set fixed parameters once
            customEffectInstance.Parameters.Set(TexturingKeys.Sampler, samplerState);
            customEffectInstance.Parameters.Set(EffectKeys.Center, new Vector2(0.5f, 0.5f));
            customEffectInstance.Parameters.Set(EffectKeys.Frequency, 40);
            customEffectInstance.Parameters.Set(EffectKeys.Spread, 0.5f);
            customEffectInstance.Parameters.Set(EffectKeys.Amplitude, 0.015f);
            customEffectInstance.Parameters.Set(EffectKeys.InvAspectRatio, GraphicsDevice.Presenter.BackBuffer.Height / (float)GraphicsDevice.Presenter.BackBuffer.Width);

            // NOTE: Linear-Wrap sampling is not available for non-square non-power-of-two textures on opengl es 2.0
            samplerState = SamplerState.New(GraphicsDevice, new SamplerStateDescription(TextureFilter.Linear, TextureAddressMode.Clamp));
            
            // Add Effect rendering to the end of the pipeline
            var scene = SceneSystem.SceneInstance.Scene;
            var compositor = ((SceneGraphicsCompositorLayers)scene.Settings.GraphicsCompositor);
            renderer = new SceneDelegateRenderer(RenderQuad);
            compositor.Master.Renderers.Add(renderer);
        }
Example #2
0
        public override void Start()
        {
            // create the ball sprite.
            var virtualResolution = new Vector3(GraphicsDevice.Presenter.BackBuffer.Width, GraphicsDevice.Presenter.BackBuffer.Height, 1);
            spriteBatch = new SpriteBatch(GraphicsDevice) { VirtualResolution = virtualResolution };

            // Initialize ball's state related variables.
            resolution = new Vector2(virtualResolution.X, virtualResolution.Y);
            ballHalfSize = new Vector2(SphereWidth / 2f, SphereHeight / 2f);
            if (!IsLiveReloading)
            {
                ballPosition = resolution / 2;
                ballSpeed = new Vector2(600, -400);
            }

            // Add Graphics Layer
            var scene = SceneSystem.SceneInstance.Scene;
            var compositor = ((SceneGraphicsCompositorLayers)scene.Settings.GraphicsCompositor);
            compositor.Master.Renderers.Add(delegateRenderer = new SceneDelegateRenderer(RenderSpheres));
        }
        public override void Start()
        {
            // create the SpriteBatch used to render them
            spriteBatch = new SpriteBatch(GraphicsDevice) { VirtualResolution = new Vector3(virtualResolution, 1000) };

            // initialize parameters
            textHeight = Font.MeasureString(KeyboardSessionString).Y;
            screenSize = new Vector2(virtualResolution.X, virtualResolution.Y);
            roundTextureSize = new Vector2(RoundTexture.Width, RoundTexture.Height);

            // activate the gesture recognitions
            if (!IsLiveReloading) // Live Scripting: do it only on first launch
            {
                Input.ActivatedGestures.Add(new GestureConfigDrag());
                Input.ActivatedGestures.Add(new GestureConfigFlick());
                Input.ActivatedGestures.Add(new GestureConfigLongPress());
                Input.ActivatedGestures.Add(new GestureConfigComposite());
                Input.ActivatedGestures.Add(new GestureConfigTap());
            }

            // Add Graphics Layer
            var scene = SceneSystem.SceneInstance.Scene;
            var compositor = ((SceneGraphicsCompositorLayers)scene.Settings.GraphicsCompositor);
            compositor.Master.Renderers.Add(delegateRenderer = new SceneDelegateRenderer(Render));
        }
Example #4
0
        /// <summary>
        /// Draw all text groups with SpriteBatch
        /// </summary>
        public override void Start()
        {
            // Create the SpriteBatch used to render them
            spriteBatch = new SpriteBatch(GraphicsDevice) { VirtualResolution = new Vector3(virtualResolution, 1000) };

            centerVirtualPosition = new Vector2(virtualResolution.X * 0.5f, virtualResolution.Y * 0.5f);
            screenSize = new Vector2(GraphicsDevice.Presenter.BackBuffer.Width, GraphicsDevice.Presenter.BackBuffer.Height);

            screenRenderers.Add(DrawIntroductionCategory);
            screenRenderers.Add(DrawStaticCategory);
            screenRenderers.Add(DrawDynamicCategory);
            screenRenderers.Add(DrawStyleCategory);
            screenRenderers.Add(DrawAliasCategory);
            screenRenderers.Add(DrawLanguageCategory);
            screenRenderers.Add(DrawAlignmentCategory);
            screenRenderers.Add(DrawAnimationCategory);
            
            // Add Graphics Layer
            var scene = SceneSystem.SceneInstance.Scene;
            var compositor = ((SceneGraphicsCompositorLayers)scene.Settings.GraphicsCompositor);
            compositor.Master.Renderers.Add(delegateRenderer = new SceneDelegateRenderer(DrawFont));
        }