我将用XPCE编写一个简单的动画(准确地说,是四杯拼图)。我对XPCE一无所知,所以我查了一个教程,但是结果令人失望。有谁能告诉我以下几点资料:
编辑:好的,这里有一个更详细的问题:我想画两个盒子,等待两秒钟,隐藏这些盒子,然后启动一个计时器。
new(@box1, box(100,100)),
send(W, display, @box1),
new(@box2, box(100,100)),
send(W, display, @box2, point(200, 200)),
% wait two seconds here
% hide the boxes here
new(Msg1, and(message(B1, relative_move, point(5, 0)),
message(B4, relative_move, point(0, 5)))),
send(W, attribute, attribute(timer, new(T, timer(0.1, Msg1)))),
send(T, start),编辑2:好的,这是另一个问题(我应该打开一个新问题吗?):这是我正在使用的代码:
get_file(0, 'glass.gif').
get_file(180, 'glass180.gif').
main(GA, GB, GC, GD) :- % e.g. main(0,0,180,0).
new(B1, figure),
get_file(GA, G1),
send(B1, display, new(BM1, bitmap(G1))),
send(BM1, transparent, @on),
send(W, display, B1, point(0,0)),
%analogically for the other three glasses我想为B1设置一个新的位图。我该怎么做?改变BM1就足够了吗?还是有其他的解决办法?我一直在考虑把垂直眼镜和反眼镜都画在屏幕外,然后换掉它们,但我不确定这种解决方案的细节。
EDIT2 2‘:解决它。为子孙后代:
send(B1, clear),
send(B1, display, bitmap('glass_while_animating_1.gif')),
send(timer(0.1), delay),
send(B1, clear),
send(B1, display, bitmap('glass_while_animating_2.gif')),
% etc发布于 2011-01-20 22:55:17
这个可搜索的pdf会有帮助吗?
链接文本
“第五章.简单的图形”谈到了一幅画(即。(画布)
在第260页中,有一个使用计时器来引入延迟的例子,第266页显示了使用计时器显示闪烁的图形。
在第40页中,提到了使用“图形->刷新”来显式强制重绘。
https://stackoverflow.com/questions/4746989
复制相似问题