/******************************************************************************************** ezwSwap.cpp Jim Millard for CO311 EZwindows sort visualizations ********************************************************************************************/ #include "ezwSwap.h" #include <ezwin.h> #include <ray.h> #include "ezwSort.h" #include "ezwUtils.h" #include "ezwMove.h" extern float baseline; //Bottom edge of all bars extern float tempX; //horizontal position used when swapped to a "temp" location /*********************************************************************************************/ void Swap(int& A, int& B) { int temp = A; A = B; B = temp; } /*********************************************************************************************/ void Swap(SimpleWindow& W, RaySegment& barA, RaySegment& barB, const short load) { //highlight the bars Highlight(barA,Blue); Highlight(barB,Magenta,load * 2); RaySegment* temp = new RaySegment(W, tempX,0, tempX,baseline/2, Black, barA.GetThickness()); Move(barA, *temp, load); Move(barB, barA, load); Move(*temp, barB, load); delete temp; //unhighlight the bars Highlight(barA,Red); Highlight(barB,Red); return; }