setfiguresposition.m

来自「国际象棋程序,解压到当前目录,在matlab窗口输入chess即可应用」· M 代码 · 共 35 行

M
35
字号
function setFiguresPosition(handle,to)
% setFiguresPosition  Set the position of a chess figure.
% The position of a given chess figure is set.
%
% Inputs:
% * handle ... handle to the chess figure
% * to ... position in matrix notation
%
% Outputs:
% * Changes the chess figures position a specified
%
% Example
% Assume a figure with "handle" should be placed at [2 3].
% The command |setFiguresPosition(handle,[2 3])| manages that.
%
% See also: show
%
%% Signature
% Author: W.Garn
% E-Mail: wgarn@yahoo.com
% Date: 2006/03/23 12:00:00 
% 
% Copyright 2006 W.Garn
%
global board
if board.which_set==1
    op = get(handle,'Position');
    set(handle,'Position',[to(2)-.5,9-to(1)-.5, op(3)]);
else
    set(handle,'XData',to(2)-1+[.1 .9]);
    set(handle,'YData',8-to(1)+[.1 .9]);    
end


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?