コード例 #1
0
 public static void UpdateCurrentViewport()
 {
     GraphicsContext.Assert();
     Viewport viewport = new Viewport();
     GL.GetInteger(GetPName.Viewport, out viewport.X);
     currentViewport = viewport;
 }
コード例 #2
0
            public List <MyRenderElement> TransparentRenderElementsToDraw; // if null, MyEntities.Draw() will be used

            public void Clear()
            {
                CallerID = null;

                RenderTargets    = null;
                CameraPosition   = null;
                ViewMatrix       = null;
                ProjectionMatrix = null;
                AspectRatio      = null;
                Fov      = null;
                Viewport = null;

                EnableHDR                = null;
                EnableLights             = null;
                EnableSun                = null;
                ShadowRenderer           = null;
                EnableShadowInterleaving = null;
                EnableSmallLights        = null;
                EnableSmallLightShadows  = null;
                EnableDebugHelpers       = null;
                EnableEnvironmentMapping = null;
                EnableNear               = null;

                BackgroundColor = null;

                EnableOcclusionQueries = true;
                FogMultiplierMult      = 1.0f;
                DepthToAlpha           = false;
                DepthCopy = false;

                EnabledModules       = null;
                EnabledPostprocesses = null;
                EnabledRenderStages  = null;
            }
コード例 #3
0
        /// <summary>
        /// Prepares the queue to build a new set of rendering commands.
        /// </summary>
        /// <param name="pipeline">The pipeline that describes the rendering state to use for the draw commands.</param>
        /// <param name="viewport">The render viewport to use, or <c>null</c> to use to entire render target.</param>
        /// <param name="scissor">The render scissor to use, or <c>null</c> to use the entire render target.</param>
        public void Begin(Pipeline pipeline, Viewport?viewport = null, Scissor?scissor = null)
        {
            if (IsRecording)
            {
                throw new InvalidOperationException("Cannot call RenderQueue.Begin() if the queue is already recording commands");
            }
            _currPipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline));

            // Wait for the current item to be available
            _currentItem.WaitAvailable();

            // Begin recording, setup the pipeline and render pass
            var buf = _currentItem.Buffer;

            buf.Begin(ONE_TIME_SUBMIT);
            buf.CmdBeginRenderPass(new Vk.RenderPassBeginInfo(pipeline.VkFramebuffer, pipeline.VkRenderPass, pipeline.DefaultScissor),
                                   Vk.SubpassContents.Inline);
            buf.CmdBindPipeline(Vk.PipelineBindPoint.Graphics, pipeline.VkPipeline);

            // Because these states are dynamic, we need to specify them explicity
            _currentItem.Viewport = viewport.HasValue ? viewport.Value.ToVulkanNative() : pipeline.DefaultViewport;
            _currentItem.Scissor  = scissor.HasValue ? scissor.Value.ToVulkanNative() : pipeline.DefaultScissor;
            buf.CmdSetViewport(_currentItem.Viewport);
            buf.CmdSetScissor(_currentItem.Scissor);

            // Update the tracking objects
            _currDrawCount = 0;
        }
コード例 #4
0
ファイル: BuildingsView.cs プロジェクト: gmoller/Phoenix
        public override void Update(InputHandler input, GameTime gameTime, Viewport?viewport)
        {
            if (input.IsLeftMouseButtonReleased)
            {
                var buildingIds = _gameConfigCache.GetBuildingConfigIds();

                // determine where mouse pointer is (is it over a slot? which slot?)
                var baseTopLeftX = Left + 15;
                var baseTopLeftY = Top + 25;
                foreach (var buildingId in buildingIds)
                {
                    var building      = _gameConfigCache.GetBuildingConfigById(buildingId);
                    var slot          = building.Slot;
                    var topLeftX      = baseTopLeftX + slot.X * 49;
                    var topLeftY      = baseTopLeftY + slot.Y * 25;
                    var slotRectangle = new Rectangle(topLeftX, topLeftY, 40, 20);
                    if (slotRectangle.Contains(input.MousePosition))
                    {
                        // can building be built? requirements met? not already built?
                        if (_settlementView.Settlement.BuildingReadyToBeBeBuilt(building.Name))
                        {
                            _settlementView.Settlement.AddToProductionQueue(building);
                        }
                    }
                }
            }
        }
