Download Amiga Intuition Reference Manual

Transcript
FOREVER
{
/* Wait until some message arrives at the port */
Wait(1 << MyWindow->UserPort->mp_SigBit);
/* Now, one or more messages have arrived. Respond to all of them.
* First, set up to accumulate mouse moves (rather than responding
* to each one as it comes in)
*/
MouseMoved = FALSE;
while (message = GetMsg(MyWindow->UserPort))
{
/* First, gather some relevant information and then reply right away!*/
class = message->Class;
code = message->Code;
address = message->IAddress;
x = message->MouseX;
y = message- >MouseY;
ReplyMsg(message);
if (class = = MOUSEMOVE) MouseMoved = TRUE;
else (ProcessMessage(class, code, address, x, y));
}
/* If the mouse moved during the loop, respond to it now*/
if (MouseMoved) ProcessMove(x, y);
}
Using the Console Device
The following discussion is a brief description of how you open and use the console device.
For full details, refer to the Amiga ROM Kernel Manual and the AmigaDOS Technical
Reference Manual.
There are two ways to open the console device. You can use the one that gives you the power
and flexibility you want and suits the environment in which you are working. You can either
open the console device as a normal AmigaDOS file or open it directly via a call to
OpenDevice(). There are advantages and disadvantages to both approaches.
Input and Output 173