Permalink
Browse files

Move to github

  • Loading branch information...
Izzatbek committed Mar 11, 2016
0 parents commit 5df7d33dc9a050d160fd56b3c34fbb8c5914c08c
Showing 309 changed files with 32,780 additions and 0 deletions.
@@ -0,0 +1,38 @@
.DS_Store
Makefile

*~
*.pro.user
*.o
*.app
*.a
*.prl
*.pyc
*.obj
*.Debug
*.Release
*.pdb
*.vcxproj.user
*.aps
*.sdf
*.opensdf
*.v11.suo
*.dll
*.ilk
*.iobj
*.ipdb
*.tlog

*node_modules/*

*debug/
*release/
*Debug/
*Release/

moc_*.cpp
ui_*.h
qrc_*.cpp

.loc
.qmake.stash
339 COPYING

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,12 @@
Copyright © Inria

http://libpointing.org/

This software may be used and distributed according to the terms of
the GNU General Public License version 2 (COPYING file in this
directory) or any later version.

Ad-hoc licences can be granted upon request.

Contact nicolas.roussel@inria.fr or gery.casiez@lifl.fr for more
information.
@@ -0,0 +1,85 @@
# Libpointing

An open-source cross-platform library to get raw events from pointing devices and master transfer functions.

## Description

Libpointing is an open-source cross-platform library that provides direct access to HID pointing devices and supports the design of pointing transfer functions.

## Installation

Visit [installation page](http://libpointing.org/user-guide/install/) or build it from source.

## Features

* runs on Windows, Mac OS X and Linux,
* makes it easy to choose the devices at run-time through the use of URIs,
* provides raw information from input devices,
* provides resolution and frequency information for the available pointing and display devices,
* supports hot-plugging
* allows to bypass the system's transfer functions to receive raw asynchronous events from one or more pointing devices.
* replicates as faithfully as possible the transfer functions used by **Microsoft Windows**, **Apple OS X** and **Xorg** (the X.Org Foundation server).
* running on these three platforms, it makes it possible to compare the replicated functions to the genuine ones as well as custom ones.
* provides the functionality to use existing transfer functions, custom ones or even build your own functions.
* supports subpixel interaction.
* Java, Python, Node.js bindings are available.

## Minimalistic example

Once you correctly installed *libpointing* and linked it to your project, simply write `#include <pointing/pointing.h>` and start coding. Here is the console example which applies system specific transfer function to an input device and outputs the results to console:

#include <iostream>
#include <pointing/pointing.h>

using namespace pointing;

TransferFunction *func = 0;
// context is user data, timestamp is a moment at which the event was received
// input_dx, input_dy are displacements in horizontal and vertical directions
// buttons is a variable indicating which buttons of the pointing device were pressed.
void pointingCallback(void *, TimeStamp::inttime timestamp, int input_dx, int input_dy, int buttons) {
if (!func) return;
int output_dx = 0, output_dy = 0;
// In order to use a particular transfer function, its applyi method must be called.
func->applyi(input_dx, input_dy, &output_dx, &output_dy, timestamp);
std::cout << "Displacements in x and y: " << input_dx << " " << input_dy << std::endl;
std::cout << "Corresponding pixel displacements: " << output_dx << " " << output_dy << std::endl;
}
int main() {
// Basically, to start using main functionality of libpointing
// one needs to create objects of PointingDevice, DisplayDevice classes,
// connect them passing to TransferFunction class object.
// Any available pointing and display devices
// if debugLevel > 0, the list of available devices
// and extended information will be output.
PointingDevice *input = PointingDevice::create("any:?debugLevel=1");
DisplayDevice *output = DisplayDevice::create("any:?debugLevel=1");
func = TransferFunction::create("sigmoid:?debugLevel=2", input, output);
// To receive events from PointingDevice object, a callback function must be set.
input->setPointingCallback(pointingCallback);
while (1)
PointingDevice::idle(100); // milliseconds
delete input;
delete output;
delete func;
return 0;
}
## Contributors
* [Nicolas Roussel](http://interaction.lille.inria.fr/~roussel)
* [Géry Casiez](http://www.lifl.fr/~casiez/)
* Izzatbek Mukhanov
## License
This software may be used and distributed according to the terms of the GNU General Public License version 2 or any later version.
14 all.pro
@@ -0,0 +1,14 @@
# all.pro --
#
# Initial software
# Authors: Nicolas Roussel
# Copyright © Inria

TEMPLATE = subdirs

ALL_APPS = pointing apps
for(dir, ALL_APPS) {
exists($$dir) {
SUBDIRS += $$dir
}
}
@@ -0,0 +1,9 @@
# apps/apps.pro --
#
# Initial software
# Authors: Nicolas Roussel
# Copyright © Inria

TEMPLATE = subdirs

SUBDIRS += consoleExample glutExample qtExample
@@ -0,0 +1,112 @@
/* -*- mode: c++ -*-
*
* apps/consoleExample/consoleExample.cpp --
*
* Initial software
* Authors: Gery Casiez, Nicolas Roussel
* Copyright © Inria
*
* http://libpointing.org/
*
* This software may be used and distributed according to the terms of
* the GNU General Public License version 2 or any later version.
*
*/