コード例 #5
0
 public void CmdSetViewport(UInt32 firstViewport, Viewport?pViewport)
 {
     unsafe {
         Viewport  valpViewport = pViewport ?? default(Viewport);
         Viewport *ptrpViewport = pViewport != null ? &valpViewport : (Viewport *)IntPtr.Zero;
         Interop.NativeMethods.vkCmdSetViewport(this.m, firstViewport, (UInt32)(pViewport != null ? 1 : 0), ptrpViewport);
     }
 }
コード例 #6
0
        public static void UpdateCurrentViewport()
        {
            GraphicsContext.Assert();
            Viewport viewport = new Viewport();

            GL.GetInteger(GetPName.Viewport, out viewport.X);
            currentViewport = viewport;
        }
コード例 #7
0
        /// <summary>
        /// Update the current viewport
        /// </summary>
        public static void UpdateCurrentViewport()
        {
            GraphicsContext.Assert();
            int[] viewportInts = new int[4];

            GL.GetInteger(GetPName.Viewport, viewportInts);
            _currentViewport = new Viewport(viewportInts[0], viewportInts[1], viewportInts[2], viewportInts[3]);
        }
コード例 #8
0
ファイル: ViewportHelper.cs プロジェクト: vescon/QuickFont
        public static void UpdateCurrentViewport()
        {
            GraphicsContext.Assert();
            int[] viewportInts = new int[4];

            //TODO Test that this function returns the expected values -> tested, 96% sure it works.
            GL.GetInteger(GetPName.Viewport, viewportInts);
            _currentViewport = new Viewport(viewportInts[0], viewportInts[1], viewportInts[2], viewportInts[3]);
        }
コード例 #9
0
        public static void UpdateCurrentViewport()
        {
            //GraphicsContext.Assert();
            int[] viewportInts = new int[4];

            //TODO Test that this function returns the expected values -> tested, 96% sure it works.
            GL.GetInteger(GetPName.Viewport, viewportInts);
            _currentViewport = new Viewport(viewportInts[0], viewportInts[1], viewportInts[2], viewportInts[3]);
        }
コード例 #10
0
        internal void Update(GameTime gameTime, Viewport?viewport)
        {
            if (WorldView.GameStatus != GameStatus.CityView)
            {
                return;
            }

            MainFrame.Update(Input, gameTime, viewport);
            SecondaryFrame.Update(Input, gameTime, viewport);
        }
コード例 #11
0
ファイル: Control.cs プロジェクト: secgoat/GameServer
        /// <summary>
        /// Main constructor for the abstract class
        /// </summary>
        /// <param name="name">Control name</param>
        /// <param name="text">Text displayed on the control</param>
        /// <param name="PositionWidthHeight">A rectangle that specifies the position, width , height relative to the control parent</param>
        /// <param name="texture">Texture to be drawn on the control, pass null if not needed</param>
        /// <param name="font">Font used for displaying text, pass null if there's no text</param>
        /// <param name="foreColor">Color of the displayed text</param>
        /// <param name="viewport">Optional : Viewport used to render the gui, if your game contains only one viewport pass null or don't pass anything at all.</param>
        public Control(String name, String text, Rectangle PositionWidthHeight, Texture2D texture, SpriteFont font, Color foreColor, Viewport?viewport = null)
        {
            this.positionWidthHeight = PositionWidthHeight;
            this.name      = name;
            this.text      = text;
            this.font      = font;
            this.foreColor = foreColor;
            this.texture   = texture;

            this.viewport = viewport.HasValue ? viewport : null;
        }
