示例#1
0
		protected void OnDrawTexture(DrawEventArgs e) {
			if (DrawTexture != null)
				DrawTexture.Invoke(this, e);
		}
示例#2
0
		protected internal void OnDraw(DrawEventArgs e) {
			if (Draw != null)
				Draw.Invoke(this, e);
		}
示例#3
0
		private void DrawControls(Renderer renderer, Rectangle rect, GameTime gameTime, bool firstDetach) {
			renderer.Begin(EBlendingMode.Default);

			DrawingRect = rect;
			DrawControl(renderer, rect, gameTime);

			DrawEventArgs args = new DrawEventArgs();
			args.Rectangle = rect;
			args.Renderer = renderer;
			args.GameTime = gameTime;
			OnDraw(args);

			renderer.End();

			DrawChildControls(renderer, gameTime, firstDetach);
		}
示例#4
0
		private void DrawChildControls(Renderer renderer, GameTime gameTime, bool firstDetachedLevel) {
			if (controls != null) {
				foreach (Control c in controls) {
					// We skip detached controls for first level after root (they are rendered separately in Draw() method)
					if (((c.Root == c.Parent && !c.Detached) || c.Root != c.Parent) && AbsoluteRect.Intersects(c.AbsoluteRect) && c.visible) {
						Manager.GraphicsDevice.ScissorRectangle = GetClippingRect(c);

						Rectangle rect = new Rectangle(c.OriginLeft - root.AbsoluteLeft, c.OriginTop - root.AbsoluteTop, c.OriginWidth, c.OriginHeight);
						if (c.Root != c.Parent && ((!c.Detached && CheckDetached(c)) || firstDetachedLevel)) {
							rect = new Rectangle(c.OriginLeft, c.OriginTop, c.OriginWidth, c.OriginHeight);
							Manager.GraphicsDevice.ScissorRectangle = rect;
						}

						renderer.Begin(EBlendingMode.Default);
						c.DrawingRect = rect;
						c.DrawControl(renderer, rect, gameTime);

						DrawEventArgs args = new DrawEventArgs();
						args.Rectangle = rect;
						args.Renderer = renderer;
						args.GameTime = gameTime;
						c.OnDraw(args);
						renderer.End();

						c.DrawChildControls(renderer, gameTime, firstDetachedLevel);

						c.DrawOutline(renderer, true);
					}
				}
			}
		}
示例#5
0
		void ClientArea_Draw(object sender, DrawEventArgs e) {
			SpriteFont font = Skin.Layers[0].Text.Font.Resource;
			Rectangle r = new Rectangle(e.Rectangle.Left, e.Rectangle.Top, e.Rectangle.Width, e.Rectangle.Height);
			int pos = 0;

			if (buffer.Count > 0) {
				EventedList<ConsoleMessage> b = GetFilteredBuffer(filter);
				int c = b.Count;
				int s = (sbVert.Value + sbVert.PageSize);
				int f = s - sbVert.PageSize;

				if (b.Count > 0) {
					for (int i = s - 1; i >= f; i--) {
						{
							int x = 4;
							int y = r.Bottom - (pos + 1) * ((int)font.LineSpacing + 0);

							string msg = ((ConsoleMessage)b[i]).Text;
							string pre = "";
							ConsoleChannel ch = (channels[((ConsoleMessage)b[i]).Channel] as ConsoleChannel);

							if ((messageFormat & EConsoleMessageFormats.ChannelName) == EConsoleMessageFormats.ChannelName) {
								pre += string.Format("[{0}]", channels[((ConsoleMessage)b[i]).Channel].Name);
							}
							if ((messageFormat & EConsoleMessageFormats.TimeStamp) == EConsoleMessageFormats.TimeStamp) {
								pre = string.Format("[{0}]", ((ConsoleMessage)b[i]).Time.ToLongTimeString()) + pre;
							}

							if (pre != "")
								msg = pre + ": " + msg;

							e.Renderer.DrawString(font,
												msg,
												x, y,
												ch.Color);
							pos += 1;
						}
					}
				}
			}
		}
示例#6
0
		private void MainWindow_Draw(object sender, DrawEventArgs e) {
			if (mBackgroundImage != null && mMainWindow != null) {
				e.Renderer.Draw(mBackgroundImage, e.Rectangle, Color.White);
			}
		}