Beispiel #1
0
 public Scene(GraphicsDevice device, SpriteBatch spritebatch, GameWindow gameWindow, Effect flatShader, Effect skyboxShader, TextureCube skyboxTexture, Model skyboxModel, Effect instancingEffect)
 {
     graphics = device;
     camera   = new Camera(gameWindow, Vector3.Up, Vector3.One);
     effect   = flatShader;
     window   = gameWindow;
     this.instancingEffect = instancingEffect;
     skybox = new Skybox(skyboxTexture, skyboxShader, skyboxModel);
     device.RasterizerState = new RasterizerState();
     ready  = false;
     Canvas = new GuiControl()
     {
         Position = Vector2.Zero,
         Size     = new Vector2(device.Viewport.Bounds.Width, device.Viewport.Bounds.Height)
     };
     Canvas.AddChild(new GuiCursor());
     this.spritebatch = spritebatch;
     //effect.EnableDefaultLighting();
     // effect.PreferPerPixelLighting = false;
     //effect.World = Matrix.Identity;
 }
Beispiel #2
0
        public FormImageButton(string image, string text, Action action, bool isTranslationKey = false)
        {
            ImageUrl = image;

            GuiStackContainer stackContainer = new GuiStackContainer();

            stackContainer.Orientation = Orientation.Horizontal;
            stackContainer.ChildAnchor = Alignment.MiddleFill;
            stackContainer.Anchor      = Alignment.MiddleFill;

            Image        = new FormImage(ImageUrl);
            Image.Anchor = Alignment.MiddleLeft;
            Image.Width  = 16;
            Image.Height = 16;
            // Image.Margin = new Thickness(0, 0, 5, 0);

            Button        = new GuiStackMenuItem(text, action, isTranslationKey);
            Button.Anchor = Alignment.MiddleFill;

            //   GuiControl contr = new GuiControl();
            //   contr.AddChild(Button);

            GuiControl imgControl = new GuiControl();

            imgControl.AddChild(Image);

            GuiControl buttonCtr = new GuiControl();

            buttonCtr.AddChild(Button);

            stackContainer.AddChild(imgControl);
            stackContainer.AddChild(buttonCtr);

            AddChild(stackContainer);
            // Button.AddChild(Image);
            // base.TextElement.Anchor = Alignment.MiddleRight;
            //AddChild(Button);
            // AddChild(Image);
        }