private void glControl1_Load(object sender, EventArgs e) { glControl1.VSync = true; myViewPort = new Viewport(0, 0, glControl1.Width, glControl1.Height); myCamera = new Camera(myViewPort); myCameraEventHandler = new CameraEventHandler(myCamera); myCamera.position = new Vector3(-1, 1, -1); myCamera.lookAt(Vector3.Zero); myParticleSystem = ParticleManager.loadDefinition("../data/particleSystems/ringOfFire.json"); particleSystemPropGrid.SelectedObject = myParticleSystem; updateFeatureCollection(); GL.ClearColor(0.2f, 0.2f, 0.2f, 1.0f); //setup the rendering scene myView = new Graphics.View("Main View", myCamera, myViewPort); Pass p = new Pass("model", "forward-lighting"); p.clearTarget = true; p.filter = new TypeFilter(new List <String>() { "light", "staticModel", "skinnedModel", "particle" }); myView.addPass(p); //create the default font myFont = FontManager.findFont("FREESANS"); //add the view Renderer.views[myView.name] = myView; //add the ground plane //Renderer.renderables.Add(new SimpleModel(SimpleModel.SimpleModelType.TEXURED_PLANE, new Vector3(0f, 0f, 0f), 10.0f, Color4.White)); Renderer.renderables.Add(myParticleSystem); //setup the timer myRenderTimer.Interval = 5; myRenderTimer.Tick += renderTimerElapsed; myRenderTimer.Start(); myIsLoaded = true; }
protected override void OnConstruct() { base.OnConstruct(); ClearChildren(); var ss = text.Split('\n'); foreach (var s in ss) { var str = s; Font font = new Font { SystemFont = new System.Drawing.Font(Fonts.DefaultFontFamily, 20, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel), Color = System.Drawing.Color.White, Backdrop = System.Drawing.Color.Black }; int marginTop = 0, marginBottom = 0; if (str.StartsWith("[i]")) { font.SystemFont = new System.Drawing.Font(Fonts.DefaultFontFamily, 30, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Pixel); str = str.Substring(3); marginTop = 60; marginBottom = 10; } if (str.StartsWith("[e=")) { int end = str.IndexOf(']'); font.Encoding = Encoding.GetEncoding(str.Substring(3, end - 3)); str = str.Substring(end + 1); } if(str.StartsWith("[DML]")) { Control c; AddChild(c = new Control { Size = new Vector2(1280, 600) }); c.AddChild(new Control { Anchor = Orientation.Center, Background = new ImageGraphic { Texture = new TextureFromFile("Interface/Common/DeadMeetsLead1.png") { DontScale = true }, }, Size = new Vector2(1100, 502) }); } else if (str.StartsWith("[Keldyn]")) { Control c; AddChild(c = new Control { Size = new Vector2(1280, 600) }); c.AddChild(new Control { Anchor = Orientation.Center, Background = new ImageGraphic { Texture = new TextureFromFile("Interface/Common/KeldynLogo1.png") { DontScale = true }, }, Size = new Vector2(300, 433) }); } else { AddChild(new Label { Background = null, Clickable = false, Size = new Vector2(1280, 30), Overflow = global::Graphics.TextOverflow.Ignore, TextAnchor = global::Graphics.Orientation.Center, Font = font, Margin = new System.Windows.Forms.Padding(0, marginTop, 0, marginBottom), Text = str }); } } Position = new Vector2(0, -Size.Y + acc); }