⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 setcursor.m

📁 国际象棋程序,解压到当前目录,在matlab窗口输入chess即可应用
💻 M
字号:
function setCursor(on_field)
% setCursor  sets the cursor on a certain field
% The cursor is set on a certain field. The cursor consists out of a from,
% to and current information. 
% The old cursor handles are deleted.
%
% Inputs:
% * global cursor ... cursor info. (i.e. from, to, current)
% * global layer ... display layer (z axis) 
%
% Outputs:
% * displays a cursor 
% * global cursor ... cursor information is set (new patches are created)
%
% Example
% Set the cursor on field e2 [7 5]
% |setCursor([7 5])|
%
% See also: cursorListener, stopCursor, reset_cursor
%
%% Signature
% Author: W.Garn
% E-Mail: wgarn@yahoo.com
% Date: 2006/03/23 12:00:00 
% 
% Copyright 2006 W.Garn
%

global cursor
global layer

cursor.from = on_field;
cursor.to   = cursor.from;
cursor.current = cursor.to;
 
xy_pos = matrix2xy(cursor.from);
if mod(xy_pos(1)+xy_pos(2)+1,2), color=[.87 .49 0]; else color=[.94 .94 .94]; end
if ~isempty(cursor.from_h)
    delete(cursor.from_h);
    delete(cursor.to_h);
end
cursor.from_h = patch(xy_pos(1)-1+[0 1 1 0],xy_pos(2)-1+[0 0 1 1],[1 1 1 1]*layer.cursor,color,'LineWidth',2,'EdgeColor','g');
cursor.to_h = patch(xy_pos(1)-1+[0 1 1 0],xy_pos(2)-1+[0 0 1 1],[1 1 1 1]*layer.cursor*1.01,color,'LineWidth',2,'EdgeColor','g');

set(cursor.from_h,'FaceAlpha',.3); % There must be a nicer way!
set(cursor.to_h,'FaceAlpha',.3); % There must be a nicer way!
%set(cursor.to_h,'ButtonDownFcn','cursorListener(gcbo,[],guidata(gcbo))');

⌨️ 快捷键说明

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