Example #1
0
        protected override bool HandleDrag(int x, int y, int dx, int dy, Event.Button button)
        {
            if (!interf.Ingame)
            {
                return(false);
            }

            if (button != Event.Button.Right)
            {
                return(false);
            }

            totalDragX += dx;
            totalDragY += dy;

            int scrollX = totalDragX / RenderMap.TILE_WIDTH;
            int scrollY = totalDragY / RenderMap.TILE_HEIGHT;

            if (interf.GetConfig(1)) // invert scrolling
            {
                map.Scroll(-scrollX, -scrollY);
            }
            else
            {
                map.Scroll(scrollX, scrollY);
            }

            interf.UpdateMinimap();

            totalDragX -= scrollX * RenderMap.TILE_WIDTH;
            totalDragY -= scrollY * RenderMap.TILE_HEIGHT;

            return(true);
        }