diff --git a/Overlay/Include/Overlay.h b/Overlay/Include/Overlay.h index 49d487d..ae46916 100644 --- a/Overlay/Include/Overlay.h +++ b/Overlay/Include/Overlay.h @@ -2,4 +2,5 @@ #include "Include.h" #include "Options.h" #include "../functions/addWatermark.h" -#include "../functions/captureScreen.h" \ No newline at end of file +#include "../functions/captureScreen.h" +#include "../functions/screenRecoder.h" \ No newline at end of file diff --git a/Overlay/Overlay.vcxproj b/Overlay/Overlay.vcxproj index 33b9ce0..8349db5 100644 --- a/Overlay/Overlay.vcxproj +++ b/Overlay/Overlay.vcxproj @@ -133,6 +133,7 @@ + diff --git a/Overlay/Overlay.vcxproj.filters b/Overlay/Overlay.vcxproj.filters index cc81683..5b89f4e 100644 --- a/Overlay/Overlay.vcxproj.filters +++ b/Overlay/Overlay.vcxproj.filters @@ -27,5 +27,8 @@ Include + + functions + \ No newline at end of file diff --git a/Overlay/functions/captureScreen.h b/Overlay/functions/captureScreen.h index e09fd8b..be08dde 100644 --- a/Overlay/functions/captureScreen.h +++ b/Overlay/functions/captureScreen.h @@ -1,7 +1,7 @@ #pragma once #include "addWatermark.h" -void captureScreen(std::string file_Name) +void captureScreen(std::string file_screenshot) { HDC hdcScreen; HDC hdcDIB; @@ -28,7 +28,7 @@ void captureScreen(std::string file_Name) // Добавление ватермарки на контекст addWatermark(hdcScreen, hdcDIB, bmi); - hFile = CreateFile(("C:\\Users\\" + (std::string)std::getenv("USERNAME") + "\\Documents\\vos.team\\" + file_Name).c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + hFile = CreateFile(("C:\\Users\\" + (std::string)std::getenv("USERNAME") + "\\Documents\\vos.team\\" + file_screenshot).c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); BITMAPFILEHEADER hdr = { }; hdr.bfType = 0x4d42; // Буквы 'B' и 'M' hdr.bfOffBits = sizeof(hdr) + sizeof(BITMAPINFOHEADER); diff --git a/Overlay/functions/screenRecoder.h b/Overlay/functions/screenRecoder.h new file mode 100644 index 0000000..d73866a --- /dev/null +++ b/Overlay/functions/screenRecoder.h @@ -0,0 +1,8 @@ +#pragma once +#include "addWatermark.h" + +void screenRecoder(std::string file_video) +{ + std::string command = "ffmpeg -f gdigrab -framerate 30 -i desktop -c:v libx264 -preset ultrafast -tune zerolatency -crf 25 -pix_fmt yuv420p " + ("C:\\Users\\" + (std::string)std::getenv("USERNAME") + "\\Documents\\vos.team\\" + file_video); + system(command.c_str()); +} \ No newline at end of file diff --git a/Overlay/main.cpp b/Overlay/main.cpp index 2ceeb35..32d518a 100644 --- a/Overlay/main.cpp +++ b/Overlay/main.cpp @@ -2,7 +2,9 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - std::string file_Name = "screenshot_" + std::to_string(time(NULL)) + ".bmp"; + std::string file_screenshot = "screenshot_" + std::to_string(time(NULL)) + ".bmp"; + std::string file_video = "video_" + std::to_string(time(NULL)) + ".mp4"; + switch (msg) { case WM_HOTKEY: @@ -17,7 +19,11 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } else if (wParam == 3) { - captureScreen(file_Name); + captureScreen(file_screenshot); + } + else if (wParam == 4) + { + screenRecoder(file_video); } break; case WM_PAINT: @@ -83,6 +89,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine RegisterHotKey(hwnd, 1, MOD_ALT, 0x5A); RegisterHotKey(hwnd, 2, MOD_ALT, 0x58); RegisterHotKey(hwnd, 3, MOD_ALT, 0x50); + RegisterHotKey(hwnd, 4, MOD_ALT, 0x56); while (GetMessage(&Msg, NULL, 0, 0) > 0) { @@ -100,6 +107,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine UnregisterHotKey(hwnd, 1); UnregisterHotKey(hwnd, 2); UnregisterHotKey(hwnd, 3); + UnregisterHotKey(hwnd, 4); exit(0); return Msg.wParam; diff --git a/Overlay/video_1680232004.mp4 b/Overlay/video_1680232004.mp4 new file mode 100644 index 0000000..8bd557d Binary files /dev/null and b/Overlay/video_1680232004.mp4 differ diff --git a/Overlay/video_1680232580.mp4 b/Overlay/video_1680232580.mp4 new file mode 100644 index 0000000..47c07fb Binary files /dev/null and b/Overlay/video_1680232580.mp4 differ diff --git a/Overlay/video_1680232720.mp4 b/Overlay/video_1680232720.mp4 new file mode 100644 index 0000000..af4f06e Binary files /dev/null and b/Overlay/video_1680232720.mp4 differ