/******************************************************************************************** ezwMove.cpp Jim Millard for CO311 EZwindows sort visualizations ********************************************************************************************/ #include "ezwMove.h" #include <ezwin.h> #include <ray.h> #include "ezwSort.h" #include "ezwUtils.h" extern float baseline; //Bottom edge of all bars extern float tempX; //horizontal position used when swapped to a "temp" location void Move(int& from, int& to) { to = from; } /*********************************************************************************************/ void Move(RaySegment& from, RaySegment& to, const short load) { //blank out the old from.Erase(); //get and store coordinates for height float holeAX0, holeAY0, holeAX1, holeAY1; from.GetStartPoint(holeAX0, holeAY0); from.GetEndPoint(holeAX1, holeAY1); //get and store coordinates for target horizontal position float holeBX0, holeBY0, holeBX1, holeBY1; to.GetStartPoint(holeBX0, holeBY0); to.GetEndPoint(holeBX1, holeBY1); //reset location with current height and target location to.SetPoints(Position(holeBX0, holeAY0), Position(holeBX1, holeAY1)); to.SetColor(from.GetColor()); from.SetColor(Black); //show the new in its modified position to.Draw(); DelayMS(load); }