-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
31 lines (25 loc) · 1000 Bytes
/
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
#include "BilliardHelper.hpp"
#include "Application.hpp"
#include "ImageAnalyser.hpp"
int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
Application app;
if (int ret = app.Initialize(); ret != 0) return 1;
auto& anaylser = ImageAnalyser::Get();
BilliardHelper helper;
app.AddCallback(1, [&]() -> void {
anaylser.UpdateDesk(app.GetDeskImage());
helper.UpdateBalls(anaylser.GetBallsPosition());
auto [hitpoint, target] = helper.GetHittingPoint(app.GetCursor());
app.MoveCursor(hitpoint).DrawLine(hitpoint, target);
})
.AddCallback(2, [&]() -> void {
anaylser.UpdateDesk(app.GetDeskImage());
helper.UpdateBalls(anaylser.GetBallsPosition());
auto hintpoints = helper.GetReflectionPath(app.GetCursor(), 4);
app.DrawLines(hintpoints);
});
while (!app.Quit()) {
app.Tick();
}
return 0;
}