protected override void Initialise() { var tutorials = new Dictionary<string, Type>(); Program.FindTutorials(tutorials); Camera3D camera = new Camera3D(); drawToScreen = new DrawTargetScreen(camera); backgroundParticles = new ParticleSystem(this.UpdateManager); backgroundParticles.GlobalValues[0] = ArrowXOffset; backgroundParticles.GlobalValues[2] = (float)this.WindowWidth; backgroundParticles.GlobalValues[3] = (float)this.WindowHeight; particlesTarget = new DrawTargetTexture2D(camera, this.WindowWidth, this.WindowHeight, SurfaceFormat.Color, DepthFormat.None); particlesBlurred = new DrawTargetTexture2D(camera, this.WindowWidth / 2, this.WindowHeight / 2, SurfaceFormat.Color, DepthFormat.None); DrawTargetTexture2D inter0 = null, inter1 = null; quaterDownsample = new TextureDownsample(particlesTarget, particlesBlurred, ref inter0, ref inter1, particlesBlurred.Width, particlesBlurred.Height); inter0 = new DrawTargetTexture2D(camera, particlesBlurred.Width, particlesBlurred.Height, SurfaceFormat.Color, DepthFormat.None); blurFilter = new BlurFilter(BlurFilterFormat.SevenSampleBlur, 1, particlesBlurred, inter0); backroundDrawer = new VelocityBillboardParticles2DElement(backgroundParticles, false); particlesTarget.Add(backroundDrawer); //draw the resolved particles to the screen drawToScreen.Add(new TexturedElement(particlesTarget, new Vector2(1, 1), true)); //background block other elements are inserted into. invisible var selectionBlock = new Xen.Ex.Graphics2D.SolidColourElement(new Color(0, 0, 0, 0), new Vector2(ElementWidth, tutorials.Count * ElementSeparation)); selectionBlock.AlphaBlendState = AlphaBlendState.Alpha; selectionBlock.VerticalAlignment = VerticalAlignment.Top; this.menuBlock = selectionBlock; int y_pos = 0; foreach (var tutorial in tutorials) { var tut_item = new TutorialSelection(tutorial.Key, y_pos, this.Content, selectionBlock, this.UpdateManager, tutorial.Value); y_pos -= ElementSeparation; buttons.Add(tut_item); } drawToScreen.Add(selectionBlock); var bloom = new TexturedElement(particlesBlurred, new Vector2(1, 1), true); bloom.AlphaBlendState = AlphaBlendState.AdditiveSaturate; drawToScreen.Add(bloom); this.logo = new TexturedElement(new Vector2(282,100)); this.logo.VerticalAlignment = VerticalAlignment.Top; this.logo.HorizontalAlignment = HorizontalAlignment.Centre; this.logo.Position = new Vector2(0, -50); this.helperText = new TextElementRect(new Vector2(800,100),"Use the DPAD to select an item, press 'A' to run the example\nWhen running an example, press 'back' to return to this menu"); this.helperText.VerticalAlignment = VerticalAlignment.Bottom; this.helperText.HorizontalAlignment = HorizontalAlignment.Centre; this.helperText.TextHorizontalAlignment = TextHorizontalAlignment.Centre; this.helperText.TextVerticalAlignment = VerticalAlignment.Centre; this.helperText.Colour = Color.Gray; drawToScreen.Add(logo); drawToScreen.Add(helperText); }
public TutorialSelection(string text, int y_pos, IContentRegister content, ElementRect parent, UpdateManager update, Type value) { this.Value = value; this.YPos = XenMenuApp.ElementHeight * 0.5f - y_pos; background = new SolidColourElement[3]; for (int i = 0; i < background.Length; i++) { background[i] = new SolidColourElement(Color.Black, new Vector2(parent.Size.X, XenMenuApp.ElementHeight)); background[i].VerticalAlignment = VerticalAlignment.Top; background[i].HorizontalAlignment = HorizontalAlignment.Left; background[i].Position = new Vector2(0, (float)y_pos); parent.Add(background[i]); } //offset the elements a bit, to give a 3D effect. background[1].AlphaBlendState = AlphaBlendState.ModulateX2; background[2].AlphaBlendState = AlphaBlendState.ModulateX2; background[1].Size -= new Vector2(1, 1); background[1].Position += new Vector2(1, 0); background[2].Size -= new Vector2(1, 1); background[2].Position -= new Vector2(0, 1); this.text = new TextElementRect(new Vector2(parent.Size.X - XenMenuApp.ElementTextOffset, XenMenuApp.ElementHeight), text); this.text.VerticalAlignment = VerticalAlignment.Top; this.text.HorizontalAlignment = HorizontalAlignment.Left; this.text.Position = new Vector2(XenMenuApp.ElementTextOffset, (float)y_pos); parent.Add(this.text); content.Add(this); update.Add(this); }