Ejemplo n.º 1
0
 /// <summary>
 ///   constructor for a normal sprite
 /// </summary>
 public Sprite2D(string textureName, int x, int y, int width, int height, float depth = 0.5f, float opacity = 1, float spriteRepeatX = 1, float spriteRepeatY = 1)
 {
     _texture = Singleton.ContentManager.Load<Texture2D>(Singleton.ContentStrLookup[textureName]);
     _srcRect = new FloatingRectangle(0f, 0f, _texture.Height*spriteRepeatX, _texture.Width*spriteRepeatY);
     _destRect = new Rectangle();
     _isDisposed = false;
     _renderPanel = RenderPanel.Add(this);
     X = x;
     Y = y;
     Width = width;
     Height = height;
     Depth = depth;
     Opacity = opacity;
     Enabled = true;
 }
Ejemplo n.º 2
0
        protected HullEditorPanel(int x, int y, int width, int height, string defaultCurveConfiguration, PanelAlias panelType)
        {
            BoundingBox = new FloatingRectangle(x, y, width, height);
            PanelRenderTarget = new RenderPanel(x, y, width, height, DepthLevel.Medium);
            RenderPanel.BindRenderTarget(PanelRenderTarget);

            Curves = new BezierCurveCollection(
                defaultConfig: defaultCurveConfiguration,
                areaToFill: new FloatingRectangle(
                    x + width*0.1f,
                    y + height*0.1f,
                    width - width*0.2f,
                    height - height*0.2f
                    ),
                panelType: panelType
                );
            UIElementCollection.Collection.AddDragConstraintCallback(ClampChildElements);
            Background =
                new Button(
                    x: x,
                    y: y,
                    width: width,
                    height: height,
                    depth: DepthLevel.Background,
                    textureName: "HullEditorBgTex",
                    spriteTexRepeatX: width/(Curves.PixelsPerMeter*1),
                    spriteTexRepeatY: height/(Curves.PixelsPerMeter*1),
                    components: new IUIComponent[]{new PanelComponent()}
                    );
            Update();
        }