예제 #1
0
        override public void FrequentStep()
        {
            base.FrequentStep();

            twin cursorPos = editGrid.PointToCellPos(xxi.pcam.MouseWorldPoint());

            if (xxi.Input_MouseDown_LeftButton() && editGrid.CellPosInBounds(cursorPos))
            {
                if (cursorPositions == null)
                {
                    cursorPositions = MagicWand(cursorPos);
                }
                else
                {
                    cursorPositions = null;
                }
            }
            if (cursorPositions == null)
            {
                UpdateCursors(cursorPos);
            }

            twin dir;

            if (xxi.Input_KeyDown_PushToggle())
            {
                xxi.SaveRoom(editGrid);
                xxi.SetState(xxi.state_play);
            }
            else if (xxi.Input_Key_ShowPalette())
            {
                xxi.SaveRoom(editGrid);
                xxi.SetState(xxi.state_editpalette);
            }
            else if (xxi.Input_KeyDown_Dir(out dir))
            {
                MoveRoomCoord(dir);
            }
            else
            {
                ushort cellValue;
                if (xxi.Input_Key_CellValue(out cellValue))
                {
                    if (cursorPositions != null)                       // multi select cursor
                    {
                        foreach (twin pos in cursorPositions)
                        {
                            Paint(pos, cellValue);
                        }
                    }
                    else                         // basic hover cursor
                    {
                        Paint(cursorPos, cellValue);
                    }
                }
            }
        }
예제 #2
0
        //// INTERNAL
        twin UpdateCursorPos()
        {
            twin mouseCellPos = paletteGrid.PointToCellPos(xxi.pcam.MouseWorldPoint());

            if (paletteGrid.CellPosInBounds(mouseCellPos) && ((AuthorCell)paletteGrid.GetCell(mouseCellPos)).type != (byte)AuthorCell_SuperType.Unused)
            {
                this.cursors.DoEach((cursor) => { cursor.spriter.enabled = true; cursor.position = paletteGrid.CellPosToPoint(mouseCellPos); });
            }
            else
            {
                this.cursors.DoEach((cursor) => { cursor.spriter.enabled = false; });
            }
            return(mouseCellPos);
        }