Example #1
0
        public Frame()
        {
            width  = 1165;
            height = 850;

            Texture2D texture = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, width, height, pixel => new Color(), Shapes.RECTANGLE);

            _layer1 = new BasicTexture(texture, new Vector2(width / 2, height / 2), new Vector2(width, height));
            _layer2 = new BasicTexture(texture, new Vector2(width / 2, height / 2), new Vector2(width, height));
            _layer3 = new BasicTexture(texture, new Vector2(width / 2, height / 2), new Vector2(width, height));
        }
Example #2
0
        public Frame(Vector2 givenPosition, Vector2 dimensions)
        {
            width  = (int)dimensions.X;
            height = (int)dimensions.Y;

            position  = givenPosition;
            transform = Matrix.Identity;

            drawRectangle = new Rectangle((int)position.X, (int)position.Y, width, height);

            colors    = new Texture2D[2];
            colors[0] = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, 1, 1, pixel => Color.Black, Shapes.RECTANGLE);
            Texture2D layerTexture = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, 1, 1, pixel => new Color(), Shapes.RECTANGLE);

            background = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, width, height, pixel => Color.White, Shapes.RECTANGLE);

            _layer1 = new BasicColor[(int)dimensions.X, (int)dimensions.Y];
            _layer2 = new BasicColor[(int)dimensions.X, (int)dimensions.Y];
            _layer3 = new BasicColor[(int)dimensions.X, (int)dimensions.Y];
        }
        public override void LoadContent()
        {
            selectedLayer = "_layer1";

            components = new List <UIElement>();
            Texture2D navbarBG = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, GlobalParameters.screenWidth, 32, pixel => new Color(35, 35, 35), Shapes.RECTANGLE);
            Container navbar   = new Container(navbarBG, new Vector2(0, 0), new Vector2(GlobalParameters.screenWidth, 32));

            // Create Navbar child components
            Texture2D      menuButtonTexture = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, 100, 32, pixel => new Color(35, 35, 35), Shapes.RECTANGLE);
            RedirectButton menuButton        = new RedirectButton("Menu Scene", menuButtonTexture, new Vector2(0, 0), new Vector2(100, 32), "MENU", Color.White);

            Texture2D   helpButtonTexture = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, 32, 32, pixel => new Color(100, 100, 200), Shapes.RECTANGLE);
            Overlay     helpOverlay       = new Overlay("Static\\SettingsScene/button_export", new Vector2(500, 500), new Vector2(32, 32));
            PopupButton helpButton        = new PopupButton(helpOverlay, "Static\\DrawingScene/help", new Vector2(menuButton.position.X + menuButton.dimensions.X, 0), new Vector2(32, 32));

            //Texture2D settingsButtonTexture = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, 32, 32, pixel => new Color(255, 255, 0), Shapes.RECTANGLE);
            Overlay     settingsOverlay = new Overlay("Static\\SettingsScene/button_export", new Vector2(600, 500), new Vector2(32, 32));
            PopupButton settingsButton  = new PopupButton(settingsOverlay, "Static\\DrawingScene/gear", new Vector2(helpButton.position.X + helpButton.dimensions.X, 0), new Vector2(32, 32));

            Texture2D   colorButtonTexture = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, 32, 32, pixel => new Color(200, 0, 255), Shapes.CIRCLE);
            Overlay     colorOverlay       = new Overlay(colorButtonTexture, new Vector2(1100, 500), new Vector2(32, 32));
            PopupButton colorButton        = new PopupButton(colorOverlay, colorButtonTexture, new Vector2(GlobalParameters.screenWidth - colorButtonTexture.Width, 0), new Vector2(32, 32));

            Texture2D   layerButtonTexture = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, 32, 32, pixel => new Color(0, 0, 255), Shapes.RECTANGLE);
            Overlay     layerOverlay       = new Overlay(layerButtonTexture, new Vector2(732, 500), new Vector2(32, 32));
            PopupButton layerButton        = new PopupButton(layerOverlay, "Static\\DrawingScene/layers", new Vector2(colorButton.position.X - colorButton.dimensions.X, 0), new Vector2(32, 32));

            List <RadioButton> buttons = new List <RadioButton>();

            Texture2D eraserSelectedTexture   = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, 32, 32, pixel => new Color(255, 0, 0), Shapes.RECTANGLE);
            Texture2D eraserUnselectedTexture = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, 32, 32, pixel => new Color(0, 255, 0), Shapes.RECTANGLE);

            EraserButton eraser = new EraserButton("Static\\DrawingScene/eraser_selected", "Static\\DrawingScene/eraser", false, new Vector2(layerButton.position.X - layerButton.dimensions.X, 0), new Vector2(32, 32));
            DrawButton   draw   = new DrawButton("Static\\DrawingScene/brush_selected", "Static\\DrawingScene/brush", true, new Vector2(eraser.position.X - eraser.dimensions.X, 0), new Vector2(32, 32));

            buttons.Add(draw);
            buttons.Add(eraser);

            ButtonGroup toolButtons = new ButtonGroup(buttons);
            // TODO ADD Clickable Buttons
            // +1 Frame, Last Frame, -1 Frame, First Frame, Play

            Texture2D frameCounterTexture = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, 132, 32, pixel => new Color(0, 0, 0), Shapes.RECTANGLE);
            UIElement frameCounter        = new FrameCounterComponent(frameCounterTexture, new Vector2(settingsButton.position.X + settingsButton.dimensions.X, 0), new Vector2(frameCounterTexture.Width, frameCounterTexture.Height));

            navbar.uiElements.Add(menuButton);
            navbar.uiElements.Add(helpButton);
            navbar.uiElements.Add(settingsButton);
            navbar.uiElements.Add(colorButton);
            navbar.uiElements.Add(layerButton);
            navbar.uiElements.Add(frameCounter);
            navbar.buttonGroups.Add(toolButtons);

            // Add the navbar to this scene
            components.Add(navbar);

            // Load Frame
            frames        = new List <Frame>();
            frameSize     = new Vector2(200, 200);
            framePosition = new Vector2(GlobalParameters.screenWidth / 2 - (int)frameSize.X / 2, GlobalParameters.screenHeight / 2 - (int)frameSize.Y / 2 + menuButton.dimensions.Y / 2);
            frames.Add(new Frame(framePosition, frameSize));
        }