Welcome, Guest. Please login or register.

Author Topic: Ball isn't moving  (Read 6560 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: Ball isn't moving
« on: November 04, 2010, 11:08:45 PM »
Quote
You will find the ball will bounce left and right as you wanted it to. BUT you can't close the window and on my OS3.9 4000D it will crash when killing the program.


Before closing the window and freeing the associated resources, you should ReplyMsg() any IDCMP messages that have piled up using a simple while loop. If you want to be extra safe, you can  also change your window's IDCMP flags first so that it can't receive any further messages.
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: Ball isn't moving
« Reply #1 on: November 12, 2010, 09:45:59 PM »
@Omega Space Protons

Buy this. You won't regret it.
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: Ball isn't moving
« Reply #2 on: November 15, 2010, 03:54:41 PM »
Quote from: Omega Space Protons;591938
Done. Now I just have to wait for them to ship it and we're in business.

Omega Space Protons


Well, it was certainly one of the best Amiga SW purchases I made. Even if you don't use the supplied IDE, the information on the CD is invaluable.
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: Ball isn't moving
« Reply #3 on: November 15, 2010, 04:10:42 PM »
It isn't really in the right forum, either. How about I move it to the development forum?
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: Ball isn't moving
« Reply #4 on: November 15, 2010, 09:25:47 PM »
I think the problem here is that you are waiting for the wrong stuff. You are waiting for an event to arrive. Under normal event-driven circumstances, that is the correct thing to do. However, your application is supposed to be constantly doing something, that is, animating the ball.

So, instead of waiting for an event to arrive, you should be waiting for the display refresh instead. Within that period, you iterate through the messages that have arrived at your port and perform any display updates that are required. There are a number of ways of doing this depending on whether or not you are running windowed, fullscreen or fullscreen with multibuffering.

For most fullscreen game applications, buffering is the norm since you don't want the user to ever see the items being drawn. There is a method of waiting using a "safe to switch buffers" message port that doesn't busy loop, unlike the somewhat simpler WaitBOVP() call (the latter doesn't always busy wait, in my experience, depends on the hardware it's running on).
 Anyway, there is an example of how to use this type of buffering in the RKM on the developer CD that you have purchased.
int p; // A