/// <summary> /// Renders this box on the screen. /// </summary> /// <param name="view">The UI view.</param> /// <param name="delta">The time since the last render.</param> public override void Render(ViewUI2D view, double delta) { int x = LastAbsolutePosition.X; int y = LastAbsolutePosition.Y; float w = LastAbsoluteSize.X; float h = LastAbsoluteSize.Y; GameEngineBase engine = view.Engine; if (Color.W > 0.0f) { view.Rendering.SetColor(Color); } else { view.Rendering.SetColor(Vector4.One); } if (GetTexture != null) { GL.BindTexture(TextureTarget.Texture2D, GetTexture()); } else { engine.Textures.White.Bind(); } if (Flip) { view.Rendering.RenderRectangle(view.UIContext, x, y + h, x + w, y, new Vector3(-0.5f, -0.5f, LastAbsoluteRotation)); } else { view.Rendering.RenderRectangle(view.UIContext, x, y, x + w, y + h, new Vector3(-0.5f, -0.5f, LastAbsoluteRotation)); } view.Rendering.SetColor(Vector4.One); engine.Textures.White.Bind(); }
/// <summary> /// Initialize the sound engine. /// </summary> /// <param name="tclient">The backing client.</param> public void Init(GameEngineBase tclient) { if (AudioInternal != null) { AudioInternal.Shutdown(); } if (Context != null) { Context.Dispose(); } Client = tclient; Context = new AudioContext(AudioContext.DefaultDevice, 0, 0, false, true); if (Client.EnforceAudio) { AudioInternal = new AudioEnforcer(); AudioInternal.Init(Context); Context = null; } else { Context.MakeCurrent(); } /*try * { * if (Microphone != null) * { * Microphone.StopEcho(); * } * Microphone = new MicrophoneHandler(this); * } * catch (Exception ex) * { * SysConsole.Output("Loading microphone handling", ex); * }*/ if (Effects != null) { foreach (SoundEffect sfx in Effects.Values) { sfx.Internal = -2; } } Effects = new Dictionary <string, SoundEffect>(); PlayingNow = new List <ActiveSound>(); //DeafLoop = GetSound("sfx/ringing/earring_loop"); }
/// <summary> /// Renders this input box on the screen. /// </summary> /// <param name="view">The UI view.</param> /// <param name="delta">The time since the last render.</param> public override void Render(ViewUI2D view, double delta) { string typed = Text; int c = 0; int cmax = 0; GameEngineBase engine = Engine; if (!/*engine.CVars.u_colortyping.ValueB*/ false) // TODO: Color Typing option! { for (int i = 0; i < typed.Length && i < MinCursor; i++) { if (typed[i] == '^') { c++; } } for (int i = 0; i < typed.Length && i < MaxCursor; i++) { if (typed[i] == '^') { cmax++; } } typed = typed.Replace("^", "^^n"); } int x = LastAbsolutePosition.X; int y = LastAbsolutePosition.Y; int w = LastAbsoluteSize.X; engine.Textures.White.Bind(); view.Rendering.SetColor(Color); view.Rendering.RenderRectangle(view.UIContext, x - 1, y - 1, x + w + 1, y + Fonts.font_default.Height + 1, new Vector3(-0.5f, -0.5f, LastAbsoluteRotation)); GL.Enable(EnableCap.ScissorTest); GL.Scissor(x, engine.Window.Height - (y + (int)Fonts.font_default.Height), w, (int)Fonts.font_default.Height); if (Selected) { float textw = Fonts.MeasureFancyText(typed.Substring(0, MinCursor + c)); float textw2 = Fonts.MeasureFancyText(typed.Substring(0, MaxCursor + cmax)); view.Rendering.SetColor(new Color4(0f, 0.2f, 1f, 0.5f)); view.Rendering.RenderRectangle(view.UIContext, x + textw, y, x + textw2 + 1, y + Fonts.font_default.Height, new Vector3(-0.5f, -0.5f, LastAbsoluteRotation)); } view.Rendering.SetColor(Color4.White); Fonts.DrawColoredText((typed.Length == 0 ? ("^)^i" + Info) : ("^0" + typed)), new Location(x, y, 0)); GL.Scissor(0, 0, engine.Window.Width, engine.Window.Height); // TODO: Bump around a stack, for embedded scroll groups? GL.Disable(EnableCap.ScissorTest); }