C# – XBox 360 Controller library with a sample application

Created an easy to use XBox 360 Controller library in C# (with a sample application) using the SharpDX.XInput managed .NET wrapper of the DirectX API.


Screenshot of the sample application.
Screenshot of the sample application.

A BUG in SharpDX.XInput ci-ci217, resulting in issues with the  left Thumb Stick, Left Trigger, and Right Trigger! Please stick to SharpDX.XInput v4.1.0-ci184 for now.

using System;
using Com.Okmer.GameController;
namespace XBoxSampleConsole
    class Program
        static void Main(string[] args)
            XBoxController controller = new XBoxController();
            Console.WriteLine("XBox 360 Controller (Press ENTER to exit...)");
            controller.Connection.ValueChanged += (s, e) => Console.WriteLine($"Connection state: {e.Value}");
            controller.Battery.ValueChanged += (s, e) => Console.WriteLine($"Battery level: {e.Value}");
            //Buttons A, B, X, Y
            controller.A.ValueChanged += (s, e) => Console.WriteLine($"A state: {e.Value}");
            controller.B.ValueChanged += (s, e) => Console.WriteLine($"B state: {e.Value}");
            controller.X.ValueChanged += (s, e) => Console.WriteLine($"X state: {e.Value}");
            controller.Y.ValueChanged += (s, e) => Console.WriteLine($"Y state: {e.Value}");
            //Buttons Start, Back
            controller.Start.ValueChanged += (s, e) => Console.WriteLine($"Start state: {e.Value}");
            controller.Back.ValueChanged += (s, e) => Console.WriteLine($"Back state: {e.Value}");
            //Buttons D-Pad Up, Down, Left, Right
            controller.Up.ValueChanged += (s, e) => Console.WriteLine($"Up state: {e.Value}");
            controller.Down.ValueChanged += (s, e) => Console.WriteLine($"Down state: {e.Value}");
            controller.Left.ValueChanged += (s, e) => Console.WriteLine($"Left state: {e.Value}");
            controller.Right.ValueChanged += (s, e) => Console.WriteLine($"Right state: {e.Value}");
            //Buttons Shoulder Left, Right
            controller.LeftShoulder.ValueChanged += (s, e) => Console.WriteLine($"Left shoulder state: {e.Value}");
            controller.RightShoulder.ValueChanged += (s, e) => Console.WriteLine($"Right shoulder state: {e.Value}");
            //Buttons Thumb Left, Right
            controller.LeftThumbclick.ValueChanged += (s, e) => Console.WriteLine($"Left thumb state: {e.Value}");
            controller.RightThumbclick.ValueChanged += (s, e) => Console.WriteLine($"Right thumb state: {e.Value}");
            //Trigger Position Left, Right 
            controller.LeftTrigger.ValueChanged += (s, e) => Console.WriteLine($"Left trigger position: {e.Value}");
            controller.RightTrigger.ValueChanged += (s, e) => Console.WriteLine($"Right trigger position: {e.Value}");
            //Thumb Positions Left, Right
            controller.LeftThumbstick.ValueChanged += (s, e) => Console.WriteLine($"Left thumb X: {e.Value.X}, Y: {e.Value.Y}");
            controller.RightThumbstick.ValueChanged += (s, e) => Console.WriteLine($"Right thumb X: {e.Value.X}, Y: {e.Value.Y}");
            //Rumble Left, Right
            controller.LeftRumble.ValueChanged += (s, e) => Console.WriteLine($"Left rumble speed: {e.Value}");
            controller.RightRumble.ValueChanged += (s, e) => Console.WriteLine($"Right rumble speed: {e.Value}");
            //Rumble 0.25f speed for 500 milliseconds when the A or B button is pushed
            controller.A.ValueChanged += (s, e) => controller.LeftRumble.Rumble(0.25f, 500);
            controller.B.ValueChanged += (s, e) => controller.RightRumble.Rumble(0.25f, 500);
            //Rumble at 1.0f speed for 1000 milliseconds when the X or Y button is pushed
            controller.X.ValueChanged += (s, e) => controller.LeftRumble.Rumble(1.0f, 1000);
            controller.Y.ValueChanged += (s, e) => controller.RightRumble.Rumble(1.0f, 1000);
            //Rumble at the speed of the trigger position
            controller.LeftTrigger.ValueChanged += (s, e) => controller.LeftRumble.Rumble(e.Value);
            controller.RightTrigger.ValueChanged += (s, e) => controller.RightRumble.Rumble(e.Value);
            //Wait on ENTER to exit...

