Hello Renaud,

QTk tries hard to catch Tcl exceptions to report them at the Oz level.
Each method invocation on a canvas item will bounce a message between
the Oz and Tcl/Tk process, which can take some time. You can have an
easy speed up by using the asynchronous tk method instead.

C
Win={QTk.build td(canvas(handle:C))}
{Win show}
T={C newTag($)}
{C create(rect 10 10 100 100 tags:T)}
%% instead of {T move(10 10)} use:
{T tk(move 10 10)}

Warning:I didn't check this code.

A+
Donatien

Renaud De Landtsheer wrote:


I want to implement a game in Oz (a kind of Ping-Pong) with graphical
interface.
In my game, there is a ball that moves on a playground.
The graphical interface is implemented with QTk.
I have implemented the playground with a canvas an the ball is represented a circle drawn on the canvas with the command "oval".
A thread updates the position of the ball every 10 or 20 ms.

The point is that the ball does not seem to move smoothly.
Sometime I can also see two balls on the playground (one at the old position and one at the new position).

I was thinking about using double buffering to solve the "two position" problem and maybe for speeding up the ball update process but I could not find double buffering -related commands in QTk.

I know about process scheduling issues related with operating system stuff and I know I do not get a 10 or 20 ms delay. Maybe I can do something there, but what?

Any idea? Thank you.

--
Renaud De Landtsheer


_________________________________________________________________________________ mozart-users mailing list [email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users




_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to