Note that there are some explanatory texts on larger screens.

plurals
  1. POLooking for a XPCE tutorial
    text
    copied!<p>I'm going to write a simple animation in XPCE (<a href="http://en.wikipedia.org/wiki/Four_glasses_puzzle" rel="nofollow">four glasses puzzle</a> to be precise). I know absolutely nothing about XPCE so I looked up a tutorial but the results are disappointing. Could anyone point me to some materials on the following:</p> <ul> <li>working with a "canvas"</li> <li>animation</li> <li>timers</li> </ul> <p>EDIT: Okay, here's a more detailed problem: I want to draw two boxes, wait two seconds, hide the boxes, then start a timer. </p> <pre><code>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), </code></pre> <p>EDIT 2: Okay, here is another question (should I open a new question?): This is the code I'm using:</p> <pre><code>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 </code></pre> <p>I'd like to set a new bitmap for <code>B1</code>. How do I do that? Would altering <code>BM1</code> be enough? Or perhaps there is an alternative solution? I've been thinking about drawing both upright and reversed glasses off-screen and swapping them, but I'm not sure about the details of such solution.</p> <p>EDIT2': Solved it. For posterity: </p> <pre><code>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 </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload