diff options
-rw-r--r-- | coffee/starfish.coffee | 5 | ||||
-rwxr-xr-x | p9c/hello-plan9/ball.c | 2 | ||||
-rw-r--r-- | p9c/notes.md | 1 | ||||
-rw-r--r-- | p9c/scratch/mouse.c | 22 |
4 files changed, 22 insertions, 8 deletions
diff --git a/coffee/starfish.coffee b/coffee/starfish.coffee index bfd5f44..7f63720 100644 --- a/coffee/starfish.coffee +++ b/coffee/starfish.coffee @@ -1,4 +1,5 @@ square = (x) -> x * x -cube = (x) -> square(x) * x +cube = (x) -> square x * x + +console.log cube 33 -console.log cube(33) diff --git a/p9c/hello-plan9/ball.c b/p9c/hello-plan9/ball.c index 281beb0..22566ef 100755 --- a/p9c/hello-plan9/ball.c +++ b/p9c/hello-plan9/ball.c @@ -89,7 +89,7 @@ initball() void main(int argc, char *argv[]) { - USED(argc, argv); + // USED(argc, argv); Event ev; int e, timer; diff --git a/p9c/notes.md b/p9c/notes.md index aef41f6..b3c6d00 100644 --- a/p9c/notes.md +++ b/p9c/notes.md @@ -6,6 +6,7 @@ http://doc.cat-v.org/plan_9/programming/c_programming_in_plan_9 http://blog.postnix.pw/2018/09/21/0/ http://sdf.org/?tutorials/Plan_9_C https://9fans.github.io/plan9port/man/man3/intro.html +https://github.com/nspool/hello-plan9 general: diff --git a/p9c/scratch/mouse.c b/p9c/scratch/mouse.c index 214526a..21c6d33 100644 --- a/p9c/scratch/mouse.c +++ b/p9c/scratch/mouse.c @@ -3,6 +3,10 @@ #include <draw.h> #include <event.h> +char* options[] = {"Right Click", "", "Option3", "Option4", "Exit", 0}; + +Menu rightmenu = {options}; + void eresized(int new) { @@ -13,23 +17,31 @@ eresized(int new) void main(int argc, char* argv[]) { - // USED(argc, argv); Mouse m; + Event ev; + int e; Point prevm; - initdraw(0, 0, "Example: Mouse"); + + initdraw(0, 0, "draw"); eresized(0); einit(Emouse); /* Main loop */ for(;;) { + e = event(&ev); m = emouse(); - if(m.buttons & 4) - break; + if((e == Emouse) && (m.buttons & 4)) + if(emenuhit(3, &ev.mouse, &rightmenu) == 2) + print("Pressed Option 3\n"); + if(emenuhit(3, &ev.mouse, &rightmenu) == 3) + print("Pressed Option 4\n"); + if(emenuhit(3, &ev.mouse, &rightmenu) == 4) + exits(nil); if(m.buttons & 1) { line(screen, prevm.x == -1 ? m.xy : prevm, - m.xy, Enddisc, Enddisc, 1, display->black, ZP); + m.xy, Enddisc, Enddisc, 1, display->black, ZP); // where the int after Enddisc with the width of the line drawn prevm = m.xy; } else { prevm = Pt(-1, -1); |