about summary refs log tree commit diff stats
path: root/062array.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-07-13 20:50:25 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-07-13 20:50:25 -0700
commit8b9f1750c74c7d3cca99d6949a90cd61eb8e0218 (patch)
treeace2861be7f43de9ee2d1032ea03598748233cbf /062array.mu
parent8a23f9e055e2e2266d7ac5deb060f85ce2a2f53e (diff)
downloadmu-8b9f1750c74c7d3cca99d6949a90cd61eb8e0218.tar.gz
1777 - consistent terminology: 'product'
Diffstat (limited to '062array.mu')
0 files changed, 0 insertions, 0 deletions
58d6b ^
8013dbf ^




24f64a3 ^
8013dbf ^
24f64a3 ^






8013dbf ^


e1eb2a3 ^
8013dbf ^





1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50




                  



                                                                       









                                                     

                

                 
                    
 
                               




                       
                               
                             






                                                                   


                                                          
                                                                                                                                            





                                           
#include <u.h>
#include <libc.h>
#include <draw.h>
#include <event.h>

char* options[] = {"Right Click", "", "Option3", "Option4", "Exit", 0};

Menu rightmenu = {options};

void
eresized(int new)
{
	if(new&& getwindow(display, Refnone) < 0)
		sysfatal("can't reattach to window");
}

void
main(int argc, char* argv[])
{

	Mouse m;
	Event ev;
	int e;
	Point prevm;

	initdraw(0, 0, "draw");
	eresized(0);
	einit(Emouse);

	/* Main loop */
	for(;;) {
		e = event(&ev);
		m = emouse();
		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); // where the int after Enddisc with the width of the line drawn
			prevm = m.xy;
		} else {
			prevm = Pt(-1, -1);
		}
	}
}