Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGUI.cpp
More file actions
Latest commit
executable file
·104 lines (92 loc) · 2.01 KB
/
Copy pathGUI.cpp
File metadata and controls
executable file
·104 lines (92 loc) · 2.01 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// GUI.cpp
#define_CRT_SECURE_NO_WARNINGS
#define_CRT_SECURE_NO_DEPRECATE
#include"stdafx.h"
#include<stdio.h>
#include<signal.h>
#include"windows.h"
#include<iostream>
#include<fstream>
usingnamespacestd;
#include"globals.h"
#include"GUI.h"
voidhelp() {
#ifdef ANIMOSITY
cout<<"OpenCV Stop Motion Program.\n";
#else
cout<<"Reliably present a full-screen live video image.\n";
#endif
}
int occasionally = 1;
int loop = 1;
voidtakePicture(void);
voiddeleteFrame(void);
voidmakeMovie(void);
voidplayMovie(void);
voidresetMovie(void);
voidcheckKeyboard(void)
{
unsignedchar c = cvWaitKey(4);
if (occasionally++ % 100 == 0) downtime();
switch(c) {
case'x': loop = 0; break;
case't':
takePicture();
break;
case'd':
deleteFrame();
break;
case'm':
makeMovie();
break;
case'p':
playMovie();
break;
case'r':
resetMovie();
break;
default:
printf("Unrecognized command [%c]\n",c);
}
}
voidmouseHandler(int event, int x, int y, int flags, void* param)
{
switch(event){
caseCV_EVENT_LBUTTONDOWN:
printf("Left button down ( %d,%d ) ",x,y);
break;
caseCV_EVENT_LBUTTONUP:
printf("Left button up\n");
break;
}
}
staticint displayOn = 1;
staticint offtime = 0;
voiddowntime(void)
{
SYSTEMTIME st;
GetSystemTime(&st);
if (st.wHour > 26 || st.wHour < 3) // Greenwich time
// if (st.wHour > 17 || st.wHour < 8) // AFTER HOURS
{
if (displayOn)
{
displayOn = 0;
SendMessageW(HWND_BROADCAST,
WM_SYSCOMMAND,
SC_MONITORPOWER,
(LPARAM) 2 );
printf("After hours: (hr=%d) display needs to be off\n",st.wHour);
system("C:/cygwin/bin/date");
}
}
elseif (displayOn == 0) {
displayOn = 1;
SendMessageW(HWND_BROADCAST,
WM_SYSCOMMAND,
SC_MONITORPOWER,
(LPARAM)-1);
printf("Working hours: turning display on\n");
system("C:/cygwin/bin/date");
}
}