コード例 #12
0
        public Camera2D(Vector2?VirtualViewSize = null, Viewport?RenderViewport = null)
        {
            Zoom     = 1f;
            Position = Vector2.Zero;
            Rotation = 0;
            Origin   = Vector2.Zero;
            Position = Vector2.Zero;

            VirtualRawViewSize  = VirtualViewSize;
            this.RenderViewport = RenderViewport;
        }
コード例 #13
0
 public RenderState(DepthStencilView DepthStencilView, RenderTargetView RenderTargetView,
                    Viewport?Viewport, RasterizerState RasterizerState, VertexShader VertexShader,
                    PixelShader PixelShader, GeometryShader GeometryShader)
 {
     this.DepthStencilView = DepthStencilView;
     this.RenderTargetView = RenderTargetView;
     this.Viewport         = Viewport;
     this.RasterizerState  = RasterizerState;
     this.VertexShader     = VertexShader;
     this.PixelShader      = PixelShader;
     this.GeometryShader   = GeometryShader;
 }
コード例 #14
0
ファイル: GLWrapper.cs プロジェクト: Suceru/sc2.2mobile
 public static void InitializeCache()
 {
     m_arrayBuffer          = -1;
     m_elementArrayBuffer   = -1;
     m_texture2D            = -1;
     m_activeTexturesByUnit = new int[8]
     {
         -1,
         -1,
         -1,
         -1,
         -1,
         -1,
         -1,
         -1
     };
     m_activeTextureUnit         = All.AllShaderBitsExt;
     m_program                   = -1;
     m_framebuffer               = -1;
     m_clearColor                = null;
     m_clearDepth                = null;
     m_clearStencil              = null;
     m_cullFace                  = All.False;
     m_frontFace                 = All.False;
     m_depthFunction             = All.AllShaderBitsExt;
     m_colorMask                 = null;
     m_depthMask                 = null;
     m_polygonOffsetFactor       = 0f;
     m_polygonOffsetUnits        = 0f;
     m_blendColor                = new Vector4(float.MinValue);
     m_blendEquation             = All.AllShaderBitsExt;
     m_blendEquationColor        = All.AllShaderBitsExt;
     m_blendEquationAlpha        = All.AllShaderBitsExt;
     m_blendFuncSource           = All.AllShaderBitsExt;
     m_blendFuncSourceColor      = All.AllShaderBitsExt;
     m_blendFuncSourceAlpha      = All.AllShaderBitsExt;
     m_blendFuncDestination      = All.AllShaderBitsExt;
     m_blendFuncDestinationColor = All.AllShaderBitsExt;
     m_blendFuncDestinationAlpha = All.AllShaderBitsExt;
     m_enableDisableStates       = new Dictionary <All, bool>();
     m_vertexAttribArray         = new bool?[16];
     m_rasterizerState           = null;
     m_depthStencilState         = null;
     m_blendState                = null;
     m_textureSamplerStates      = new Dictionary <int, SamplerState>();
     m_lastShader                = null;
     m_lastVertexDeclaration     = null;
     m_lastVertexOffset          = IntPtr.Zero;
     m_lastArrayBuffer           = -1;
     m_viewport                  = null;
     m_scissorRectangle          = null;
 }
コード例 #15
0
        private static float TransformWidthToViewport(float input, QFontRenderOptions options)
        {
            Viewport?v2 = options.TransformToViewport;

            if (v2 == null)
            {
                return(input);
            }
            Viewport?v1 = ViewportHelper.CurrentViewport;

            Debug.Assert(v1 != null, "v1 != null");
            return(input * (v1.Value.Width / v2.Value.Width));
        }
