summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Palecki <[email protected]>2020-07-23 20:50:59 -0700
committerJacob Palecki <[email protected]>2020-07-23 20:50:59 -0700
commita8c51940a32f78f11879270974741b43b1438129 (patch)
tree1c84c1368c858e54c33dd3af4d363a56cdb094bb
parentMerge pull request #2 from JacobPalecki/PowerStyle (diff)
downloadrawaccel-a8c51940a32f78f11879270974741b43b1438129.tar.xz
rawaccel-a8c51940a32f78f11879270974741b43b1438129.zip
Added simple c++/cli wrapper
-rw-r--r--rawaccel.sln20
-rw-r--r--wrapper/wrapper.cpp14
-rw-r--r--wrapper/wrapper.hpp47
-rw-r--r--wrapper/wrapper.vcxproj126
-rw-r--r--wrapper/wrapper.vcxproj.filters27
5 files changed, 234 insertions, 0 deletions
diff --git a/rawaccel.sln b/rawaccel.sln
index 5be7e63..fef1755 100644
--- a/rawaccel.sln
+++ b/rawaccel.sln
@@ -15,6 +15,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common-install", "common-in
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "uninstaller", "uninstaller\uninstaller.vcxproj", "{A4097FF6-A6F0-44E8-B8D0-538D0FB75936}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wrapper", "wrapper\wrapper.vcxproj", "{28A3656F-A1DE-405C-B547-191C32EC555F}"
+EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
common-install\common-install.vcxitems*{058d66c6-d88b-4fdb-b0e4-0a6fe7483b95}*SharedItemsImports = 9
@@ -26,26 +28,44 @@ Global
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
Release|x64 = Release|x64
+ Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{60D6C942-AC20-4C05-A2BE-54B5C966534D}.Debug|x64.ActiveCfg = Debug|x64
{60D6C942-AC20-4C05-A2BE-54B5C966534D}.Debug|x64.Build.0 = Debug|x64
{60D6C942-AC20-4C05-A2BE-54B5C966534D}.Debug|x64.Deploy.0 = Debug|x64
+ {60D6C942-AC20-4C05-A2BE-54B5C966534D}.Debug|x86.ActiveCfg = Debug|x64
{60D6C942-AC20-4C05-A2BE-54B5C966534D}.Release|x64.ActiveCfg = Release|x64
{60D6C942-AC20-4C05-A2BE-54B5C966534D}.Release|x64.Build.0 = Release|x64
+ {60D6C942-AC20-4C05-A2BE-54B5C966534D}.Release|x86.ActiveCfg = Release|x64
{896950D1-520A-420A-B6B1-73014B92A68C}.Debug|x64.ActiveCfg = Debug|x64
{896950D1-520A-420A-B6B1-73014B92A68C}.Debug|x64.Build.0 = Debug|x64
+ {896950D1-520A-420A-B6B1-73014B92A68C}.Debug|x86.ActiveCfg = Debug|x64
{896950D1-520A-420A-B6B1-73014B92A68C}.Release|x64.ActiveCfg = Release|x64
{896950D1-520A-420A-B6B1-73014B92A68C}.Release|x64.Build.0 = Release|x64
+ {896950D1-520A-420A-B6B1-73014B92A68C}.Release|x86.ActiveCfg = Release|x64
{AB7B3759-B85F-4067-8935-FB4539B41869}.Debug|x64.ActiveCfg = Debug|x64
{AB7B3759-B85F-4067-8935-FB4539B41869}.Debug|x64.Build.0 = Debug|x64
+ {AB7B3759-B85F-4067-8935-FB4539B41869}.Debug|x86.ActiveCfg = Debug|x64
{AB7B3759-B85F-4067-8935-FB4539B41869}.Release|x64.ActiveCfg = Release|x64
{AB7B3759-B85F-4067-8935-FB4539B41869}.Release|x64.Build.0 = Release|x64
+ {AB7B3759-B85F-4067-8935-FB4539B41869}.Release|x86.ActiveCfg = Release|x64
{A4097FF6-A6F0-44E8-B8D0-538D0FB75936}.Debug|x64.ActiveCfg = Debug|x64
{A4097FF6-A6F0-44E8-B8D0-538D0FB75936}.Debug|x64.Build.0 = Debug|x64
+ {A4097FF6-A6F0-44E8-B8D0-538D0FB75936}.Debug|x86.ActiveCfg = Debug|x64
{A4097FF6-A6F0-44E8-B8D0-538D0FB75936}.Release|x64.ActiveCfg = Release|x64
{A4097FF6-A6F0-44E8-B8D0-538D0FB75936}.Release|x64.Build.0 = Release|x64
+ {A4097FF6-A6F0-44E8-B8D0-538D0FB75936}.Release|x86.ActiveCfg = Release|x64
+ {28A3656F-A1DE-405C-B547-191C32EC555F}.Debug|x64.ActiveCfg = Debug|x64
+ {28A3656F-A1DE-405C-B547-191C32EC555F}.Debug|x64.Build.0 = Debug|x64
+ {28A3656F-A1DE-405C-B547-191C32EC555F}.Debug|x86.ActiveCfg = Debug|Win32
+ {28A3656F-A1DE-405C-B547-191C32EC555F}.Debug|x86.Build.0 = Debug|Win32
+ {28A3656F-A1DE-405C-B547-191C32EC555F}.Release|x64.ActiveCfg = Release|x64
+ {28A3656F-A1DE-405C-B547-191C32EC555F}.Release|x64.Build.0 = Release|x64
+ {28A3656F-A1DE-405C-B547-191C32EC555F}.Release|x86.ActiveCfg = Release|Win32
+ {28A3656F-A1DE-405C-B547-191C32EC555F}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/wrapper/wrapper.cpp b/wrapper/wrapper.cpp
new file mode 100644
index 0000000..df3f796
--- /dev/null
+++ b/wrapper/wrapper.cpp
@@ -0,0 +1,14 @@
+#pragma once
+
+#include "..\common\rawaccel.hpp";
+#include "wrapper.hpp";
+using namespace rawaccel;
+using namespace System;
+
+Tuple<double, double>^ ManagedAccel::Accelerate(int x, int y, double time, double mode)
+{
+ vec2d input_vec2d = {x, y};
+ vec2d output = (*accel_instance)(input_vec2d, (accel_function::milliseconds)time, (rawaccel::mode)mode);
+
+ return gcnew Tuple<double, double>(output.x, output.y);
+} \ No newline at end of file
diff --git a/wrapper/wrapper.hpp b/wrapper/wrapper.hpp
new file mode 100644
index 0000000..eaa8489
--- /dev/null
+++ b/wrapper/wrapper.hpp
@@ -0,0 +1,47 @@
+#pragma once
+
+#include "..\common\rawaccel.hpp";
+#include "..\common\rawaccel-userspace.hpp";
+#include <iostream>
+using namespace rawaccel;
+using namespace System;
+
+public ref class ManagedAccel
+{
+protected:
+ accel_function* accel_instance;
+public:
+ ManagedAccel(accel_function* accel)
+ : accel_instance(accel)
+ {
+ }
+
+ ManagedAccel(double mode, double offset, double accel, double lim_exp, double midpoint)
+ {
+ accel_function::args_t args{};
+
+ accel_instance = new accel_function(args);
+ }
+
+ virtual ~ManagedAccel()
+ {
+ if (accel_instance != nullptr)
+ {
+ delete accel_instance;
+ }
+ }
+ !ManagedAccel()
+ {
+ if (accel_instance != nullptr)
+ {
+ delete accel_instance;
+ }
+ }
+
+ accel_function* GetInstance()
+ {
+ return accel_instance;
+ }
+
+ Tuple<double, double>^ Accelerate(int x, int y, double time, double mode);
+}; \ No newline at end of file
diff --git a/wrapper/wrapper.vcxproj b/wrapper/wrapper.vcxproj
new file mode 100644
index 0000000..25f878c
--- /dev/null
+++ b/wrapper/wrapper.vcxproj
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <VCProjectVersion>16.0</VCProjectVersion>
+ <ProjectGuid>{28A3656F-A1DE-405C-B547-191C32EC555F}</ProjectGuid>
+ <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
+ <Keyword>ManagedCProj</Keyword>
+ <RootNamespace>wrapper</RootNamespace>
+ <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v142</PlatformToolset>
+ <CLRSupport>true</CLRSupport>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v142</PlatformToolset>
+ <CLRSupport>true</CLRSupport>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v142</PlatformToolset>
+ <CLRSupport>true</CLRSupport>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v142</PlatformToolset>
+ <CLRSupport>true</CLRSupport>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="Shared">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup />
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <LanguageStandard>stdcpplatest</LanguageStandard>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies />
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <LanguageStandard>stdcpplatest</LanguageStandard>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies />
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <LanguageStandard>stdcpplatest</LanguageStandard>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies />
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <LanguageStandard>stdcpplatest</LanguageStandard>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies />
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="wrapper.hpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="wrapper.cpp" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/wrapper/wrapper.vcxproj.filters b/wrapper/wrapper.vcxproj.filters
new file mode 100644
index 0000000..22d967d
--- /dev/null
+++ b/wrapper/wrapper.vcxproj.filters
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;c++;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="wrapper.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="wrapper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project> \ No newline at end of file