コード例 #1
0
        private void RenderGrowableHeight(GUIHost host, int x, int y, int Width, int Height)
        {
            if (Height < growableheightparams.minimum_height_pixels)
            {
                RenderNormalSprite(host, x, y, Width, Height);
            }
            else
            {
                if (texture == uint.MaxValue)
                {
                    return;
                }

                Simple2DRenderer simpleRenderer = host.GetSimpleRenderer();
                simpleRenderer.SetCurrentTexture(texture);
                cur_quad.x0 = x;
                cur_quad.y0 = y;
                cur_quad.x1 = x + Width;
                cur_quad.y1 = y + Height;
                Simple2DRenderer.TexturedQuad curQuad1 = cur_quad;
                Simple2DRenderer.TexturedQuad curQuad2 = cur_quad;
                Simple2DRenderer.TexturedQuad curQuad3 = cur_quad;
                curQuad1.v1 = curQuad1.v0 + growableheightparams.topbordersize_texels;
                curQuad1.y1 = curQuad1.y0 + growableheightparams.topbordersize_pixels;
                curQuad3.v0 = curQuad3.v1 - growableheightparams.bottombordersize_texels;
                curQuad3.y0 = curQuad3.y1 - growableheightparams.bottombordersize_pixels;
                curQuad2.y0 = curQuad1.y1;
                curQuad2.v0 = curQuad1.v1;
                curQuad2.y1 = curQuad3.y0;
                curQuad2.v1 = curQuad3.v0;
                simpleRenderer.DrawQuad(curQuad1);
                simpleRenderer.DrawQuad(curQuad2);
                simpleRenderer.DrawQuad(curQuad3);
            }
        }
コード例 #2
0
        private void RenderGrowableWidth(GUIHost host, int x, int y, int Width, int Height)
        {
            if (Width < growablewidthparams.minimum_width_pixels)
            {
                RenderNormalSprite(host, x, y, Width, Height);
            }
            else
            {
                if (texture == uint.MaxValue)
                {
                    return;
                }

                Simple2DRenderer simpleRenderer = host.GetSimpleRenderer();
                simpleRenderer.SetCurrentTexture(texture);
                cur_quad.x0 = x;
                cur_quad.y0 = y;
                cur_quad.x1 = x + Width;
                cur_quad.y1 = y + Height;
                Simple2DRenderer.TexturedQuad curQuad1 = cur_quad;
                Simple2DRenderer.TexturedQuad curQuad2 = cur_quad;
                Simple2DRenderer.TexturedQuad curQuad3 = cur_quad;
                curQuad1.u1 = curQuad1.u0 + growablewidthparams.leftbordersize_texels;
                curQuad1.x1 = curQuad1.x0 + growablewidthparams.leftbordersize_pixels;
                curQuad3.u0 = curQuad3.u1 - growablewidthparams.rightbordersize_texels;
                curQuad3.x0 = curQuad3.x1 - growablewidthparams.rightbordersize_pixels;
                curQuad2.x0 = curQuad1.x1;
                curQuad2.u0 = curQuad1.u1;
                curQuad2.x1 = curQuad3.x0;
                curQuad2.u1 = curQuad3.u0;
                simpleRenderer.DrawQuad(curQuad1);
                simpleRenderer.DrawQuad(curQuad2);
                simpleRenderer.DrawQuad(curQuad3);
            }
        }
コード例 #3
0
        private void RenderNormalSprite(GUIHost host, int x, int y, int Width, int Height)
        {
            if (texture == uint.MaxValue)
            {
                return;
            }

            Simple2DRenderer simpleRenderer = host.GetSimpleRenderer();

            simpleRenderer.SetCurrentTexture(texture);
            cur_quad.x0 = x;
            cur_quad.y0 = y;
            cur_quad.x1 = x + Width;
            cur_quad.y1 = y + Height;
            simpleRenderer.DrawQuad(cur_quad);
        }