コード例 #16
0
        /// <summary>
        /// Transforms a given input position to the current viewport
        /// </summary>
        /// <param name="input">The untransformed position</param>
        /// <returns>The transformed position</returns>
        private Vector2 TransformPositionToViewport(Vector2 input)
        {
            Viewport?v2 = Options.TransformToViewport;

            if (v2 == null)
            {
                return(input);
            }
            Viewport?v1 = ViewportHelper.CurrentViewport;

            Debug.Assert(v1 != null, "v1 != null");
            var x = (input.X - v2.Value.X) * (v1.GetValueOrDefault().Width / v2.Value.Width);
            var y = (input.Y - v2.Value.Y) * (v1.GetValueOrDefault().Height / v2.Value.Height);

            return(new Vector2(x, y));
        }
コード例 #17
0
        /// <summary>
        /// Transforms a given size to the current viewport
        /// </summary>
        /// <param name="input">The untransformed size</param>
        /// <returns>The transformed size</returns>
        private SizeF TransformMeasureFromViewport(SizeF input)
        {
            Viewport?v2 = Options.TransformToViewport;

            if (v2 == null)
            {
                return(input);
            }
            Viewport?v1 = ViewportHelper.CurrentViewport;

            Debug.Assert(v1 != null, "v1 != null");
            var x = input.Width * (v2.Value.Width / v1.GetValueOrDefault().Width);
            var y = input.Height * (v2.Value.Height / v1.GetValueOrDefault().Height);

            return(new SizeF(x, y));
        }
コード例 #18
0
        /// <summary>
        ///     Initialise QFont from a .qfont file
        /// </summary>
        /// <param name="qfontPath">The .qfont file to load</param>
        /// <param name="loaderConfig"></param>
        /// <param name="downSampleFactor"></param>
        /// <param name="currentProjectionMatrix">The current projection matrix to create a font pixel perfect, for.</param>
        public QFont(string qfontPath, QFontConfiguration loaderConfig, float downSampleFactor = 1.0f, Matrix4 currentProjectionMatrix = default(Matrix4))
        {
            Viewport?transToVp = null;
            float    fontScale = 1f;

            if (loaderConfig.TransformToCurrentOrthogProjection)
            {
                transToVp = OrthogonalTransform(out fontScale, currentProjectionMatrix);
            }

            InitialiseGlFont(null, new QFontBuilderConfiguration(loaderConfig), Builder.LoadQFontDataFromFile(qfontPath, downSampleFactor * fontScale, loaderConfig));
            _fontName = qfontPath;
            ViewportHelper.CurrentViewport.ToString();
            // TODO: What to do with transToVp?  Property:Matrix4 and use in QFontDrawing?
//if (transToVp != null)
//    Options.TransformToViewport = transToVp;
        }
コード例 #19
0
        private Vector2 TransformPositionToViewport(Vector2 input)
        {
            Viewport?v2 = this.Options.TransformToViewport;

            if (v2 == null)
            {
                return(input);
            }
            Viewport?v1 = ViewportHelper.CurrentViewport;

            float X, Y;

            Debug.Assert(v1 != null, "v1 != null");
            X = (input.X - v2.Value.X) * (v1.Value.Width / v2.Value.Width);
            Y = (input.Y - v2.Value.Y) * (v1.Value.Height / v2.Value.Height);

            return(new Vector2(X, Y));
        }
コード例 #20
0
        private SizeF TransformMeasureFromViewport(SizeF input)
        {
            Viewport?v2 = this.Options.TransformToViewport;

            if (v2 == null)
            {
                return(input);
            }
            Viewport?v1 = ViewportHelper.CurrentViewport;

            float X, Y;

            Debug.Assert(v1 != null, "v1 != null");
            X = input.Width * (v2.Value.Width / v1.Value.Width);
            Y = input.Height * (v2.Value.Height / v1.Value.Height);

            return(new SizeF(X, Y));
        }
