public void OnLayout(UIRenderContext rctx, ref UIElementLayout elementLayout) { m_fill.ResolveTextures(rctx); m_fill.OnLayout(rctx, elementLayout.x0, elementLayout.y0, elementLayout.x1, elementLayout.y1); if (m_element.Knob != null) { m_knobTexture = rctx.TextureManager.ResolveTexture(m_element.Knob, rctx.LayoutScale, 0, 0, 1, 1); m_knobWidth = m_element.Knob.SourceWidth; m_knobHeight = m_element.Knob.SourceHeight; } }
public void Render(UIRenderContext rctx, ref UIElementLayout layout) { UIRenderer.RColor rc, old; old = UIRenderer.GetColor(); rc.r = (float)m_element.color.r / 255.0f; rc.g = (float)m_element.color.g / 255.0f; rc.b = (float)m_element.color.b / 255.0f; rc.a = (float)m_element.color.a / 255.0f; UIRenderer.SetColor(rc); m_font.Render(rctx, m_x0, m_y0, m_fmted); UIRenderer.SetColor(old); }
public void Render(UIRenderContext rctx, ref UIElementLayout layout) { //UIRenderer.Rect(x0, y0, x1, y1); if (m_texture != null) { UIRenderer.DrawTexture(m_texture, layout.x0, layout.y0, layout.x1, layout.y1); } else { } }
public override void Reload(UICollection uic, UIElementLayout uiel) { base.Reload(uic, uiel); var temp = uiel as UIGridSaveLayout; //foreach (var item in temp.listTabItemLayouts) //{ // gridItems.Add(new UIGridTabItem()); // gridItems.Last().Reload(uic, item, this); //} if (gridCompleteRender == null || gridCompleteRender.IsDisposed) { gridCompleteRender = new RenderTarget2D(Game1.graphics.GraphicsDevice, size.X, size.Y); } }
public void OnLayout(UIRenderContext rctx, ref UIElementLayout elementLayout) { if (m_f0 != null) { m_f0.ResolveTextures(rctx); m_f1.ResolveTextures(rctx); m_f2.ResolveTextures(rctx); } if (m_font != null) m_formattedText = m_font.FormatText(rctx, m_element.Text, m_element.Style.FontStyle.PixelSize); else m_formattedText = null; if (m_element.TextureNormal != null) m_normal = rctx.TextureManager.ResolveTexture(m_element.TextureNormal, rctx.LayoutScale, 0, 0, 1, 1); if (m_element.TexturePressed != null) m_pressed = rctx.TextureManager.ResolveTexture(m_element.TexturePressed, rctx.LayoutScale, 0, 0, 1, 1); }
public void Render(UIRenderContext rctx, ref UIElementLayout layout) { if (UIElementLogic.Button(rctx.InputManager, this, layout.x0, layout.y0, layout.x1, layout.y1, m_touchInteraction)) { // clicked. if (m_element.Event.Length > 0) rctx.EventHandler.OnEvent(m_element.Event); } // behold the prettiness. switch (UIElementLogic.GetButtonVisualState(rctx.InputManager, this, m_touchInteraction)) { case UIElementLogic.ButtonVisualStates.NORMAL: UIRenderer.SetColor(new UIRenderer.RColor(1,1,1,1)); if (m_f0 != null) m_f0.Draw(rctx, layout.x0, layout.y0, layout.x1, layout.y1); if (m_normal != null) UIRenderer.DrawTexture(m_normal, layout.x0, layout.y0, layout.x1, layout.y1); break; case UIElementLogic.ButtonVisualStates.MOUSEOVER: UIRenderer.SetColor(new UIRenderer.RColor(1,1,1,1)); if (m_f1 != null) m_f1.Draw(rctx, layout.x0, layout.y0, layout.x1, layout.y1); if (m_normal != null) UIRenderer.DrawTexture(m_normal, layout.x0, layout.y0, layout.x1, layout.y1); break; case UIElementLogic.ButtonVisualStates.PRESSED: UIRenderer.SetColor(new UIRenderer.RColor(1,1,1,1)); if (m_f2 != null) m_f2.Draw(rctx, layout.x0, layout.y0, layout.x1, layout.y1); if (m_pressed != null) UIRenderer.DrawTexture(m_pressed, layout.x0, layout.y0, layout.x1, layout.y1); break; } UIRenderer.SetColor(new UIRenderer.RColor(1,1,1,1)); if (m_font != null && m_formattedText != null) m_font.Render(rctx, (layout.x0 + layout.x1 - m_formattedText.x1) / 2, (layout.y0 + layout.y1 - (m_formattedText.y1 - m_formattedText.y0)) / 2 - m_formattedText.y0, m_formattedText); }
public void OnLayout(UIRenderContext rctx, ref UIElementLayout elementLayout) { float wrapLength = 0; if (m_element.WordWrap) wrapLength = elementLayout.x1 - elementLayout.x0; m_fmted = m_font.FormatText(rctx, m_element.Text, m_element.pixelSize, wrapLength); if (m_fmted == null) return; switch (m_element.HorizontalAlignment) { case outki.UIHorizontalAlignment.UIHorizontalAlignment_Center: m_x0 = (elementLayout.x0 + elementLayout.x1 - (m_fmted.x1 - m_fmted.x0)) / 2 - m_fmted.x0; break; case outki.UIHorizontalAlignment.UIHorizontalAlignment_Right: m_x0 = elementLayout.x1 - m_fmted.x1; break; default: // left align m_x0 = elementLayout.x0 - m_fmted.x0; break; } switch (m_element.VerticalAlignment) { case outki.UIVerticalAlignment.UIVerticalAlignment_Top: m_y0 = elementLayout.y0 - m_fmted.facey0; break; case outki.UIVerticalAlignment.UIVerticalAlignment_Bottom: m_y0 = elementLayout.y1 - m_fmted.facey1; break; default: // center // glyph actual sizes method m_y0 = (elementLayout.y0 + elementLayout.y1 - (m_fmted.y1 - m_fmted.y0)) / 2 - m_fmted.y0; break; } }
public void Render(UIRenderContext rctx, ref UIElementLayout layout) { m_fill.Draw(rctx, layout.x0, layout.y0, layout.x1, layout.y1); }
public void OnLayout(UIRenderContext rctx, ref UIElementLayout elementLayout) { m_fill.ResolveTextures(rctx); m_fill.OnLayout(rctx, elementLayout.x0, elementLayout.y0, elementLayout.x1, elementLayout.y1); }
public void Render(UIRenderContext rctx, ref UIElementLayout layout) { m_fill.Draw(rctx, layout.x0, layout.y0, layout.x1, layout.y1); if (m_knobTexture == null) return; // Current knob float h_width = 0.5f * rctx.LayoutScale * m_knobWidth; float h_height = 0.5f * rctx.LayoutScale * m_knobHeight; float x = layout.x0 + m_value * (layout.x1 - layout.x0); float y = layout.y0 + m_value * (layout.y1 - layout.y0); float x0 = x - h_width; float y0 = y - h_height; float x1 = x + h_width; float y1 = y + h_height; UIRenderer.DrawTexture(m_knobTexture, x0, y0, x1, y1); float displayVal = m_value; UIInputManager im = rctx.InputManager; float dragX = 0, dragY = 0; if (!m_dragMouse) { bool pr = (m_ti.PressedByTouchId != -1); im.TouchHitTest(x - 0.70f * h_width, y - 0.70f * h_height, x + 0.70f * h_width, y + 0.70f * h_height, ref m_ti); if (!pr && m_ti.PressedByTouchId != -1) { // touched. m_dragTouch = true; m_preDragValue = m_value; } else if (m_ti.PressedByTouchId == -1) { m_dragTouch = false; } if (m_dragTouch) { dragX = m_ti.CurrentLocation.x - m_ti.PressedLocation.x; dragY = m_ti.CurrentLocation.y - m_ti.PressedLocation.y; } } /* if (!m_dragTouch) { if (!im.m_state.MouseDown) { if (im.MouseHitTest(x0, y0, x1, y1)) im.m_mouseInteraction.ObjectOver = this; else if (im.m_mouseInteraction.ObjectOver == this) im.m_mouseInteraction.ObjectOver = null; } if (im.m_mouseInteraction.ObjectOver == this) { if (im.m_state.MouseDown) { im.m_mouseInteraction.ObjectPressed = this; m_dragStartX = im.m_state.MouseX; m_dragStartY = im.m_state.MouseY; m_preDragValue = m_value; m_dragMouse = true; } } if (im.m_mouseInteraction.ObjectPressed == this) { dragX = im.m_state.MouseX - m_dragStartX; dragY = im.m_state.MouseY - m_dragStartY; im.m_mouseInteraction.ObjectOver = im.MouseHitTest(x0, y0, x1, y1) ? this : null; if (!im.m_state.MouseDown) { im.m_mouseInteraction.ObjectPressed = null; m_dragMouse = false; } } } */ if (m_dragMouse || m_dragTouch) { float w = (layout.x1-layout.x0); float h = (layout.y1-layout.y0); float deltaDot = dragX * w + dragY * h; float delta = deltaDot / (w*w + h*h); m_value = m_preDragValue + delta; if (m_value < 0.0f) m_value = 0.0f; else if (m_value > 1.0f) m_value = 1.0f; } }
public void Render(UIRenderContext rctx, ref UIElementLayout elementLayout) { }
public void OnLayout(UIRenderContext rctx, ref UIElementLayout elementLayout) { if (m_element.texture != null) m_texture = rctx.TextureManager.ResolveTexture(m_element.texture, rctx.LayoutScale, 0, 0, 1, 1); }
public void Reload(UICollection uic, UIElementLayout uiel, UIGrid parent) { base.Reload(uic, uiel); this.parent = parent; }