コード例 #4
0
        public GUIHost(Locale default_locale, float default_size, string PublicDataFolder, GLControl glControl)
        {
            m_olocaleCurrent = default_locale;
            if (m_olocaleCurrent == null)
            {
                throw new ArgumentException("default_locale can not be null");
            }

            font_mapping                              = new Dictionary <FontSize, FontInfo>();
            m_ofntCurFont                             = null;
            m_fDefaultFontSize                        = default_size;
            m_oframeRootElement                       = new Frame(0);
            m_oframeRootControlElement                = new Frame(0);
            m_oframeRootMasterElement                 = new Frame(0);
            m_odialogRootElement                      = new DialogRootWidget();
            m_oframeRootElement.RelativeX             = 0.0f;
            m_oframeRootElement.RelativeY             = 0.0f;
            m_oframeRootElement.RelativeWidth         = 1f;
            m_oframeRootElement.RelativeHeight        = 1f;
            m_oframeRootElement.IgnoreMouse           = true;
            m_odialogRootElement.RelativeX            = 0.0f;
            m_odialogRootElement.RelativeY            = 0.0f;
            m_odialogRootElement.RelativeWidth        = 1f;
            m_odialogRootElement.RelativeHeight       = 1f;
            m_odialogRootElement.IgnoreMouse          = false;
            m_oframeRootControlElement.RelativeX      = 0.0f;
            m_oframeRootControlElement.RelativeY      = 0.0f;
            m_oframeRootControlElement.RelativeWidth  = 1f;
            m_oframeRootControlElement.RelativeHeight = 1f;
            m_oframeRootControlElement.IgnoreMouse    = true;
            m_oframeRootMasterElement.AddChildElement(m_oframeRootElement);
            m_oframeRootMasterElement.AddChildElement(m_odialogRootElement);
            m_oframeRootMasterElement.AddChildElement(m_oframeRootControlElement);
            m_renderer = new Simple2DRenderer(glControl.Width, glControl.Height);
            m_renderer.SetLineWidth(2f);
            m_renderer.SetTexturePath(Path.Combine(Path.Combine(PublicDataFolder, "Data"), "GUIImages"));
            var num1 = (int)m_renderer.LoadTextureFromBitmap(Resources.controls, "guicontrols");
            var num2 = (int)m_renderer.LoadTextureFromBitmap(Resources.extended_working, "extendedcontrols");
            var num3 = (int)m_renderer.LoadTextureFromBitmap(Resources.extended_working2, "extendedcontrols2");
            var num4 = (int)m_renderer.LoadTextureFromBitmap(Resources.extended_working3, "extendedcontrols3");

            m_renderer.SetCurrentTexture(m_renderer.GetTextureByName("guicontrols"));
            tooltipFrame = new Tooltip(this);
        }