コード例 #21
0
        /// <summary>
        /// Initialise QFont from a font file
        /// </summary>
        /// <param name="fontPath">The font file to load</param>
        /// <param name="size">The size.</param>
        /// <param name="config">The configuration.</param>
        /// <param name="style">The style.</param>
        /// <param name="currentProjectionMatrix">The current projection matrix to create a font pixel perfect, for.</param>
        public QFont(string fontPath, float size, QFontBuilderConfiguration config,
                     FontStyle style = FontStyle.Regular, Matrix4 currentProjectionMatrix = default(Matrix4))
        {
            Viewport?transToVp = null;
            float    fontScale = 1f;

            if (config.TransformToCurrentOrthogProjection)
            {
                transToVp = OrthogonalTransform(out fontScale, currentProjectionMatrix);
            }

            using (Font font = GetFont(fontPath, size, style, config == null ? 1 : config.SuperSampleLevels, fontScale))
            {
                _fontName = font.ToString();
                InitialiseGlFont(font, config);
            }

            // TODO: What to do with transToVp?  Property:Matrix4 and use in QFontDrawing?
            //if (transToVp != null)_fontData.Pages
            //    Options.TransformToViewport = transToVp;
        }
コード例 #22
0
 /// <summary>
 /// Sets the viewport to use .
 /// </summary>
 /// <param name="viewport">The viewport.</param>
 public void SetViewport(Viewport?viewport)
 {
     this.viewport = viewport; // TODO: support multiple viewport?
 }
コード例 #23
0
        protected Rectangle destinationRectangle; // In case image size is not equal to positionWidthHeight

        #endregion

        #region Initialization

        /// <summary>
        /// Creates a new PictureBox
        /// </summary>
        /// <param name="name">Control name</param>
        /// <param name="PositionWidthHeight">A rectangle that specifies the position, width , height relative to the control parent</param>
        /// <param name="image">Image to display</param>
        /// <param name="sizeMode">Optional,Sets image layout : Normal : the picture is displayed without resizing, StrechImage : the image is resized to fill the picture box, CenterImage : the image is centered in the PictureBox without resizing, The defualt is Normal</param>
        /// <param name="viewport">Optional : Viewport used to render the gui, if your game contains only one viewport pass null or don't pass anything at all.</param>
        public PictureBox(String name, Rectangle PositionWidthHeight, Texture2D image, SizeMode sizeMode = SizeMode.Normal, Viewport?viewport = null)
            : base(name, "", PositionWidthHeight, image, null, Color.Transparent, viewport)
        {
            // Set sizeMode & calculate source rectangle
            SizeMode = sizeMode;
        }
コード例 #24
0
 public static void InvalidateViewport()
 {
     _currentViewport = null;
 }
コード例 #25
0
ファイル: GUIControl.cs プロジェクト: MitchJH/BaseBuilder
        protected bool wasReleased = false; // To make sure that unintentional clicking doesn't happen

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Main constructor for the abstract class
        /// </summary>
        /// <param name="name">Control name</param>
        /// <param name="text">Text displayed on the control</param>
        /// <param name="PositionWidthHeight">A rectangle that specifies the position, width , height relative to the control parent</param>
        /// <param name="texture">Texture to be drawn on the control, pass null if not needed</param>
        /// <param name="font">Font used for displaying text, pass null if there's no text</param>
        /// <param name="foreColor">Color of the displayed text</param>
        /// <param name="viewport">Optional : Viewport used to render the gui, if your game contains only one viewport pass null or don't pass anything at all.</param>
        public GUIControl(String name, String text, Rectangle PositionWidthHeight, Texture2D texture, SpriteFont font, Color foreColor, Viewport? viewport = null)
        {
            this.positionWidthHeight = PositionWidthHeight;
            this.name = name;
            this.text = text;
            this.font = font;
            this.foreColor = foreColor;
            this.texture = texture;

            this.viewport = viewport.HasValue ? viewport : null;
        }
