예제 #1
0
        /// <see cref="IUIRenderContext.RenderString"/>
        public void RenderString(UIString str, RCIntVector position, RCIntVector textboxSize, UIStringAlignment alignment)
        {
            if (this.objectDisposed)
            {
                throw new ObjectDisposedException("UIRenderLoopBase");
            }
            if (!this.isRendering)
            {
                throw new UIException("Access denied on screen render context!");
            }
            if (str == null)
            {
                throw new ArgumentNullException("str");
            }
            if (position == RCIntVector.Undefined)
            {
                throw new ArgumentNullException("position");
            }
            if (textboxSize == RCIntVector.Undefined)
            {
                throw new ArgumentNullException("textboxSize");
            }
            if (textboxSize.X <= 0 || textboxSize.Y <= 0)
            {
                throw new ArgumentOutOfRangeException("textboxSize");
            }

            this.RenderString_i(str, position, textboxSize, alignment);
        }
예제 #2
0
        /// <see cref="IUIRenderContext.RenderString"/>
        public void RenderString(UIString str, RCIntVector position, int width)
        {
            if (this.objectDisposed)
            {
                throw new ObjectDisposedException("UIRenderLoopBase");
            }
            if (!this.isRendering)
            {
                throw new UIException("Access denied on screen render context!");
            }
            if (str == null)
            {
                throw new ArgumentNullException("str");
            }
            if (position == RCIntVector.Undefined)
            {
                throw new ArgumentNullException("position");
            }
            if (width <= 0)
            {
                throw new ArgumentOutOfRangeException("width");
            }

            this.RenderString_i(str, position, width);
        }
예제 #3
0
        /// <see cref="IUIRenderContext.RenderSprite"/>
        public void RenderString(UIString str, RCIntVector position)
        {
            if (!this.enabled)
            {
                throw new InvalidOperationException("Render context is not enabled!");
            }
            if (str == null)
            {
                throw new ArgumentNullException("str");
            }
            if (position == RCIntVector.Undefined)
            {
                throw new ArgumentNullException("position");
            }

            /// Render only if target object is not clipped
            if (this.absClipRectCache.Value != RCIntRectangle.Undefined)
            {
                int cursorX = position.X;
                int cursorY = position.Y;
                foreach (UIStringFragment fragment in str.Fragments)
                {
                    if (fragment.Source != null)
                    {
                        this.RenderSprite(fragment.Source,
                                          new RCIntVector(cursorX, cursorY + fragment.Offset),
                                          fragment.Section);
                    }
                    cursorX += fragment.CursorStep;
                }
            }
        }
예제 #4
0
        /// <see cref="IUIRenderContext.RenderSprite"/>
        public void RenderString(UIString str, RCIntVector position, RCIntVector textboxSize, UIStringAlignment alignment)
        {
            if (!this.enabled)
            {
                throw new InvalidOperationException("Render context is not enabled!");
            }
            if (str == null)
            {
                throw new ArgumentNullException("str");
            }
            if (position == RCIntVector.Undefined)
            {
                throw new ArgumentNullException("position");
            }
            if (textboxSize == RCIntVector.Undefined)
            {
                throw new ArgumentNullException("textboxSize");
            }
            if (textboxSize.X <= 0 || textboxSize.Y <= 0)
            {
                throw new ArgumentOutOfRangeException("textboxSize");
            }

            /// TODO: implement this method.
            throw new NotImplementedException();
        }
예제 #5
0
        /// <see cref="IUIRenderContext.RenderSprite"/>
        public void RenderString(UIString str, RCIntVector position, int width)
        {
            if (!this.enabled)
            {
                throw new InvalidOperationException("Render context is not enabled!");
            }
            if (str == null)
            {
                throw new ArgumentNullException("str");
            }
            if (position == RCIntVector.Undefined)
            {
                throw new ArgumentNullException("position");
            }
            if (width < 0)
            {
                throw new ArgumentOutOfRangeException("width");
            }

            /// Render only if target object is not clipped
            if (this.absClipRectCache.Value != RCIntRectangle.Undefined)
            {
                int cursorX = position.X;
                int cursorY = position.Y;
                foreach (UIStringFragment fragment in str.Fragments)
                {
                    if (fragment.Source != null)
                    {
                        if (cursorX < position.X + width &&
                            cursorX + fragment.Section.Width >= position.X + width)
                        {
                            /// Render only a part of the fragment
                            this.RenderSprite(fragment.Source,
                                              new RCIntVector(cursorX, cursorY + fragment.Offset),
                                              new RCIntRectangle(fragment.Section.X,
                                                                 fragment.Section.Y,
                                                                 width - cursorX + position.X,
                                                                 fragment.Section.Height));
                        }
                        else
                        {
                            /// Render the whole fragment
                            this.RenderSprite(fragment.Source,
                                              new RCIntVector(cursorX, cursorY + fragment.Offset),
                                              fragment.Section);
                        }
                    }
                    cursorX += fragment.CursorStep;

                    /// Stop rendering when we reached the end
                    if (cursorX >= position.X + width)
                    {
                        break;
                    }
                }
            }
        }
예제 #6
0
 /// <see cref="IUIRenderContext.RenderString"/>
 protected abstract void RenderString_i(UIString str, RCIntVector position, RCIntVector textboxSize, UIStringAlignment alignment);
예제 #7
0
 /// <see cref="IUIRenderContext.RenderString"/>
 protected abstract void RenderString_i(UIString str, RCIntVector position, int width);