예제 #1
0
    public PIATexture AddTexture(PIAImageData imageData, int layerIndex)
    {
        PIATexture texture = new PIATexture();

        texture.Init(imageData.Width, imageData.Height, layerIndex);
        textures.Add(texture);
        return(texture);
    }
예제 #2
0
    private void OnEnable()
    {
        if (_instance == null)
        {
            _instance = this;
        }

        //DRAWER
        drawer = new PIADrawer();
        grid   = new PIAGrid();

        //INIT INPUT AREAS
        globalInputArea              = new PIAInputArea();
        globalInputArea.OnGUIUpdate += ChangeSelectedTool;
        bodyInputArea              = new PIAInputArea();
        bodyInputArea.OnGUIUpdate += ChangeImageScaleMultiplier;
        bodyInputArea.OnGUIUpdate += (e) => drawer.OnGUIExecute(e, mouseCellCoordinate);
        bodyInputArea.OnGUIUpdate += ChangeImageOffset;
        SelectionTexture           = new PIATexture();
        SelectionTexture.Init(PIASession.Instance.ImageData.Width, PIASession.Instance.ImageData.Height, 0);

        //INIT WINDOW SECTIONS
        InitializeSections();

        //INIT GRAPHICS
        skin             = Resources.Load <GUISkin>("Skins/PIAPixelArtEditorSkin");
        pen              = PIATextureDatabase.Instance.GetTexture("pen");
        eraser           = PIATextureDatabase.Instance.GetTexture("eraser");
        squareTool       = PIATextureDatabase.Instance.GetTexture("squaretool");
        filledSquareTool = PIATextureDatabase.Instance.GetTexture("filledsquaretool");
        selectionBox     = PIATextureDatabase.Instance.GetTexture("selectionbox");
        ditheringTool    = PIATextureDatabase.Instance.GetTexture("ditheringtool");
        selectedToolBG   = PIATextureDatabase.Instance.GetTexture("sideslight");
        blackBarBG       = new Texture2D(1, 1);
        blackBarBG.SetPixel(0, 0, blackBarBGColor);
        blackBarBG.Apply();
    }