コード例 #26
0
 /// <summary>
 /// Creates a new CheckBox
 /// </summary>
 /// <param name="name">Control name</param>
 /// <param name="text">Text displayed on the control</param>
 /// <param name="PositionWidthHeight">A rectangle that specifies the position, width , height relative to the control parent</param>
 /// <param name="texture">Texture to be drawn on the control, pass null if not needed</param>
 /// <param name="font">Font used for displaying text, pass null if there's no text</param>
 /// <param name="foreColor">Color of the displayed text</param>
 /// <param name="viewport">Optional : Viewport used to render the gui, if your game contains only one viewport pass null or don't pass anything at all.</param>
 public CheckBox(String name, String text, Rectangle PositionWidthHeight, Texture2D texture, SpriteFont font, Color foreColor, Viewport?viewport = null)
     : base(name, text, PositionWidthHeight, texture, font, foreColor, viewport)
 {
     onClick += new EHandler(HandlerToggle);
 }
コード例 #27
0
 /// <summary>
 /// Creates a new RadioButton
 /// </summary>
 /// <param name="name">Control name</param>
 /// <param name="text">Text displayed on the control</param>
 /// <param name="PositionWidthHeight">A rectangle that specifies the position, width , height relative to the control parent</param>
 /// <param name="texture">Texture to be drawn on the control, pass null if not needed</param>
 /// <param name="font">Font used for displaying text, pass null if there's no text</param>
 /// <param name="foreColor">Color of the displayed text</param>
 /// <param name="viewport">Optional : Viewport used to render the gui, if your game contains only one viewport pass null or don't pass anything at all.</param>
 public RadioButton(String name, String text, Rectangle PositionWidthHeight, Texture2D texture, SpriteFont font, Color foreColor, Viewport?viewport = null)
     : base(name, text, PositionWidthHeight, texture, font, foreColor, viewport)
 {
 }
コード例 #28
0
ファイル: SecondaryFrame.cs プロジェクト: gmoller/Phoenix
 public override void Update(InputHandler input, GameTime gameTime, Viewport?viewport)
 {
     Controls.Update(input, gameTime, viewport);
 }
コード例 #29
0
        /// <summary>
        /// Creates a new button
        /// </summary>
        /// <param name="name">Control name</param>
        /// <param name="text">Text displayed on the control</param>
        /// <param name="PositionWidthHeight">A rectangle that specifies the position, width , height relative to the control parent</param>
        /// <param name="texture">Texture to be drawn on the control, pass null if not needed</param>
        /// <param name="font">Font used for displaying text, pass null if there's no text</param>
        /// <param name="foreColor">Color of the displayed text</param>
        /// <param name="viewport">Optional : Viewport used to render the gui, if your game contains only one viewport pass null or don't pass anything at all.</param>
        public Button(String name, String text, Rectangle PositionWidthHeight, Texture2D texture, SpriteFont font, Color foreColor, Viewport?viewport = null)
            : base(name, text, PositionWidthHeight, texture, font, foreColor, viewport)
        {
            sourceRectangles = new Rectangle[3];
            if (texture != null)
            {
                sourceRectangles[0] = new Rectangle(0, 0, texture.Width, texture.Height / 3);
                sourceRectangles[1] = new Rectangle(0, texture.Height / 3, texture.Width, texture.Height / 3);
                sourceRectangles[2] = new Rectangle(0, 2 * texture.Height / 3, texture.Width, texture.Height / 3);

                sourceRectangle = sourceRectangles[0];
            }
        }
コード例 #30
0
 public static void Update(this EnumerableList <IControl> list, InputHandler input, GameTime gameTime, Viewport?viewport)
 {
     foreach (var item in list)
     {
         item.Update(input, gameTime, viewport);
     }
 }
