9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: paurea@plan9.escet.urjc.es
To: 9fans@cse.psu.edu
Subject: [9fans] events
Date: Wed, 19 Feb 2003 14:20:22 +0100	[thread overview]
Message-ID: <94840a20e30fc47c51d9344bc2a4974c@plan9.escet.urjc.es> (raw)

I am trying to do this Inkey is 4.

	estart(Inkey,Stdin,1); /
	einit(Emouse|Ekeyboard|Inkey);


	for (;;) {
	    keyev = event(&gev);

		switch(keyev){
			case Emouse:
				mev=gev.mouse;

				if (mev.buttons==2){
					goban[pos.x][pos.y]='w';
					drawstone(pos,'w');
			    }
				if (mev.buttons==4){
					goban[pos.x][pos.y]='d';
					drawstone(pos,'d');
				}

				if (mev.buttons==1) {
					goban[pos.x][pos.y]='b';
					drawstone(pos,'b');
				}
			break;
			case Ekeyboard:
				kbdc=gev.kbdc;
				switch(kbdc){
					case qkey:
					case esckey:
						exits(0);
					break;
				}
			break;
			case Inkey:
				print("something for us...");
				readn(Stdin,msg,1);
				if(msg[0]!='\n')
					break;
				readn(Stdin,msg,Msgsz);
				pos.x=atoi(&msg[3]);
				msg[3]='\0';
				pos.y=atoi(&msg[1]);
				drawstone(pos,msg[0]);
			break;
		}



             reply	other threads:[~2003-02-19 13:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-19 13:20 paurea [this message]
2003-02-19 13:23 paurea
2003-02-19 13:56 ` Russ Cox
2003-02-19 14:08   ` paurea
2003-02-19 14:13     ` Russ Cox
2003-02-19 14:31       ` paurea
2003-02-19 21:57 ` Russ Cox
2003-02-20 11:18   ` paurea

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=94840a20e30fc47c51d9344bc2a4974c@plan9.escet.urjc.es \
    --to=paurea@plan9.escet.urjc.es \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).