Code covered by the BSD License  

Highlights from
ChessPeace

image thumbnail
from ChessPeace by Zachary Danziger
Software for playing Chess and Chess Variants

DragPiece(scr,eventdata)
function DragPiece(scr,eventdata)
% function for updating piece data location
%
% %%% code for ChessPiece, v1.1 2012, ZCD %%%
%

global userLockout
% userLockout is set in "RequestMove"

% keep the user for messing with pieces if it is not their turn
if ~userLockout

cloc = get(gca,'CurrentPoint');
set(gco,'XData',[0 1]+cloc(1,1)-0.5,'YData',[0 1]+cloc(1,2)-0.5)

drawnow;
end

Contact us