Skip to content

Commit

Permalink
Updated files
Browse files Browse the repository at this point in the history
  • Loading branch information
dodilp committed Aug 25, 2012
1 parent bad417b commit 9386094
Show file tree
Hide file tree
Showing 47 changed files with 31,060 additions and 13 deletions.
1 change: 1 addition & 0 deletions Kinect.Client/color-0.4.1.min.js

Large diffs are not rendered by default.

23 changes: 19 additions & 4 deletions Kinect.Client/index.html
@@ -1,13 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<title>Kinect &amp; HTML5</title>
<title>Couchbase Server 2.0 - Kinect Demo</title>
<style>
.one {position: absolute;
top: 7%;
left:2%;
height: 10%;
width: 20%;
color: green;
}

</style>
<link rel="stylesheet" href="style.css" />
<script src="color-0.4.1.min.js"></script>
<script src="web-sockets.js"></script>
</head>
<body>
<h1>Kinect &amp HTML5 WebSockets</h1>
Status: <label id="status">None</label>
<canvas id="canvas" width="640" height="480"></canvas>

<h1>Couchbase Server - Game On with the Kinect!</h1>
<table id="gametable">
<tr><td>
<div id="score" class="one"><h2>Score<h2></div></td><td>
<canvas id="canvas" width="640" height="480"></canvas></td></tr></table>
Status: <label id="status">None</label>
</body>
</html>
Expand Down
174 changes: 172 additions & 2 deletions Kinect.Client/web-sockets.js
@@ -1,4 +1,149 @@
window.onload = function () {
/**
* @namespace Core namespace
*/
var CANVASBALLOON = {};

// Constants
CANVASBALLOON.KAPPA = (4 * (Math.sqrt(2) - 1))/3;
CANVASBALLOON.WIDTH_FACTOR = 0.0333;
CANVASBALLOON.HEIGHT_FACTOR = 0.4;
CANVASBALLOON.TIE_WIDTH_FACTOR = 0.12;
CANVASBALLOON.TIE_HEIGHT_FACTOR = 0.10;
CANVASBALLOON.TIE_CURVE_FACTOR = 0.13;
CANVASBALLOON.GRADIENT_FACTOR = 0.3;
CANVASBALLOON.GRADIENT_CIRCLE_RADIUS = 3;

/**
* Creates a new Balloon
* @class Represents a balloon displayed on a HTML5 canvas
* @param {String} canvasElementID Unique ID of the canvas element displaying the balloon
* @param {Number} centerX X-coordinate of the balloon's center
* @param {Number} centerY Y-coordinate of the balloon's center
* @param {Number} radius Radius of the balloon
* @param {String} color String representing the balloon's base color
*/
CANVASBALLOON.Balloon = function(canvasElementID, centerX, centerY, radius, color) {
var canvas = document.getElementById(canvasElementID);

if(!canvas.getContext)
{
return;
}

this.gfxContext = canvas.getContext('2d');
this.centerX = centerX;
this.centerY = centerY;
this.radius = radius;
this.baseColor = new Color(color);
this.darkColor = (new Color(color)).darken(CANVASBALLOON.GRADIENT_FACTOR);
this.lightColor = (new Color(color)).lighten(CANVASBALLOON.GRADIENT_FACTOR);
}

/**
* Draws the balloon on the canvas
*/
CANVASBALLOON.Balloon.prototype.draw = function() {

// Prepare constants

var gfxContext = this.gfxContext;
var centerX = this.centerX;
var centerY = this.centerY;
var radius = this.radius;

var handleLength = CANVASBALLOON.KAPPA * radius;

var widthDiff = (radius * CANVASBALLOON.WIDTH_FACTOR);
var heightDiff = (radius * CANVASBALLOON.HEIGHT_FACTOR);

var balloonBottomY = centerY + radius + heightDiff;

// Begin balloon path

gfxContext.beginPath();

// Top Left Curve

var topLeftCurveStartX = centerX - radius;
var topLeftCurveStartY = centerY;

var topLeftCurveEndX = centerX;
var topLeftCurveEndY = centerY - radius;

gfxContext.moveTo(topLeftCurveStartX, topLeftCurveStartY);
gfxContext.bezierCurveTo(topLeftCurveStartX, topLeftCurveStartY - handleLength - widthDiff,
topLeftCurveEndX - handleLength, topLeftCurveEndY,
topLeftCurveEndX, topLeftCurveEndY);

// Top Right Curve

var topRightCurveStartX = centerX;
var topRightCurveStartY = centerY - radius;

var topRightCurveEndX = centerX + radius;
var topRightCurveEndY = centerY;

gfxContext.bezierCurveTo(topRightCurveStartX + handleLength + widthDiff, topRightCurveStartY,
topRightCurveEndX, topRightCurveEndY - handleLength,
topRightCurveEndX, topRightCurveEndY);

// Bottom Right Curve

var bottomRightCurveStartX = centerX + radius;
var bottomRightCurveStartY = centerY;

var bottomRightCurveEndX = centerX;
var bottomRightCurveEndY = balloonBottomY;

gfxContext.bezierCurveTo(bottomRightCurveStartX, bottomRightCurveStartY + handleLength,
bottomRightCurveEndX + handleLength, bottomRightCurveEndY,
bottomRightCurveEndX, bottomRightCurveEndY);

// Bottom Left Curve

var bottomLeftCurveStartX = centerX;
var bottomLeftCurveStartY = balloonBottomY;

var bottomLeftCurveEndX = centerX - radius;
var bottomLeftCurveEndY = centerY;

gfxContext.bezierCurveTo(bottomLeftCurveStartX - handleLength, bottomLeftCurveStartY,
bottomLeftCurveEndX, bottomLeftCurveEndY + handleLength,
bottomLeftCurveEndX, bottomLeftCurveEndY);

// Create balloon gradient

var gradientOffset = (radius/3);

var balloonGradient =
gfxContext.createRadialGradient(centerX + gradientOffset, centerY - gradientOffset,
CANVASBALLOON.GRADIENT_CIRCLE_RADIUS,
centerX, centerY, radius + heightDiff);
balloonGradient.addColorStop(0, this.lightColor.rgbString());
balloonGradient.addColorStop(0.7, this.darkColor.rgbString());

gfxContext.fillStyle = balloonGradient;
gfxContext.fill();

// End balloon path

// Create balloon tie

var halfTieWidth = (radius * CANVASBALLOON.TIE_WIDTH_FACTOR)/2;
var tieHeight = (radius * CANVASBALLOON.TIE_HEIGHT_FACTOR);
var tieCurveHeight = (radius * CANVASBALLOON.TIE_CURVE_FACTOR);

gfxContext.beginPath();
gfxContext.moveTo(centerX - 1, balloonBottomY);
gfxContext.lineTo(centerX - halfTieWidth, balloonBottomY + tieHeight);
gfxContext.quadraticCurveTo(centerX, balloonBottomY + tieCurveHeight,
centerX + halfTieWidth, balloonBottomY + tieHeight);
gfxContext.lineTo(centerX + 1, balloonBottomY);
gfxContext.fill();
}


window.onload = function () {
var status = document.getElementById("status");
var canvas = document.getElementById("canvas");
var context = canvas.getContext("2d");
Expand Down Expand Up @@ -34,6 +179,31 @@
context.fillStyle = "#FF0000";
context.beginPath();

var randomposX=Math.floor(Math.random()*620);
var randomposY=Math.floor(Math.random()*450);

var balloon1 = new CANVASBALLOON.Balloon('canvas', randomposX, randomposY, 40, 'rgb(229, 45, 45)');
balloon1.draw();

var randomposX=Math.floor(Math.random()*620);
var randomposY=Math.floor(Math.random()*450);

var balloon2 = new CANVASBALLOON.Balloon('canvas', randomposX, randomposY, 30, 'rgb(45, 137, 229)');
balloon2.draw();

var randomposX=Math.floor(Math.random()*620);
var randomposY=Math.floor(Math.random()*450);

var balloon3 = new CANVASBALLOON.Balloon('canvas', randomposX, randomposY, 25, 'rgb(113, 229, 45)');
balloon3.draw();

var randomposX=Math.floor(Math.random()*620);
var randomposY=Math.floor(Math.random()*450);

var balloon4 = new CANVASBALLOON.Balloon('canvas', randomposX, randomposY, 25, 'rgb(174, 0, 255)');
balloon4.draw();


// Display the skeleton joints.
for (var i = 0; i < jsonObject.skeletons.length; i++) {
for (var j = 0; j < jsonObject.skeletons[i].joints.length; j++) {
Expand All @@ -50,4 +220,4 @@
// Inform the server about the update.
socket.send("Skeleton updated on: " + (new Date()).toDateString() + ", " + (new Date()).toTimeString());
};
};
}
9 changes: 9 additions & 0 deletions Kinect.Server/App.config
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="couchbase" type="Couchbase.Configuration.CouchbaseClientSection, Couchbase"/>
</configSections>
<couchbase>
<add uri="http://127.0.0.1:8091/pools/default"/>
</couchbase>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
71 changes: 66 additions & 5 deletions Kinect.Server/Kinect.Server.csproj
Expand Up @@ -11,34 +11,66 @@
<RootNamespace>Kinect.Server</RootNamespace>
<AssemblyName>Kinect.Server</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugSymbols>false</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="Couchbase, Version=1.1.6.0, Culture=neutral, PublicKeyToken=05e9c6b5a9ec94c2, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Libs\Couchbase.dll</HintPath>
</Reference>
<Reference Include="Enyim.Caching, Version=2.12.0.0, Culture=neutral, PublicKeyToken=05e9c6b5a9ec94c2, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Libs\Enyim.Caching.dll</HintPath>
</Reference>
<Reference Include="Fleck, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Libs\Fleck.dll</HintPath>
</Reference>
<Reference Include="Hammock">
<HintPath>Libs\Hammock.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Kinect, Version=1.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="Newtonsoft.Json">
<HintPath>Libs\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.Serialization" />
Expand All @@ -49,14 +81,43 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="FakeEvent.cs" />
<Compile Include="KinectHelper.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SkeletonSerializer.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Libs\Couchbase.dll" />
<Content Include="Libs\Couchbase.dll.VisualState.xml" />
<Content Include="Libs\Enyim.Caching.dll" />
<Content Include="Libs\Fleck.dll" />
<Content Include="Libs\Hammock.dll" />
<Content Include="Libs\Newtonsoft.Json.dll" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4 Client Profile %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
13 changes: 13 additions & 0 deletions Kinect.Server/Kinect.Server.csproj.user
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishUrlHistory>publish\</PublishUrlHistory>
<InstallUrlHistory />
<SupportUrlHistory />
<UpdateUrlHistory />
<BootstrapperUrlHistory />
<ErrorReportUrlHistory />
<FallbackCulture>en-US</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
</PropertyGroup>
</Project>
Binary file modified Kinect.Server/Kinect.Server.suo
Binary file not shown.
Binary file added Kinect.Server/Libs/Couchbase.dll
Binary file not shown.
7 changes: 7 additions & 0 deletions Kinect.Server/Libs/Couchbase.dll.VisualState.xml
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<VisualState xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ShowCheckBoxes="false">
<TopNode>[0-1000]C:\dev\Build\couchbase-net-client\src\Couchbase\bin\Release\Couchbase.dll</TopNode>
<SelectedNode>[0-1000]C:\dev\Build\couchbase-net-client\src\Couchbase\bin\Release\Couchbase.dll</SelectedNode>
<ExcludeCategories>false</ExcludeCategories>
<Nodes />
</VisualState>

0 comments on commit 9386094

Please sign in to comment.