InnoFaith – OBSERV 520 iOS App

The skin diagnostics suite bundled with the OBSERV 520. This iPad based skin diagnostics suite uses the Bluetooth 4.0 Low Energy (BLE) to communicate with the OBSERV 520 by Sylton, and uses the iPad camera in combination with GPU accelerated image filters to visualise a broad range of skin concerns.

Overview of the OBSERV 520 iOS App

App Store link: https://itunes.apple.com/us/app/observ-520/id781554722

Sylton (InnoFaith) product information: https://www.sylton.com/observ

Color Picker 1.1

I build a simple Color Picker 1.1 application that samples the pixel color under the mouse cursor point (because I needed it). The application is a stand alone (static build) Qt5 application with some minor Win32 API stuff, to sample the color at the cursor position.

ColorPicker 1.1

The application supports a number of RGB based color formats and formating formats. The application can run in the background, and used the CTRL+1, CTRL+2, and CTRL+3 hotkey combinations to sample a color in one of its three sample slots. The CTRL+SHIFT+1, CTRL+SHIFT+2, and CTRL+SHIFT+3 hotkey combinations can be used to copy the sample slot content to the clibboard. This enables easy copy and paste access to the sampled color values.

Reduce size (static) executables

This little (cross-platform) executable compression tool Ultimate Packer for eXecutables (UPX) can greatly reduce the size of (static build) executables. The executable filesize will be reduced to the size of a ZIP file containing the same executable.

The tool is very easy to use, just drag-and-drop your executable onto the upx.exe to use the default (fast) compression option of the tool, or type “upx <filename>” in the command-line. Adding the (much slower) “–utra-brute” command-line argument will reduce the filesize even further.

A static build Qt5.1.1 MinGW compiled application with a filesize of 12.972.032 bytes (12.3MB):

DEFAULT: 12.972.032 bytes (12.3MB) is reduced to 5.218.816 bytes (4.97 MB) using the (fast) default settings.

ULTRA-BRUTE: 12.972.032 bytes (12.3MB) is reduced to 4.488.704 bytes (4.28 MB) using the (much slower) “–ultra-brute” argument.

TU/e – COMBat: Visualizing co-occurrence of annotation terms

Remko van Brakel, Mark Fiers, Christof Francke, Michel Westenberg, Huub van de Wetering

We propose a visual analysis approach that employs a matrix-based visualization technique to explore relations between annotation terms in biological data sets. Our flexible framework provides various ways to form combinations of data elements, which results in a co-occurrence matrix. Each cell in this matrix stores a list of items associated with the combination of the corresponding row and column element. By re-arranging the rows and columns of this matrix, and color-coding the cell contents, patterns become visible. Our prototype tool COMBat allows users to construct a new matrix on the fly by selecting subsets of items of interest, or filtering out uninteresting ones, and it provides various additional interaction techniques. We illustrate our approach with a few case studies concerning the identification of functional links between the presence of particular genes or genomic sequences and particular cellular processes.

COMBat: Visualizing co-occurrence of annotation terms
COMBat: Visualizing co-occurrence of annotation terms

Published in: Biological Data Visualization (BioVis), 2013 IEEE Symposium on

Recording of the COMBat presentation at BioVis 2013 by Michel Westenberg.

Coffee Tray 1.0 App for the iPad

Your relationships with your colleagues is important! Provide some work delight by getting a round of coffee once in a while (or get some colleague to do it for you).

Coffee Tray 1.0 main screen

This application will help you to remember and transport the hot beverage of choice for up-to five colleagues (plus one additional beverage for your self). Make great use of the perfectly flat surface of your own (or the companies) iPad.

Coffee Tray 1.0 icon

The current version provides a width range of hot beverages to choose from:
– Coffee black
– Coffee sugar
– Coffee creamer
– Coffee sugar & cream
– Bean coffee black
– Bean coffee sugar
– Cappuccino
– Cappuccino sugar
– Espresso
– Espresso sugar
– Chocolate
– Chocolate sugar
– Tea
– Tea sugar
– (Hot) Water

Start using the full office environment potential of your iPad today, and download this application!

Coffee Tray 1.0 selection screen

Apples reason to not approve the application for the App Store:
“We found your app encourages behavior that could result in damage to the user’s device, which is not in compliance with the App Store Review Guidelines.

Specifically, your App encourages the user to transport hot liquids on the device.”