Skip to content

Commit

Permalink
Merge pull request #1 from smasherprog/Dev
Browse files Browse the repository at this point in the history
First Release of windows support
  • Loading branch information
smasherprog authored Dec 27, 2016
2 parents a9208a6 + 2a59141 commit 1f8b79c
Show file tree
Hide file tree
Showing 36 changed files with 3,494 additions and 559 deletions.
12 changes: 12 additions & 0 deletions .vscode/.cmaketools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"variant": {
"label": "Debug",
"keywordSettings": {
"buildType": "debug"
},
"description": "Emit debug information without performing optimizations"
},
"activeEnvironments": [
"Visual C++ 14.0 - x86"
]
}
31 changes: 31 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"configurations": [
{
"name": "Mac",
"includePath": ["/usr/include"],
"browse" : {
"limitSymbolsToIncludedHeaders" : true,
"databaseFilename" : ""
}
},
{
"name": "Linux",
"includePath": ["/usr/include"],
"browse" : {
"limitSymbolsToIncludedHeaders" : true,
"databaseFilename" : ""
}
},
{
"name": "Win32",
"includePath": [
"c:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include/",
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.10586.0"
],
"browse" : {
"limitSymbolsToIncludedHeaders" : true,
"databaseFilename" : ""
}
}
]
}
16 changes: 16 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "C++ Launch (Windows)",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceRoot}/build/Example/Debug/Screen_Capture_Example.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}/build/Example/Debug/",
"environment": [],
"externalConsole": true
}
]
}
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Place your settings in this file to overwrite default and user settings.
{
"C_Cpp.clang_format_style": "WebKit",

}
52 changes: 52 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"version": "0.1.0",
"isShellCommand": true,
"showOutput": "always",
"suppressTaskName": true,
"options": {
"cwd": "${workspaceRoot}/build"
},
"echoCommand": true,
"windows": {
"command": "cmd",
"args": ["/C"],
"tasks": [
{
"taskName": "clean",
"args": [ "rd /s /q", "${workspaceRoot}\\build"]
},
{
"taskName": "cmake",
"args": ["cmake", "--build","${workspaceRoot}\\build"],
"isBuildCommand": true,
"problemMatcher": {
"owner": "cpp",
"fileLocation": "absolute",
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
}
]
},
"linux": {
"command": "sh",
"args": ["-c"],
"tasks": [
{
"taskName": "clean",
"args": [ "rm -rf", "${workspaceRoot}/build" ]
},
{
"taskName": "cmake",
"args": ["cmake", "--build","${cwd}"],
"isBuildCommand": true
}
]
}
}
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
cmake_minimum_required(VERSION 3.0)
project(Screen_Capture)

option(BUILD_EXAMPLE "Build example" On)

add_subdirectory(lib)

if(BUILD_EXAMPLE)
add_subdirectory(Example)
endif()
9 changes: 9 additions & 0 deletions Example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
project(Screen_Capture_Example)

include_directories(${Screen_Capture_SOURCE_DIR}/include)


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)
37 changes: 37 additions & 0 deletions Example/Screen_Capture_Example.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include "ScreenCaptureManager.h"
#include <iostream>
#include <chrono>
#include <atomic>
#include <thread>
#include <string>
#define TJE_IMPLEMENTATION
#include "tiny_jpeg.h"

int main()
{

std::atomic<int> realcounter;
realcounter = 0;
SL::Screen_Capture::ScreenCaptureManager framgrabber;
SL::Screen_Capture::ImageCallback func = [&](const SL::Screen_Capture::CapturedImage& img) {
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");

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";
}
};
framgrabber.StartCapturing(func, 100);

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

framgrabber.StopCapturing();
int k = 0;
std::cin >> k;
return 0;
}

Loading

0 comments on commit 1f8b79c

Please sign in to comment.