-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
98 lines (84 loc) · 2.3 KB
/
main.cpp
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
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <queue>
#include <vector>
#include <algorithm>
#include <string>
#include "FingRRR.h"
/* VC++ Code */
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
int cntC = 0;
void onBtnClick(iButton *th, int &x, int &y)
{
printf("Hello World ! %d\n", ++cntC);
return ;
}
void onBtnHover(iButton *th, int &x, int &y)
{
th->bgImg = &assetsImg[ th->customData[1] ];
return ;
}
void onBtnOut(iButton *th, int &x, int &y)
{
th->bgImg = &assetsImg[ th->customData[0] ];
return ;
}
void changeClrCursorFootprint(iButton *th, int &x, int &y)
{
clrCursorFootprint = CV_RGB(255, 0, 255);
return ;
}
iObject *test, *test2;
void aniEnd()
{
puts("Animation Ended");
sceneActive->deleteObject(test);
}
void clickMoveTest(iButton *th, int &x, int &y)
{
clock_t st = clock();
createAnimation(test->x, 3, 200, ANI_SPEEDFUNC_CONST, NULL, aniEnd);
return ;
}
void onDrag(iObject *th, int &x, int &y)
{
objActive = th;
}
int cnt2 = 0;
void event()
{
while (1)
{
system("cls");
printf("%d\n", ++cnt2);
waitKey(200);
}
}
int main()
{
int key;
inputMethod = INPUT_METHOD_MOUSE;
init(1400, 700, false);
iScene *main = new iScene(0, 0, 1400, 700, 0, 0, 0, 0, &assetsImg[6]);
sceneActive = main;
iToolbar *mainTB = main->createToolbar(0, 0, 486, 60);
iButton *btn1 = mainTB->createButton(140, 56, 255, 0, 0, 0, &assetsImg[0], onBtnHover, onBtnClick, NULL, NULL, NULL, NULL, onBtnOut);
iButton *btn2 = mainTB->createButton(140, 56, 0, 255, 0, 0, &assetsImg[2], onBtnHover, clickMoveTest, NULL, NULL, NULL, NULL, onBtnOut);
iButton *btn3 = mainTB->createButton(140, 56, 0, 0, 255, 0, &assetsImg[4], onBtnHover, onBtnClick, NULL, NULL, NULL, NULL, onBtnOut);
btn1->customData[0] = 0; btn1->customData[1] = 1;
btn2->customData[0] = 2; btn2->customData[1] = 3;
btn3->customData[0] = 4; btn3->customData[1] = 5;
// iButton *btn4 = mainTB->createButton(56, 56, 255, 0, 255, 255, NULL, NULL, changeClrCursorFootprint, NULL, NULL, NULL, NULL, NULL);
test2 = sceneActive->createObject(50, 50, 475, 475, 0, 0, 0, 0, &assetsImg[7], 230, true, true);
test2->onDrag = &onDrag;
test = sceneActive->createObject(200, 200, 100, 100, 0, 0, 255, 100, NULL, 255, true, true);
test->onDrag = &onDrag;
hookUserEvent(event);
start();
return 0;
}