コード例 #5
0
        private void RenderGrowable(GUIHost host, int x, int y, int Width, int Height)
        {
            if (Width < growablewidthparams.minimum_width_pixels || Height < growableheightparams.minimum_height_pixels)
            {
                RenderNormalSprite(host, x, y, Width, Height);
            }
            else
            {
                if (texture == uint.MaxValue)
                {
                    return;
                }

                Simple2DRenderer simpleRenderer = host.GetSimpleRenderer();
                simpleRenderer.SetCurrentTexture(texture);
                cur_quad.x0 = x;
                cur_quad.y0 = y;
                cur_quad.x1 = x + Width;
                cur_quad.y1 = y + Height;
                Simple2DRenderer.TexturedQuad curQuad1 = cur_quad;
                Simple2DRenderer.TexturedQuad curQuad2 = cur_quad;
                Simple2DRenderer.TexturedQuad curQuad3 = cur_quad;
                curQuad1.u1 = curQuad1.u0 + growablewidthparams.leftbordersize_texels;
                curQuad1.x1 = curQuad1.x0 + growablewidthparams.leftbordersize_pixels;
                curQuad3.u0 = curQuad3.u1 - growablewidthparams.rightbordersize_texels;
                curQuad3.x0 = curQuad3.x1 - growablewidthparams.rightbordersize_pixels;
                curQuad2.x0 = curQuad1.x1;
                curQuad2.u0 = curQuad1.u1;
                curQuad2.x1 = curQuad3.x0;
                curQuad2.u1 = curQuad3.u0;
                Simple2DRenderer.TexturedQuad curQuad4 = cur_quad;
                Simple2DRenderer.TexturedQuad curQuad5 = cur_quad;
                Simple2DRenderer.TexturedQuad curQuad6 = cur_quad;
                curQuad4.v1 = curQuad4.v0 + growableheightparams.topbordersize_texels;
                curQuad4.y1 = curQuad4.y0 + growableheightparams.topbordersize_pixels;
                curQuad6.v0 = curQuad6.v1 - growableheightparams.bottombordersize_texels;
                curQuad6.y0 = curQuad6.y1 - growableheightparams.bottombordersize_pixels;
                curQuad5.y0 = curQuad4.y1;
                curQuad5.v0 = curQuad4.v1;
                curQuad5.y1 = curQuad6.y0;
                curQuad5.v1 = curQuad6.v0;
                Simple2DRenderer.TexturedQuad textured_quad1 = curQuad1;
                Simple2DRenderer.TexturedQuad textured_quad2 = curQuad2;
                Simple2DRenderer.TexturedQuad textured_quad3 = curQuad3;
                textured_quad1.v0 = textured_quad2.v0 = textured_quad3.v0 = curQuad4.v0;
                textured_quad1.v1 = textured_quad2.v1 = textured_quad3.v1 = curQuad4.v1;
                textured_quad1.y0 = textured_quad2.y0 = textured_quad3.y0 = curQuad4.y0;
                textured_quad1.y1 = textured_quad2.y1 = textured_quad3.y1 = curQuad4.y1;
                Simple2DRenderer.TexturedQuad textured_quad4 = curQuad1;
                Simple2DRenderer.TexturedQuad textured_quad5 = curQuad2;
                Simple2DRenderer.TexturedQuad textured_quad6 = curQuad3;
                textured_quad4.v0    = textured_quad5.v0 = textured_quad6.v0 = curQuad6.v0;
                textured_quad4.v1    = textured_quad5.v1 = textured_quad6.v1 = curQuad6.v1;
                textured_quad4.y0    = textured_quad5.y0 = textured_quad6.y0 = curQuad6.y0;
                textured_quad4.y1    = textured_quad5.y1 = textured_quad6.y1 = curQuad6.y1;
                curQuad1.v0          = curQuad2.v0 = curQuad3.v0 = curQuad5.v0;
                curQuad1.v1          = curQuad2.v1 = curQuad3.v1 = curQuad5.v1;
                curQuad1.y0          = curQuad2.y0 = curQuad3.y0 = curQuad5.y0;
                curQuad1.y1          = curQuad2.y1 = curQuad3.y1 = curQuad5.y1;
                curQuad1.color       = cur_quad.color;
                curQuad2.color       = cur_quad.color;
                curQuad3.color       = cur_quad.color;
                textured_quad1.color = cur_quad.color;
                textured_quad2.color = cur_quad.color;
                textured_quad3.color = cur_quad.color;
                textured_quad4.color = cur_quad.color;
                textured_quad5.color = cur_quad.color;
                textured_quad6.color = cur_quad.color;
                simpleRenderer.DrawQuad(curQuad1);
                simpleRenderer.DrawQuad(curQuad2);
                simpleRenderer.DrawQuad(curQuad3);
                simpleRenderer.DrawQuad(textured_quad1);
                simpleRenderer.DrawQuad(textured_quad2);
                simpleRenderer.DrawQuad(textured_quad3);
                simpleRenderer.DrawQuad(textured_quad4);
                simpleRenderer.DrawQuad(textured_quad5);
                simpleRenderer.DrawQuad(textured_quad6);
            }
        }