9 class xapp: public xapplication
16 virtual void SetupResources(void);
18 virtual int DoCommand(int code);
28 void * heartbeat(void *v)
31 unsigned long flash_time = 200000;
33 color forebeat("red");
34 color afterbeat("blue");
36 window *w = (window *)v;
41 period = 1000000 * 60 / BPM;
43 w->Background(forebeat);
45 w->Background(afterbeat);
54 usleep(period - flash_time);
63 void xapp::SetupResources()
67 main_frame = new managed_window;
69 main_frame->Resize(700, 500);
70 flash = new window(*main_frame, 92, 2, 606, 496, 1);
72 btn = new command_button(*main_frame, 2, 2, "QUIT", CMD_QUIT);
73 btn = new command_button(*main_frame, 2, 42, "++", CMD_FASTER);
74 btn = new command_button(*main_frame, 2, 82, "--", CMD_SLOWER);
75 main_frame->Realize();
77 pthread_create(&beat, NULL, heartbeat, flash);
80 int xapp::DoCommand(int code)
89 std::cout << BPM << "beats per minute\n";
97 std::cout << BPM << "beats per minute\n";