public PLCView(string name, string heading, int x, int y, int width, int height) : base(name, x, y, width, height) { //this.GraphicsUnit = GraphicsUnit.Inch; fTeamLogo = new TextBox("Team Logo","Tahoma",14,GDIFont.FontStyle.Regular,0,0,160,60,RGBColor.Black); fLegend = null; fCS = new PLCColorScheme(); //fTransitionAnimator = new CrossFade(); fDataBinder = null; fBackingPixelBuffer = new GDIDIBSection(width, height); fBackingGraphics = fBackingPixelBuffer.GraphPort; //fBackingGraphics.PageUnit = GraphicsUnit.Inch; fHeading = heading; // These are the set of virtual calls // That any subclasser will implement AddMasterHeading(); AddPhaseArrows(); AddPhaseHeadings(); AddStageHeadings(); AddDeliveryContainers(); AddImages(); AddLegend(); AddTeamLogo(); //DrawSelf(fBackingGraphics); }
protected override void ondraw(GLRenderable item) { var mgl = MonoGL.instance; XnaMath.Rectangle srcRectangle; if (item.sourceRectangle.IsNull) { srcRectangle = new XnaMath.Rectangle(0, 0, texture.Width, texture.Height); } else { srcRectangle = item.sourceRectangle.ToRect(); } var _origin = (new Vector2(srcRectangle.Width, srcRectangle.Height) * item.pivot);// +new Vector2(srcRectangle.Value.X, srcRectangle.Value.Y); var origin = new XnaMath.Vector2(_origin.X, _origin.Y); //var p = item.position + item.scale * _origin; var p = item.position; //if (item.type == GLRenderableType.Quad) p += item.scale * item.pivot; var s = item.scale; var destRectangle = p.ToRectangle(s); var depth = 0f; if (mgl.depthRange > 0f) { depth = (item.depth - mgl._minDepth) / mgl.depthRange; } var color = new XnaMath.Color(item.color.r, item.color.g, item.color.b, item.color.a); mgl.batch.Draw(texture, destRectangle, srcRectangle, color, item.rotation, origin, Microsoft.Xna.Framework.Graphics.SpriteEffects.None, 1f - depth); }
private void updateBatchState(GLRenderable item) { if (materialState == null) { setBatchState(item); } else if (materialState != item.material) { setBatchState(item); } else if (item.applyScissor != applyingScissor) { setBatchState(item); } else if (item.applyScissor && applyingScissor && !checkScissorRect(item.scissorRect)) { setBatchState(item); } else if ((spritesSubmittedThisBatch % 2048) == 0) { setBatchState(item); } }
//private HashSet<string> crap = new HashSet<string>(); internal void setBatchState(GLRenderable item) { endBatchState(); item.material.enable(); var _rasterizer = rasterizerState; if (item.applyScissor) { _rasterizer = scissorRasterizerState; batch.GraphicsDevice.ScissorRectangle = new XnaMath.Rectangle((int)item.scissorRect.X0, (int)item.scissorRect.Y0, (int)item.scissorRect.Width, (int)item.scissorRect.Height); applyingScissor = true; } var width = _device.PresentationParameters.Bounds.Width; var height = _device.PresentationParameters.Bounds.Height; var position = Vector2.Zero; var orientation = 0f; var scale = Vector2.One; var viewMatrix = XnaMath.Matrix.CreateTranslation(new XnaMath.Vector3(-(int)position.X, -(int)position.Y, 0)) * XnaMath.Matrix.CreateRotationZ(orientation) * XnaMath.Matrix.CreateScale(scale.X, scale.Y, 1) * XnaMath.Matrix.CreateTranslation(new XnaMath.Vector3(width * 0.5f, height * 0.5f, 0)); //Matrix4.CreateTranslation(new Vector3(_viewport.Width * 0.5f, _viewport.Height * 0.5f, 0)); var viewMatrix2 = Matrix4.CreateTranslation(new Vector3(-(int)position.X, -(int)position.Y, 0)) * Matrix4.CreateRotationZ(orientation) * Matrix4.CreateScale(scale.X, scale.Y, 1) * Matrix4.CreateTranslation(new Vector3(width * 0.5f, height * 0.5f, 0)); //Matrix4.CreateTranslation(new Vector3(_viewport.Width * 0.5f, _viewport.Height * 0.5f, 0)); batch.Begin(SpriteSortMode.Deferred, blendState, samplerState, depthState, _rasterizer, effect, viewMatrix2.ToXnaMatrix()); }
protected abstract void ondraw(GLRenderable item);
public void draw(GLRenderable item) { checkDisposed(); ondraw(item); }
public virtual void AddTeamLogo() { fTeamLogoBox = new GraphicGroup("teamlogo",797, 573,169,88); //fTeamLogoBox.LayoutHandler = new LinearLayout(fTeamLogoBox, 1, 1, Orientation.Horizontal); AddGraphic(fTeamLogoBox); fTeamLogoBox.AddGraphic(TeamLogo); }