コード例 #31
0
ファイル: ImageEffect.cs プロジェクト: Ethereal77/stride
 /// <summary>
 ///   Sets the viewport to use.
 /// </summary>
 /// <param name="viewport">The viewport. Specify <c>null</c> to not set a specific viewport.</param>
 public void SetViewport(Viewport?viewport)
 {
     // TODO: Support multiple viewport?
     this.viewport = viewport;
 }
コード例 #32
0
ファイル: ImageEffect.cs プロジェクト: h78hy78yhoi8j/xenko
 /// <summary>
 /// Sets the viewport to use .
 /// </summary>
 /// <param name="viewport">The viewport.</param>
 public void SetViewport(Viewport? viewport)
 {
     this.viewport = viewport; // TODO: support multiple viewport?
 }
コード例 #33
0
        /// <summary>
        /// Creates a new DomainLeftRight
        /// </summary>
        /// <param name="name"></param>
        /// <param name="PositionWidthHeight">A rectangle that specifies the position, width , height relative to the control parent</param>
        /// <param name="texture">Texture for the TextBox in the middle</param>
        /// <param name="leftBtnTex">Texture for the left button</param>
        /// <param name="rightBtnTex">Texture for the right button</param>
        /// <param name="font">Font used for displaying text, pass null if there's no text</param>
        /// <param name="foreColor">Color of the displayed text</param>
        /// <param name="viewport">Optional : Viewport used to render the gui, if your game contains only one viewport pass null or don't pass anything at all.</param>
        public DomainLeftRight(String name, Rectangle PositionWidthHeight, Texture2D texture, Texture2D leftBtnTex, Texture2D rightBtnTex, SpriteFont font, Color foreColor, Viewport?viewport = null)
            : base(name, "", PositionWidthHeight, texture, font, foreColor, viewport)
        {
            btnLeft          = new Button("btnLeft", "", new Rectangle(0, 0, 10, positionWidthHeight.Height), leftBtnTex, font, foreColor, viewport);
            btnRight         = new Button("btnRight", "", new Rectangle(positionWidthHeight.Width - 10, 0, 10, positionWidthHeight.Height), rightBtnTex, font, foreColor, viewport);
            txtText          = new TextBox("txtText", "", 0, new Rectangle(10, 0, positionWidthHeight.Width - 20, positionWidthHeight.Height), null, font, foreColor, viewport);
            txtText.ReadOnly = true;

            this.AddControl(btnLeft);
            this.AddControl(btnRight);
            this.AddControl(txtText);

            btnLeft.onClick  += new EHandler(BtnLeft_Click);
            btnRight.onClick += new EHandler(BtnRight_Click);

            # region Child event should trigger parent event
コード例 #34
0
        /// <summary>
        /// Creates a new label control
        /// </summary>
        /// <param name="name">Control name</param>
        /// <param name="text">Text displayed on the control</param>
        /// <param name="Position">Position of the label</param>
        /// <param name="font">Font used for displaying text, pass null if there's no text</param>
        /// <param name="foreColor">Color of the displayed text</param>
        /// <param name="charsPerLine">Number of characters allowed per line, pass zero to disable wrapping</param>
        /// <param name="distanceBetweenLines">Distance between lines in pixles, must be greater than zero</param>
        /// <param name="viewport">Optional : Viewport used to render the gui, if your game contains only one viewport pass null or don't pass anything at all.</param>
        public Label(String name, String text, Vector2 position, SpriteFont font, Color foreColor, int charsPerLine, int distanceBetweenLines, Viewport?viewport = null)
            : base(name, text, new Rectangle((int)position.X, (int)position.Y, 1, 1), null, font, foreColor, viewport)
        {
            this.charsPerLine = charsPerLine;
            if (distanceBetweenLines <= 0)
            {
                distanceBetweenLines = (int)font.MeasureString("M").Y;
            }

            this.distanceBetweenLines = distanceBetweenLines;

            CalculateLayout();
        }
コード例 #35
0
 public static void InvalidateViewport()
 {
     currentViewport = null;
 }