#include <pointing/pointing.h>

#include <iomanip>
#include <stdexcept>

using namespace pointing ;

TransferFunction *func = 0 ;
TimeStamp::inttime last_time = 0 ;
bool button_pressed = false ;

void
pointingCallback(void * /*context*/, TimeStamp::inttime timestamp,
int input_dx, int input_dy, int buttons) {
if (!func) return ;

int output_dx=0, output_dy=0 ;
func->applyi(input_dx, input_dy, &output_dx, &output_dy, timestamp) ;
double delta = (double)(timestamp - last_time)/TimeStamp::one_millisecond ;
if (delta<=0.0) std::cout << std::endl ;
std::cout << timestamp << " ns (" << TimeStamp::createAsStringFrom(timestamp) << "), "
<< std::setw(7) << delta << " ms later (" << std::setw(7) << (1000.0/delta) << " Hz), "
<< "(" << std::setw(3) << input_dx << ", " << std::setw(3) << input_dy << ") counts"
<< " -> (" << std::setw(3) << output_dx << ", " << std::setw(3) << output_dy << ") pixels, "
<< "buttons: " << buttons << std::endl ;
if (delta<=0.0) std::cout << std::endl ;
last_time = timestamp;
button_pressed = buttons&PointingDevice::BUTTON_2 ;
}

int
main(int argc, char** argv) {
try {

if (argc < 3)
std::cout
<< "Usage: " << argv[0] << " [inputdeviceURI [outputdeviceURI [transferfunctionURI]]]" << std::endl
<< "Using default values for some parameters" << std::endl ;

// --- Pointing device ----------------------------------------------------

PointingDevice *input = PointingDevice::create(argc>1?argv[1]:"any:?debugLevel=1") ;
for (TimeStamp reftime, now;
!input->isActive() && now-reftime<15*TimeStamp::one_second;
now.refresh())
PointingDevice::idle(500) ;

std::cout << std::endl << "Pointing device" << std::endl ;
std::cout << " " << input->getURI(true).asString() << std::endl
<< " " << input->getResolution() << " CPI, "
<< input->getUpdateFrequency() << " Hz" << std::endl
<< " device is " << (input->isActive()?"":"not ") << "active" << std::endl
<< std::endl ;

// --- Display device -----------------------------------------------------

DisplayDevice *output = DisplayDevice::create(argc>2?argv[2]:"any:?debugLevel=1") ;

double hdpi, vdpi;
output->getResolution(&hdpi, &vdpi) ;
DisplayDevice::Size size = output->getSize() ;
DisplayDevice::Bounds bounds = output->getBounds() ;
std::cout << std::endl << "Display device" << std::endl
<< " " << output->getURI(true).asString() << std::endl
<< " " << bounds.size.width << " x " << bounds.size.height << " pixels, "
<< size.width << " x " << size.height << " mm" << std::endl
<< " " << hdpi << " x " << vdpi << " PPI, "
<< output->getRefreshRate() << " Hz" << std::endl ;

// --- Transfer function --------------------------------------------------

func = TransferFunction::create(argc>3?argv[3]:"sigmoid:?debugLevel=2", input, output) ;

std::cout << std::endl << "Transfer function" << std::endl
<< " " << func->getURI(true).asString() << std::endl
<< std::endl ;

// --- Ready to go --------------------------------------------------------

input->setPointingCallback(pointingCallback) ;
while (!button_pressed || 1)
PointingDevice::idle(100) ; // milliseconds

// --- Done ---------------------------------------------------------------

delete input ;
delete output ;
delete func ;

} catch (std::runtime_error e) {
std::cerr << "Runtime error: " << e.what() << std::endl ;
} catch (std::exception e) {
std::cerr << "Exception: " << e.what() << std::endl ;
}

return 0 ;
}
@@ -0,0 +1,17 @@
# apps/consoleExample/consoleExample.pro --
#
# Initial software
# Authors: Gery Casiez
# Copyright © Inria

TEMPLATE = app
CONFIG += warn_on link_prl
CONFIG -= app_bundle

TARGET = consoleExample

POINTING = ../..
include($$POINTING/pointing/pointing.pri)

HEADERS +=
SOURCES += consoleExample.cpp
Oops, something went wrong.

0 comments on commit 5df7d33

Please sign in to comment.