9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] events
@ 2003-02-19 13:23 paurea
  2003-02-19 13:56 ` Russ Cox
  2003-02-19 21:57 ` Russ Cox
  0 siblings, 2 replies; 8+ messages in thread
From: paurea @ 2003-02-19 13:23 UTC (permalink / raw)
  To: 9fans

Sorry for the last message. I pressed the Post without noticing...
I am trying to do this Inkey is 4. Stdin is 0. I have noticed two things
1) einit ignores keys others than Emouse and Ekeyboard (I noticed this looking at sources)
2) I don't get the stdin events. Something for us is never printed.

Suggestions?


						Gorka

	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;
		}



^ permalink raw reply	[flat|nested] 8+ messages in thread
* [9fans] events
@ 2003-02-19 13:20 paurea
  0 siblings, 0 replies; 8+ messages in thread
From: paurea @ 2003-02-19 13:20 UTC (permalink / raw)
  To: 9fans

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;
		}



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2003-02-20 11:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-19 13:23 [9fans] events 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
  -- strict thread matches above, loose matches on Subject: below --
2003-02-19 13:20 paurea

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).