예제 #1
0
Window::Window()
:	mDisplayMode(DEFAULT_BUF), mASAP(false), mVSync(true)
{
	implCtor(); // must call first!
	dimensions(Dim(800,600));
	fps(40);
	append(inputEventHandler());
	append(windowEventHandler());
}
예제 #2
0
/**************************************************************************
**  CONSMSGHANDLER -- Handle messages from the user console (i.e. stdin)
*/
int
consMsgHandler (int fd, void *data)
{
    int n;
    char buf[2048];
    int  mytid = mbAppGet(APP_TID);


    n = read(fd, buf, 2048);		/* already saved fileno(stdin)	*/
    buf[strlen(buf) - 1] = '\0';	/* kill newline  		*/

    /*  If we see an EOF or 'quit' command, disconnect from the mbus
     *  and shutdown, otherwise process the command.
     */
    if (n <= 0 || strncmp (buf, "quit", 4) == 0) {
        mbusDisconnect (mytid);
        exit (0);

    } else
        inputEventHandler (buf); 	/* main message handler  	*/

    return (OK);
}