Skip to content

Commit

Permalink
More work to windows desktop dup
Browse files Browse the repository at this point in the history
Not working correct yet, the coords for capturing are not correct.
  • Loading branch information
smasherprog committed Dec 24, 2016
1 parent 516a8c9 commit 3703390
Show file tree
Hide file tree
Showing 17 changed files with 1,462 additions and 156 deletions.
8 changes: 4 additions & 4 deletions .vscode/.cmaketools.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"variant": {
"label": "Release",
"label": "Debug",
"keywordSettings": {
"buildType": "release"
"buildType": "debug"
},
"description": "Enable optimizations, omit debug info"
"description": "Emit debug information without performing optimizations"
},
"activeEnvironments": [
"Visual C++ 14.0 - amd64"
"Visual C++ 14.0 - x86"
]
}
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Place your settings in this file to overwrite default and user settings.
{
"C_Cpp.clang_format_style": "WebKit"
"C_Cpp.clang_format_style": "WebKit",

}
4 changes: 3 additions & 1 deletion Example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
project(Screen_Capture_Example)

include_directories(${Screen_Capture_SOURCE_DIR}/include)
add_executable(${PROJECT_NAME} Screen_Capture_Example.cpp)


add_executable(${PROJECT_NAME} tiny_jpeg.h Screen_Capture_Example.cpp)
target_link_libraries(${PROJECT_NAME} Screen_Capturelib)

install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
32 changes: 24 additions & 8 deletions Example/Screen_Capture_Example.cpp
Original file line number Diff line number Diff line change
@@ -1,23 +1,39 @@
#include "windows\ScreenCaptureDX.h"
#include <iostream>
#include <chrono>
#include <atomic>

#include <string>
#define TJE_IMPLEMENTATION
#include "tiny_jpeg.h"

int main()
{

std::atomic<int> realcounter;
realcounter = 0;
SL::Screen_Capture::ScreenCaptureDX dx;
SL::Screen_Capture::ImageCallback func = [](const SL::Screen_Capture::Image& img, SL::Screen_Capture::Captured_Image type) {
//std::cout << "Got here" << std::endl;
SL::Screen_Capture::ImageCallback func = [&](const SL::Screen_Capture::CapturedImage& img) {
if (img.ScreenIndex != 1) return;
std::cout << "Height " << img.Height << ", Width " << img.Width << ", Top " << img.AbsoluteTop << ", Left " << img.AbsoluteLeft << std::endl;
auto r = realcounter.fetch_add(1);
std::string s("screen");
s += std::to_string(img.AbsoluteTop) + std::string(",") + std::to_string(img.AbsoluteLeft) +std::string(" ") + std::to_string(r) + std::string(".jpg");
//savetodisk(img, s);

if (!tje_encode_to_file(s.c_str(), img.Width, img.Height, 4, (const unsigned char*)img.Data.get())) {
std::cout << "Could not write JPEG\n";
}
};
dx.StartProcessing(func);
while (true) {



std::this_thread::sleep_for(std::chrono::milliseconds(50));

while (true) {
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
}

dx.StopProcessing();
int k = 0;
std::cin >> k;
return 0;
}
}

Loading

0 comments on commit 3703390

Please sign in to comment.