1
我打算在XPCE中编写一个简单的动画(准确地说是four glasses puzzle)。我对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':解决了它。为后人:
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
你能解释一下更多关于“画布”的含义吗?您是否在考虑开发图像资源的工具?或者它与控制一个“窗口”是一样的吗? – hardmath 2011-01-20 15:37:44