Files
OpenSpace/modules/touch/touchmodule.h
Mikael Pettersson a33057d830 Feature/integrated touchserver (#1015)
* WINDOWS: Touch server integrated into module

The touch server functionality has been integrated into the touch module
which is enabled by-default when the touch module is used on a windows
build.
The touch-hook checks for a connected digitizer (pen or touchscreen, but
I haven't tested pen)

This commit should also fix two potential low-risk race conditions in
the tuioear.cpp file.

* Added comment regarding which window we use

* Added copyright notice on the win32_touch files

Also changed from #pragma to #ifndef

* Fixes based on review

- Added anonymous namespace
- Put win32hook in openspace namespace
- Fixed indentations and linebreaks
- Fixed an issue regarding global state deinitialization
2019-12-02 14:09:15 +01:00

69 lines
3.3 KiB
C++

/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_MODULE_TOUCH___TOUCHMODULE___H__
#define __OPENSPACE_MODULE_TOUCH___TOUCHMODULE___H__
#include <openspace/util/openspacemodule.h>
#include <modules/touch/include/touchmarker.h>
#include <modules/touch/include/touchinteraction.h>
namespace openspace {
#ifdef WIN32
class Win32TouchHook;
#endif //WIN32
class TouchModule : public OpenSpaceModule {
using Point = std::pair<int, TUIO::TuioPoint>;
public:
TouchModule();
~TouchModule();
private:
/**
* Returns true if new touch input occured since the last frame
*/
bool processNewInput();
/**
* Checks if touchevent should be parsed to the webgui
*/
void processNewWebInput(const std::vector<TUIO::TuioCursor>& listOfContactPoints);
TuioEar _ear;
TouchInteraction _touch;
TouchMarker _markers;
std::vector<TUIO::TuioCursor> _listOfContactPoints;
// contains an id and the TuioPoint that was processed last frame
std::vector<Point> _lastProcessed;
glm::ivec2 _webPositionCallback = glm::ivec2(0,0);
#ifdef WIN32
std::unique_ptr<Win32TouchHook> _win32TouchHook;
#endif //WIN32
};
} // namespace openspace
#endif // __OPENSPACE_MODULE_TOUCH___TOUCHMODULE___H__