├── .gitignore ├── LICENSE.txt ├── Makefile ├── SimpleSimulator.cpp ├── SimpleSimulator.h ├── TUIO ├── Doxyfile ├── FlashSender.cpp ├── FlashSender.h ├── LibExport.h ├── OneEuroFilter.cpp ├── OneEuroFilter.h ├── OscReceiver.cpp ├── OscReceiver.h ├── OscSender.h ├── TcpReceiver.cpp ├── TcpReceiver.h ├── TcpSender.cpp ├── TcpSender.h ├── TuioBlob.cpp ├── TuioBlob.h ├── TuioClient.cpp ├── TuioClient.h ├── TuioContainer.cpp ├── TuioContainer.h ├── TuioCursor.cpp ├── TuioCursor.h ├── TuioDispatcher.cpp ├── TuioDispatcher.h ├── TuioListener.h ├── TuioManager.cpp ├── TuioManager.h ├── TuioObject.cpp ├── TuioObject.h ├── TuioPoint.cpp ├── TuioPoint.h ├── TuioServer.cpp ├── TuioServer.h ├── TuioTime.cpp ├── TuioTime.h ├── UdpReceiver.cpp ├── UdpReceiver.h ├── UdpSender.cpp ├── UdpSender.h ├── WebSockSender.cpp └── WebSockSender.h ├── TuioDemo.cpp ├── TuioDemo.h ├── TuioDump.cpp ├── TuioDump.h ├── macosx ├── English.lproj │ └── InfoPlist.strings ├── SimpleSimulator.plist ├── SimpleSimulator.xcodeproj │ └── project.pbxproj ├── TUIO.icns ├── TuioDemo.plist └── TuioDemo.xcodeproj │ └── project.pbxproj ├── oscpack ├── CHANGES ├── LICENSE ├── README ├── TODO ├── ip │ ├── IpEndpointName.cpp │ ├── IpEndpointName.h │ ├── NetworkingUtils.h │ ├── PacketListener.h │ ├── TimerListener.h │ ├── UdpSocket.h │ ├── posix │ │ ├── NetworkingUtils.cpp │ │ └── UdpSocket.cpp │ └── win32 │ │ ├── NetworkingUtils.cpp │ │ └── UdpSocket.cpp └── osc │ ├── MessageMappingOscPacketListener.h │ ├── OscException.h │ ├── OscHostEndianness.h │ ├── OscOutboundPacketStream.cpp │ ├── OscOutboundPacketStream.h │ ├── OscPacketListener.h │ ├── OscPrintReceivedElements.cpp │ ├── OscPrintReceivedElements.h │ ├── OscReceivedElements.cpp │ ├── OscReceivedElements.h │ ├── OscTypes.cpp │ └── OscTypes.h ├── readme.md └── windows ├── SimpleSimulator.rc ├── SimpleSimulator.vcxproj ├── SimpleSimulator.vcxproj.filters ├── SimpleSimulator.vcxproj.user ├── TUIO.ico ├── TUIO_CPP.sln ├── TuioDemo.rc ├── TuioDemo.vcxproj ├── TuioDemo.vcxproj.filters ├── TuioDemo.vcxproj.user ├── TuioDump.vcxproj ├── TuioDump.vcxproj.filters ├── TuioDump.vcxproj.user ├── libTUIO.vcxproj ├── libTUIO.vcxproj.filters ├── libTUIO.vcxproj.user └── sdl ├── Win32 ├── SDL2.dll ├── SDL2.lib ├── SDL2main.lib ├── freeglut.dll └── freeglut.lib ├── include ├── GL │ ├── freeglut.h │ ├── freeglut_ext.h │ ├── freeglut_std.h │ └── glut.h ├── SDL.h ├── SDL_assert.h ├── SDL_atomic.h ├── SDL_audio.h ├── SDL_bits.h ├── SDL_blendmode.h ├── SDL_clipboard.h ├── SDL_config.h ├── SDL_cpuinfo.h ├── SDL_egl.h ├── SDL_endian.h ├── SDL_error.h ├── SDL_events.h ├── SDL_filesystem.h ├── SDL_gamecontroller.h ├── SDL_gesture.h ├── SDL_haptic.h ├── SDL_hints.h ├── SDL_joystick.h ├── SDL_keyboard.h ├── SDL_keycode.h ├── SDL_loadso.h ├── SDL_log.h ├── SDL_main.h ├── SDL_messagebox.h ├── SDL_mouse.h ├── SDL_mutex.h ├── SDL_name.h ├── SDL_opengl.h ├── SDL_opengl_glext.h ├── SDL_opengles.h ├── SDL_opengles2.h ├── SDL_opengles2_gl2.h ├── SDL_opengles2_gl2ext.h ├── SDL_opengles2_gl2platform.h ├── SDL_opengles2_khrplatform.h ├── SDL_pixels.h ├── SDL_platform.h ├── SDL_power.h ├── SDL_quit.h ├── SDL_rect.h ├── SDL_render.h ├── SDL_revision.h ├── SDL_rwops.h ├── SDL_scancode.h ├── SDL_shape.h ├── SDL_stdinc.h ├── SDL_surface.h ├── SDL_system.h ├── SDL_syswm.h ├── SDL_test.h ├── SDL_test_assert.h ├── SDL_test_common.h ├── SDL_test_compare.h ├── SDL_test_crc32.h ├── SDL_test_font.h ├── SDL_test_fuzzer.h ├── SDL_test_harness.h ├── SDL_test_images.h ├── SDL_test_log.h ├── SDL_test_md5.h ├── SDL_test_random.h ├── SDL_thread.h ├── SDL_timer.h ├── SDL_touch.h ├── SDL_types.h ├── SDL_version.h ├── SDL_video.h ├── begin_code.h └── close_code.h └── x64 ├── SDL2.dll ├── SDL2.lib ├── SDL2main.lib ├── freeglut.dll └── freeglut.lib /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | *.mode1v3 3 | 4 | *.pbxuser 5 | 6 | *.perspectivev3 7 | 8 | project.xcworkspace 9 | 10 | *.xcuserdatad 11 | 12 | build 13 | 14 | doc 15 | 16 | *.o 17 | 18 | *.so 19 | 20 | *.a 21 | 22 | *.db 23 | 24 | *.dylib 25 | 26 | *.suo 27 | 28 | *.sdf 29 | 30 | TuioDump 31 | 32 | TuioDemo 33 | 34 | SimpleSimulator 35 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | PLATFORM=$(shell uname) 2 | ENDIANESS=OSC_HOST_LITTLE_ENDIAN 3 | 4 | LD_FLAGS = -lGL -lGLU -lglut 5 | 6 | TUIO_DEMO = TuioDemo 7 | TUIO_DUMP = TuioDump 8 | SIMPLE_SIMULATOR = SimpleSimulator 9 | TUIO_STATIC = libTUIO.a 10 | TUIO_SHARED = libTUIO.so 11 | 12 | SDL_LDFLAGS := $(shell sdl2-config --libs) 13 | SDL_CFLAGS := $(shell sdl2-config --cflags) 14 | 15 | INCLUDES = -I./TUIO -I./oscpack 16 | #CFLAGS = -g -Wall -O3 -fPIC $(SDL_CFLAGS) 17 | CFLAGS = -w -O3 -fPIC $(SDL_CFLAGS) 18 | CXXFLAGS = $(CFLAGS) $(INCLUDES) -D$(ENDIANESS) 19 | SHARED_OPTIONS = -shared -Wl,-soname,$(TUIO_SHARED) 20 | 21 | ifeq ($(PLATFORM), Darwin) 22 | # CXX = g++ -stdlib=libstdc++ 23 | # TARGET = -mmacosx-version-min=10.6 -arch=i386 -arch x86_64 24 | TARGET = -mmacosx-version-min=10.9 25 | CFLAGS += $(TARGET) 26 | CXXFLAGS += $(TARGET) 27 | TUIO_SHARED = libTUIO.dylib 28 | LD_FLAGS = -framework OpenGL -framework GLUT -framework SDL2 -framework Cocoa 29 | SHARED_OPTIONS = -dynamiclib -Wl,-dylib_install_name,$(TUIO_SHARED) 30 | SDL_LDFLAGS = 31 | endif 32 | 33 | %.o: %.cpp 34 | @echo [CXX] $@ 35 | @ $(CXX) $(CXXFLAGS) -o $@ -c $< 36 | 37 | DEMO_SOURCES = TuioDemo.cpp 38 | DEMO_OBJECTS = TuioDemo.o 39 | DUMP_SOURCES = TuioDump.cpp 40 | DUMP_OBJECTS = TuioDump.o 41 | SIMULATOR_SOURCES = SimpleSimulator.cpp 42 | SIMULATOR_OBJECTS = SimpleSimulator.o 43 | 44 | COMMON_TUIO_SOURCES = ./TUIO/TuioTime.cpp ./TUIO/TuioPoint.cpp ./TUIO/TuioContainer.cpp ./TUIO/TuioObject.cpp ./TUIO/TuioCursor.cpp ./TUIO/TuioBlob.cpp ./TUIO/TuioDispatcher.cpp ./TUIO/TuioManager.cpp ./TUIO/OneEuroFilter.cpp 45 | SERVER_TUIO_SOURCES = ./TUIO/TuioServer.cpp ./TUIO/UdpSender.cpp ./TUIO/TcpSender.cpp ./TUIO/WebSockSender.cpp ./TUIO/FlashSender.cpp 46 | CLIENT_TUIO_SOURCES = ./TUIO/TuioClient.cpp ./TUIO/OscReceiver.cpp ./TUIO/UdpReceiver.cpp ./TUIO/TcpReceiver.cpp 47 | OSC_SOURCES = ./oscpack/osc/OscTypes.cpp ./oscpack/osc/OscOutboundPacketStream.cpp ./oscpack/osc/OscReceivedElements.cpp ./oscpack/osc/OscPrintReceivedElements.cpp ./oscpack/ip/posix/NetworkingUtils.cpp ./oscpack/ip/posix/UdpSocket.cpp 48 | 49 | COMMON_TUIO_OBJECTS = $(COMMON_TUIO_SOURCES:.cpp=.o) 50 | SERVER_TUIO_OBJECTS = $(SERVER_TUIO_SOURCES:.cpp=.o) 51 | CLIENT_TUIO_OBJECTS = $(CLIENT_TUIO_SOURCES:.cpp=.o) 52 | OSC_OBJECTS = $(OSC_SOURCES:.cpp=.o) 53 | 54 | all: $(TUIO_DUMP) $(TUIO_DEMO) $(SIMPLE_SIMULATOR) $(TUIO_STATIC) $(TUIO_SHARED) 55 | 56 | $(TUIO_STATIC): $(COMMON_TUIO_OBJECTS) $(CLIENT_TUIO_OBJECTS) $(SERVER_TUIO_OBJECTS) $(OSC_OBJECTS) 57 | @echo [LD] $(TUIO_STATIC) 58 | @ ar rcs $@ $(COMMON_TUIO_OBJECTS) $(CLIENT_TUIO_OBJECTS) $(SERVER_TUIO_OBJECTS) $(OSC_OBJECTS) 59 | 60 | $(TUIO_SHARED): $(COMMON_TUIO_OBJECTS) $(CLIENT_TUIO_OBJECTS) $(SERVER_TUIO_OBJECTS) $(OSC_OBJECTS) 61 | @echo [LD] $(TUIO_SHARED) 62 | @ $(CXX) -o $@ $+ -lpthread $(SHARED_OPTIONS) 63 | 64 | $(TUIO_DUMP): $(COMMON_TUIO_OBJECTS) $(CLIENT_TUIO_OBJECTS) $(OSC_OBJECTS) $(DUMP_OBJECTS) 65 | @echo [LD] $(TUIO_DUMP) 66 | @ $(CXX) -o $@ $+ -lpthread 67 | 68 | $(TUIO_DEMO): $(COMMON_TUIO_OBJECTS) $(CLIENT_TUIO_OBJECTS) $(OSC_OBJECTS) $(DEMO_OBJECTS) 69 | @echo [LD] $(TUIO_DEMO) 70 | @ $(CXX) -o $@ $+ -lpthread $(SDL_LDFLAGS) $(LD_FLAGS) 71 | 72 | $(SIMPLE_SIMULATOR): $(COMMON_TUIO_OBJECTS) $(SERVER_TUIO_OBJECTS) $(OSC_OBJECTS) $(SIMULATOR_OBJECTS) 73 | @echo [LD] $(SIMPLE_SIMULATOR) 74 | @ $(CXX) -o $@ $+ -lpthread $(SDL_LDFLAGS) $(LD_FLAGS) 75 | 76 | clean: 77 | @echo [CLEAN] $(TUIO_DUMP) $(TUIO_DEMO) $(SIMPLE_SIMULATOR) $(TUIO_STATIC) $(TUIO_SHARED) 78 | @ rm -f $(TUIO_DUMP) $(TUIO_DEMO) $(SIMPLE_SIMULATOR) $(TUIO_STATIC) $(TUIO_SHARED) 79 | @ rm -f $(COMMON_TUIO_OBJECTS) $(CLIENT_TUIO_OBJECTS) $(SERVER_TUIO_OBJECTS) $(OSC_OBJECTS) $(DUMP_OBJECTS) $(DEMO_OBJECTS) $(SIMULATOR_OBJECTS) 80 | -------------------------------------------------------------------------------- /SimpleSimulator.h: -------------------------------------------------------------------------------- 1 | /* 2 | TUIO C++ Server Demo 3 | Copyright (c) 2005-2016 Martin Kaltenbrunner 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | #ifndef INCLUDED_SimpleSimulator_H 21 | #define INCLUDED_SimpleSimulator_H 22 | 23 | #include "TuioServer.h" 24 | #include "TuioCursor.h" 25 | #include "osc/OscTypes.h" 26 | #include 27 | #include 28 | 29 | #include "FlashSender.h" 30 | #include "TcpSender.h" 31 | #include "WebSockSender.h" 32 | 33 | #ifdef __APPLE__ 34 | #include 35 | #include 36 | #include 37 | #include 38 | #else 39 | #include "SDL.h" 40 | #include 41 | #include 42 | #include 43 | #endif 44 | 45 | using namespace TUIO; 46 | 47 | class SimpleSimulator { 48 | 49 | public: 50 | SimpleSimulator(TuioServer *server); 51 | ~SimpleSimulator() {}; 52 | 53 | void run(); 54 | TuioServer *tuioServer; 55 | std::list stickyCursorList; 56 | std::list jointCursorList; 57 | std::list activeCursorList; 58 | 59 | private: 60 | void drawFrame(); 61 | void drawString(const char *str); 62 | void processEvents(); 63 | void initWindow(); 64 | 65 | SDL_Window *window; 66 | SDL_Renderer *renderer; 67 | bool verbose, fullupdate, periodic, fullscreen, running, help; 68 | 69 | int width, height; 70 | int screen_width, screen_height; 71 | int window_width, window_height; 72 | TuioTime frameTime; 73 | 74 | void mousePressed(float x, float y); 75 | void mouseReleased(float x, float y); 76 | void mouseDragged(float x, float y); 77 | //int s_id; 78 | }; 79 | 80 | #endif /* INCLUDED_SimpleSimulator_H */ 81 | -------------------------------------------------------------------------------- /TUIO/Doxyfile: -------------------------------------------------------------------------------- 1 | # Doxyfile 1.5.6 2 | # Project related configuration options 3 | DOXYFILE_ENCODING = UTF-8 4 | PROJECT_NAME = "TUIO C++ Developer API" 5 | # Build related configuration options 6 | EXTRACT_ALL = NO 7 | EXTRACT_PRIVATE = NO 8 | EXTRACT_STATIC = NO 9 | EXTRACT_LOCAL_CLASSES = YES 10 | # configuration options related to the HTML output 11 | GENERATE_HTML = YES 12 | HTML_OUTPUT = ../doc 13 | HTML_FILE_EXTENSION = .html 14 | GENERATE_TREEVIEW = YES 15 | GENERATE_LATEX = NO 16 | -------------------------------------------------------------------------------- /TUIO/LibExport.h: -------------------------------------------------------------------------------- 1 | /* 2 | TUIO C++ Library 3 | Copyright (c) 2005-2017 Martin Kaltenbrunner 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 3.0 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library. 17 | */ 18 | 19 | #ifndef INCLUDED_LIBEXPORT_H 20 | #define INCLUDED_LIBEXPORT_H 21 | 22 | #ifdef WIN32 23 | #pragma warning(disable: 4251) // disable annoying template exporting warnings 24 | #pragma warning(disable: 4275) // disable warning caused by not exported OSC classes 25 | 26 | #ifdef LIB_EXPORT 27 | #define LIBDECL __declspec(dllexport) 28 | #else 29 | // #define LIBDECL __declspec(dllimport) 30 | #define LIBDECL 31 | #endif 32 | #else 33 | #define LIBDECL 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /TUIO/OneEuroFilter.cpp: -------------------------------------------------------------------------------- 1 | /* reacTIVision tangible interaction framework 2 | Copyright (C) 2005-2017 Martin Kaltenbrunner 3 | Based on an example by Nicolas Roussel 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | #include "OneEuroFilter.h" 21 | #include 22 | 23 | using namespace TUIO; 24 | 25 | double LowPassFilter::filter(double value, double alpha) { 26 | 27 | if (alpha<=0.0 || alpha>1.0) { 28 | std::cout << alpha << " alpha should be in (0.0., 1.0]" << std::endl; 29 | return value; 30 | } 31 | 32 | double result; 33 | if (initialized) 34 | result = alpha*value + (1.0-alpha)*lastResult; 35 | else { 36 | result = value; 37 | initialized = true; 38 | } 39 | 40 | lastRawValue = value; 41 | lastResult = result; 42 | return result; 43 | } 44 | 45 | // ----------------------------------------------------------------- 46 | 47 | double OneEuroFilter::alpha(double cutoff) { 48 | double te = 1.0 / freq; 49 | double tau = 1.0 / (2*M_PI*cutoff); 50 | return 1.0 / (1.0 + tau/te); 51 | } 52 | 53 | double OneEuroFilter::filter(double value, TimeStamp dt) { 54 | // update the sampling frequency based on timestamps 55 | if (lasttime!=UndefinedTime && dt!=UndefinedTime && dt!=lasttime) 56 | freq = 1.0 / dt; 57 | lasttime = dt; 58 | 59 | // estimate the current variation per second 60 | double dvalue = x->initialized ? (value - x->lastRawValue)*freq : value; 61 | 62 | double edvalue; 63 | edvalue = dx->filter(dvalue, alpha(dcutoff)); 64 | // use it to update the cutoff frequency 65 | double cutoff = mincutoff + beta*fabs(edvalue); 66 | // filter the given value 67 | return x->filter(value, alpha(cutoff)); 68 | } 69 | -------------------------------------------------------------------------------- /TUIO/OneEuroFilter.h: -------------------------------------------------------------------------------- 1 | /* reacTIVision tangible interaction framework 2 | Copyright (C) 2005-2017 Martin Kaltenbrunner 3 | Based on an example by Nicolas Roussel 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | #ifndef ONEEUROFILTER 21 | #define ONEEUROFILTER 22 | 23 | #define _USE_MATH_DEFINES 24 | #include 25 | #include 26 | 27 | typedef double TimeStamp; // in seconds 28 | static const TimeStamp UndefinedTime = -1.0; 29 | 30 | namespace TUIO { 31 | 32 | class LowPassFilter { 33 | 34 | public: 35 | 36 | bool initialized; 37 | double lastRawValue,lastResult; 38 | 39 | LowPassFilter(double initval=0.0) { 40 | 41 | lastRawValue = lastResult = initval; 42 | initialized = false; 43 | } 44 | 45 | double filter(double value, double alpha); 46 | }; 47 | 48 | // ----------------------------------------------------------------- 49 | 50 | class OneEuroFilter { 51 | 52 | double freq; 53 | double mincutoff; 54 | double beta; 55 | double dcutoff; 56 | LowPassFilter *x; 57 | LowPassFilter *dx; 58 | TimeStamp lasttime; 59 | 60 | double alpha(double cutoff); 61 | 62 | public: 63 | 64 | OneEuroFilter(double f, double mc=1.0, double b=0.0, double dc=1.0) { 65 | 66 | if (f<=0) throw std::range_error("freq should be >0"); 67 | else freq = f; 68 | if (mc<=0) throw std::range_error("mincutoff should be >0"); 69 | else mincutoff = mc; 70 | if (b<=0) throw std::range_error("beta should be >0"); 71 | else beta = b; 72 | if (dc<=0) throw std::range_error("dcutoff should be >0"); 73 | else dcutoff = dc; 74 | 75 | x = new LowPassFilter(alpha(mincutoff)); 76 | dx = new LowPassFilter(alpha(dcutoff)); 77 | lasttime = UndefinedTime; 78 | } 79 | 80 | ~OneEuroFilter(void) { 81 | delete x; 82 | delete dx; 83 | } 84 | 85 | double filter(double value, TimeStamp dt=UndefinedTime); 86 | 87 | }; 88 | 89 | } 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /TUIO/OscReceiver.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | TUIO C++ Library 3 | Copyright (c) 2005-2017 Martin Kaltenbrunner 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 3.0 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library. 17 | */ 18 | 19 | #include "OscReceiver.h" 20 | 21 | using namespace TUIO; 22 | using namespace osc; 23 | 24 | void OscReceiver::ProcessMessage( const ReceivedMessage& msg, const IpEndpointName& remoteEndpoint) { 25 | for (std::list::iterator client=clientList.begin(); client!= clientList.end(); client++) 26 | (*client)->processOSC(msg); 27 | } 28 | void OscReceiver::ProcessBundle( const ReceivedBundle& b, const IpEndpointName& remoteEndpoint) { 29 | 30 | try { 31 | for( ReceivedBundle::const_iterator i = b.ElementsBegin(); i != b.ElementsEnd(); ++i ){ 32 | if( i->IsBundle() ) 33 | ProcessBundle( ReceivedBundle(*i), remoteEndpoint); 34 | else 35 | ProcessMessage( ReceivedMessage(*i), remoteEndpoint); 36 | } 37 | } catch (MalformedBundleException& e) { 38 | std::cerr << "malformed OSC bundle: " << e.what() << std::endl; 39 | } 40 | 41 | } 42 | 43 | void OscReceiver::ProcessPacket( const char *data, int size, const IpEndpointName& remoteEndpoint ) { 44 | try { 45 | ReceivedPacket p( data, size ); 46 | if(p.IsBundle()) ProcessBundle( ReceivedBundle(p), remoteEndpoint); 47 | else ProcessMessage( ReceivedMessage(p), remoteEndpoint); 48 | } catch (MalformedBundleException& e) { 49 | std::cerr << "malformed OSC bundle: " << e.what() << std::endl; 50 | } 51 | } 52 | 53 | bool OscReceiver::isConnected() { 54 | return connected; 55 | } 56 | 57 | void OscReceiver::addTuioClient(TuioClient *client) { 58 | clientList.push_back(client); 59 | } 60 | 61 | -------------------------------------------------------------------------------- /TUIO/OscReceiver.h: -------------------------------------------------------------------------------- 1 | /* 2 | TUIO C++ Library 3 | Copyright (c) 2005-2017 Martin Kaltenbrunner 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 3.0 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library. 17 | */ 18 | 19 | #ifndef INCLUDED_OSCRECEIVER_H 20 | #define INCLUDED_OSCRECEIVER_H 21 | 22 | #include "LibExport.h" 23 | #include "TuioClient.h" 24 | 25 | #include "osc/OscReceivedElements.h" 26 | #include "osc/OscHostEndianness.h" 27 | #include "ip/PacketListener.h" 28 | #include "ip/IpEndpointName.h" 29 | 30 | namespace TUIO { 31 | 32 | class TuioClient; // Forward declaration 33 | 34 | /** 35 | * The OscReceiver is the base class for the various OSC transport methods such as UDP, TCP ... 36 | * 37 | * @author Martin Kaltenbrunner 38 | * @version 1.1.6 39 | */ 40 | class LIBDECL OscReceiver: public PacketListener { 41 | 42 | public: 43 | 44 | /** 45 | * The constructor is doing nothing in particular. 46 | */ 47 | OscReceiver() : connected(false) {}; 48 | 49 | /** 50 | * The destructor is doing nothing in particular. 51 | */ 52 | virtual ~OscReceiver() {}; 53 | 54 | /** 55 | * The OscReceiver connects and starts receiving TUIO messages via OSC 56 | * 57 | * @param lock running in the background if set to false (default) 58 | */ 59 | virtual void connect(bool lock=false) = 0; 60 | 61 | /** 62 | * The OscReceiver disconnects and stops receiving TUIO messages via OSC 63 | */ 64 | virtual void disconnect() = 0; 65 | 66 | /** 67 | * Returns true if this OscReceiver is currently connected. 68 | * @return true if this OscReceiver is currently connected 69 | */ 70 | bool isConnected(); 71 | 72 | /** 73 | * Attaches the provided TuioClient to this OscReceiver 74 | * 75 | * @param client a pointer to the TuioClient to attach 76 | */ 77 | void addTuioClient(TuioClient *client); 78 | 79 | /** 80 | * The OSC callback method where the incoming OSC data is received 81 | * 82 | * @param data the received OSC data 83 | * @param size the size of the received OSC data 84 | * @param remoteEndpoint the origin of the received OSC data 85 | */ 86 | void ProcessPacket( const char *data, int size, const IpEndpointName &remoteEndpoint ); 87 | 88 | protected: 89 | void ProcessBundle( const osc::ReceivedBundle& b, const IpEndpointName& remoteEndpoint); 90 | 91 | void ProcessMessage( const osc::ReceivedMessage& message, const IpEndpointName& remoteEndpoint); 92 | 93 | std::list clientList; 94 | bool connected; 95 | }; 96 | }; 97 | #endif /* INCLUDED_OSCRECEIVER_H */ 98 | -------------------------------------------------------------------------------- /TUIO/OscSender.h: -------------------------------------------------------------------------------- 1 | /* 2 | TUIO C++ Library 3 | Copyright (c) 2005-2017 Martin Kaltenbrunner 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 3.0 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library. 17 | */ 18 | 19 | #ifndef INCLUDED_OSCSENDER_H 20 | #define INCLUDED_OSCSENDER_H 21 | 22 | #include "LibExport.h" 23 | #include "osc/OscOutboundPacketStream.h" 24 | #include "osc/OscHostEndianness.h" 25 | #include "ip/NetworkingUtils.h" 26 | #include 27 | #include 28 | 29 | namespace TUIO { 30 | 31 | /** 32 | * The OscSender class is the base class for the various OSC transport methods such as UDP, TCP ... 33 | * 34 | * @author Martin Kaltenbrunner 35 | * @version 1.1.6 36 | */ 37 | class LIBDECL OscSender { 38 | 39 | public: 40 | 41 | /** 42 | * The constructor is doing nothing in particular. 43 | */ 44 | OscSender (): local(true) {}; 45 | 46 | /** 47 | * The destructor is doing nothing in particular. 48 | */ 49 | virtual ~OscSender() {} 50 | 51 | /** 52 | * This method delivers the provided OSC data 53 | * 54 | * @param *bundle the OSC stream to deliver 55 | * @return true if the data was delivered successfully 56 | */ 57 | virtual bool sendOscPacket (osc::OutboundPacketStream *bundle) = 0; 58 | 59 | /** 60 | * This method returns the connection state 61 | * 62 | * @return true if the connection is alive 63 | */ 64 | virtual bool isConnected () = 0; 65 | 66 | /** 67 | * This method returns if this OscSender delivers locally 68 | * 69 | * @return true if this OscSender delivers locally 70 | */ 71 | bool isLocal () { return local; }; 72 | 73 | /** 74 | * This method returns the maximum bundle size in bytes 75 | * 76 | * @return the maximum bundle size in bytes 77 | */ 78 | int getBufferSize () { return buffer_size; }; 79 | 80 | virtual const char* tuio_type() = 0; 81 | 82 | protected: 83 | unsigned int buffer_size; 84 | bool local; 85 | }; 86 | } 87 | 88 | 89 | #endif /* INCLUDED_OSCSENDER_H */ 90 | 91 | -------------------------------------------------------------------------------- /TUIO/TcpReceiver.h: -------------------------------------------------------------------------------- 1 | /* 2 | TUIO C++ Library 3 | Copyright (c) 2005-2017 Martin Kaltenbrunner 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 3.0 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library. 17 | */ 18 | 19 | #ifndef INCLUDED_TCPRECEIVER_H 20 | #define INCLUDED_TCPRECEIVER_H 21 | 22 | #include "OscReceiver.h" 23 | #define MAX_TCP_SIZE 65536 24 | 25 | #ifdef WIN32 26 | #include 27 | #include 28 | #include 29 | typedef int socklen_t; 30 | #else 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #endif 38 | 39 | namespace TUIO { 40 | 41 | /** 42 | * The TcpReceiver provides the OscReceiver functionality for the TCP transport method 43 | * 44 | * @author Martin Kaltenbrunner 45 | * @version 1.1.6 46 | */ 47 | class LIBDECL TcpReceiver: public OscReceiver { 48 | 49 | public: 50 | 51 | /** 52 | * This constructor creates a TcpReceiver instance listening to the provided TCP port 53 | * 54 | * @param port the number of the TCP port to listen to, defaults to 3333 55 | */ 56 | TcpReceiver (int port=3333); 57 | 58 | /** 59 | * This constructor creates a TcpReceiver connected to the provided host and TCP port 60 | * 61 | * @param host the host name to connect 62 | * @param port the number of the TCP port to listen to, defaults to 3333 63 | */ 64 | TcpReceiver (const char *host, int port); 65 | 66 | /** 67 | * The destructor is doing nothing in particular. 68 | */ 69 | virtual ~TcpReceiver(); 70 | 71 | /** 72 | * The TcpReceiver connects and starts receiving TUIO messages via TCP 73 | * 74 | * @param lock running in the background if set to false (default) 75 | */ 76 | void connect(bool lock=false); 77 | 78 | /** 79 | * The TcpReceiver disconnects and stops receiving TUIO messages via TCP 80 | */ 81 | void disconnect(); 82 | 83 | #ifndef WIN32 84 | int tcp_socket; 85 | std::list tcp_client_list; 86 | #else 87 | SOCKET tcp_socket; 88 | std::list tcp_client_list; 89 | #endif 90 | 91 | private: 92 | 93 | #ifndef WIN32 94 | pthread_t server_thread; 95 | #else 96 | HANDLE server_thread; 97 | DWORD ServerThreadId; 98 | #endif 99 | 100 | bool locked; 101 | }; 102 | }; 103 | #endif /* INCLUDED_TcpReceiver_H */ 104 | -------------------------------------------------------------------------------- /TUIO/TcpSender.h: -------------------------------------------------------------------------------- 1 | /* 2 | TUIO C++ Library 3 | Copyright (c) 2005-2017 Martin Kaltenbrunner 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 3.0 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library. 17 | */ 18 | 19 | #ifndef INCLUDED_TCPSENDER_H 20 | #define INCLUDED_TCPSENDER_H 21 | 22 | #include "OscSender.h" 23 | 24 | #ifdef WIN32 25 | #include 26 | #include 27 | #include 28 | typedef int socklen_t; 29 | #else 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #endif 37 | 38 | #include 39 | #define MAX_TCP_SIZE 65536 40 | 41 | namespace TUIO { 42 | 43 | /** 44 | * The TcpSender implements the TCP transport method for OSC 45 | * 46 | * @author Martin Kaltenbrunner 47 | * @version 1.1.6 48 | */ 49 | class LIBDECL TcpSender : public OscSender { 50 | 51 | public: 52 | 53 | /** 54 | * The default constructor creates a TcpSender that sends to the default TUIO port 3333 on localhost 55 | */ 56 | TcpSender(); 57 | 58 | /** 59 | * This constructor creates a TcpSender that sends to the provided port on the the given host 60 | * 61 | * @param host the receiving host name 62 | * @param port the outgoing TUIO TCP port number 63 | */ 64 | TcpSender(const char *host, int port); 65 | 66 | /** 67 | * This constructor creates a TcpSender that listens to the provided port 68 | * 69 | * @param port the incoming TUIO TCP port number 70 | */ 71 | TcpSender(int port); 72 | 73 | /** 74 | * The destructor closes the socket. 75 | */ 76 | virtual ~TcpSender(); 77 | 78 | /** 79 | * This method delivers the provided OSC data 80 | * 81 | * @param *bundle the OSC stream to deliver 82 | * @return true if the data was delivered successfully 83 | */ 84 | 85 | bool sendOscPacket (osc::OutboundPacketStream *bundle); 86 | 87 | /** 88 | * This method returns the connection state 89 | * 90 | * @return true if the connection is alive 91 | */ 92 | bool isConnected (); 93 | 94 | /** 95 | * This method is called whenever a new client connects 96 | * 97 | * @param tcp_client the socket handle of the new client 98 | */ 99 | virtual void newClient( int tcp_client ); 100 | 101 | int port_no; 102 | 103 | #ifdef WIN32 104 | SOCKET tcp_socket; 105 | std::list tcp_client_list; 106 | #else 107 | int tcp_socket; 108 | std::list tcp_client_list; 109 | #endif 110 | bool connected; 111 | const char* tuio_type() { return "TUIO/TCP"; } 112 | 113 | protected: 114 | char data_size[4]; 115 | char data_buffer[MAX_TCP_SIZE+4]; 116 | 117 | 118 | #ifdef WIN32 119 | HANDLE server_thread; 120 | DWORD ServerThreadId; 121 | #else 122 | pthread_t server_thread; 123 | #endif 124 | 125 | }; 126 | } 127 | #endif /* INCLUDED_TCPSENDER_H */ 128 | -------------------------------------------------------------------------------- /TUIO/TuioCursor.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | TUIO C++ Library 3 | Copyright (c) 2005-2017 Martin Kaltenbrunner 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 3.0 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library. 17 | */ 18 | 19 | #include "TuioCursor.h" 20 | 21 | using namespace TUIO; 22 | 23 | TuioCursor::TuioCursor (TuioTime ttime, long si, int ci, float xp, float yp):TuioContainer(ttime,si,xp,yp) { 24 | cursor_id = ci; 25 | } 26 | 27 | TuioCursor::TuioCursor (long si, int ci, float xp, float yp):TuioContainer(si,xp,yp) { 28 | cursor_id = ci; 29 | } 30 | 31 | TuioCursor::TuioCursor (TuioCursor *tcur):TuioContainer(tcur) { 32 | cursor_id = tcur->getCursorID(); 33 | } 34 | 35 | int TuioCursor::getCursorID() const{ 36 | return cursor_id; 37 | }; 38 | 39 | -------------------------------------------------------------------------------- /TUIO/TuioCursor.h: -------------------------------------------------------------------------------- 1 | /* 2 | TUIO C++ Library 3 | Copyright (c) 2005-2017 Martin Kaltenbrunner 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 3.0 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library. 17 | */ 18 | 19 | #ifndef INCLUDED_TUIOCURSOR_H 20 | #define INCLUDED_TUIOCURSOR_H 21 | 22 | #include "TuioContainer.h" 23 | 24 | namespace TUIO { 25 | 26 | /** 27 | * The TuioCursor class encapsulates /tuio/2Dcur TUIO cursors. 28 | * 29 | * @author Martin Kaltenbrunner 30 | * @version 1.1.6 31 | */ 32 | class LIBDECL TuioCursor: public TuioContainer { 33 | 34 | protected: 35 | /** 36 | * The individual cursor ID number that is assigned to each TuioCursor. 37 | */ 38 | int cursor_id; 39 | 40 | public: 41 | using TuioContainer::update; 42 | 43 | /** 44 | * This constructor takes a TuioTime argument and assigns it along with the provided 45 | * Session ID, Cursor ID, X and Y coordinate to the newly created TuioCursor. 46 | * 47 | * @param ttime the TuioTime to assign 48 | * @param si the Session ID to assign 49 | * @param ci the Cursor ID to assign 50 | * @param xp the X coordinate to assign 51 | * @param yp the Y coordinate to assign 52 | */ 53 | TuioCursor (TuioTime ttime, long si, int ci, float xp, float yp); 54 | 55 | /** 56 | * This constructor takes the provided Session ID, Cursor ID, X and Y coordinate 57 | * and assigs these values to the newly created TuioCursor. 58 | * 59 | * @param si the Session ID to assign 60 | * @param ci the Cursor ID to assign 61 | * @param xp the X coordinate to assign 62 | * @param yp the Y coordinate to assign 63 | */ 64 | TuioCursor (long si, int ci, float xp, float yp); 65 | 66 | /** 67 | * This constructor takes the atttibutes of the provided TuioCursor 68 | * and assigs these values to the newly created TuioCursor. 69 | * 70 | * @param tcur the TuioCursor to assign 71 | */ 72 | TuioCursor (TuioCursor *tcur); 73 | 74 | /** 75 | * The destructor is doing nothing in particular. 76 | */ 77 | virtual ~TuioCursor(){}; 78 | 79 | /** 80 | * Returns the Cursor ID of this TuioCursor. 81 | * @return the Cursor ID of this TuioCursor 82 | */ 83 | int getCursorID() const; 84 | }; 85 | } 86 | #endif 87 | -------------------------------------------------------------------------------- /TUIO/TuioListener.h: -------------------------------------------------------------------------------- 1 | /* 2 | TUIO C++ Library 3 | Copyright (c) 2005-2017 Martin Kaltenbrunner 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 3.0 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library. 17 | */ 18 | 19 | #ifndef INCLUDED_TUIOLISTENER_H 20 | #define INCLUDED_TUIOLISTENER_H 21 | 22 | #include "TuioObject.h" 23 | #include "TuioCursor.h" 24 | #include "TuioBlob.h" 25 | 26 | namespace TUIO { 27 | 28 | /** 29 | *

The TuioListener interface provides a simple callback infrastructure which is used by the {@link TuioClient} class 30 | * to dispatch TUIO events to all registered instances of classes that implement the TuioListener interface defined here.

31 | *

Any class that implements the TuioListener interface is required to implement all of the callback methods defined here. 32 | * The {@link TuioClient} makes use of these interface methods in order to dispatch TUIO events to all registered TuioListener implementations.

33 | *

34 | * public class MyTuioListener implements TuioListener
35 | * ...

36 | * MyTuioListener listener = new MyTuioListener();
37 | * TuioClient client = new TuioClient();
38 | * client.addTuioListener(listener);
39 | * client.start();
40 | *

41 | * 42 | * @author Martin Kaltenbrunner 43 | * @version 1.1.6 44 | */ 45 | class LIBDECL TuioListener { 46 | 47 | public: 48 | /** 49 | * The destructor is doing nothing in particular. 50 | */ 51 | virtual ~TuioListener(){}; 52 | 53 | /** 54 | * This callback method is invoked by the TuioClient when a new TuioObject is added to the session. 55 | * 56 | * @param tobj the TuioObject reference associated to the addTuioObject event 57 | */ 58 | virtual void addTuioObject(TuioObject *tobj)=0; 59 | 60 | /** 61 | * This callback method is invoked by the TuioClient when an existing TuioObject is updated during the session. 62 | * 63 | * @param tobj the TuioObject reference associated to the updateTuioObject event 64 | */ 65 | virtual void updateTuioObject(TuioObject *tobj)=0; 66 | 67 | /** 68 | * This callback method is invoked by the TuioClient when an existing TuioObject is removed from the session. 69 | * 70 | * @param tobj the TuioObject reference associated to the removeTuioObject event 71 | */ 72 | virtual void removeTuioObject(TuioObject *tobj)=0; 73 | 74 | /** 75 | * This callback method is invoked by the TuioClient when a new TuioCursor is added to the session. 76 | * 77 | * @param tcur the TuioCursor reference associated to the addTuioCursor event 78 | */ 79 | virtual void addTuioCursor(TuioCursor *tcur)=0; 80 | 81 | /** 82 | * This callback method is invoked by the TuioClient when an existing TuioCursor is updated during the session. 83 | * 84 | * @param tcur the TuioCursor reference associated to the updateTuioCursor event 85 | */ 86 | virtual void updateTuioCursor(TuioCursor *tcur)=0; 87 | 88 | /** 89 | * This callback method is invoked by the TuioClient when an existing TuioCursor is removed from the session. 90 | * 91 | * @param tcur the TuioCursor reference associated to the removeTuioCursor event 92 | */ 93 | virtual void removeTuioCursor(TuioCursor *tcur)=0; 94 | 95 | /** 96 | * This callback method is invoked by the TuioClient when a new TuioBlob is added to the session. 97 | * 98 | * @param tcur the TuioBlob reference associated to the addTuioBlob event 99 | */ 100 | virtual void addTuioBlob(TuioBlob *tblb)=0; 101 | 102 | /** 103 | * This callback method is invoked by the TuioClient when an existing TuioBlob is updated during the session. 104 | * 105 | * @param tblb the TuioBlob reference associated to the updateTuioBlob event 106 | */ 107 | virtual void updateTuioBlob(TuioBlob *tblb)=0; 108 | 109 | /** 110 | * This callback method is invoked by the TuioClient when an existing TuioBlob is removed from the session. 111 | * 112 | * @param tblb the TuioBlob reference associated to the removeTuioBlob event 113 | */ 114 | virtual void removeTuioBlob(TuioBlob *tblb)=0; 115 | 116 | /** 117 | * This callback method is invoked by the TuioClient to mark the end of a received TUIO message bundle. 118 | * 119 | * @param ftime the TuioTime associated to the current TUIO message bundle 120 | */ 121 | virtual void refresh(TuioTime ftime)=0; 122 | }; 123 | } 124 | #endif /* INCLUDED_TUIOLISTENER_H */ 125 | -------------------------------------------------------------------------------- /TUIO/TuioObject.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | TUIO C++ Library 3 | Copyright (c) 2005-2017 Martin Kaltenbrunner 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 3.0 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library. 17 | */ 18 | 19 | #include "TuioObject.h" 20 | #include 21 | 22 | using namespace TUIO; 23 | 24 | TuioObject::TuioObject (TuioTime ttime, long si, int sym, float xp, float yp, float a):TuioContainer(ttime, si, xp, yp) { 25 | symbol_id = sym; 26 | angle = a; 27 | rotation_speed = 0.0f; 28 | rotation_accel = 0.0f; 29 | 30 | angleFilter = NULL; 31 | angleThreshold = 0.0f; 32 | } 33 | 34 | TuioObject::TuioObject (long si, int sym, float xp, float yp, float a):TuioContainer(si, xp, yp) { 35 | symbol_id = sym; 36 | angle = a; 37 | rotation_speed = 0.0f; 38 | rotation_accel = 0.0f; 39 | 40 | angleFilter = NULL; 41 | angleThreshold = 0.0f; 42 | } 43 | 44 | TuioObject::TuioObject (TuioObject *tobj):TuioContainer(tobj) { 45 | symbol_id = tobj->getSymbolID(); 46 | angle = tobj->getAngle(); 47 | rotation_speed = 0.0f; 48 | rotation_accel = 0.0f; 49 | 50 | angleFilter = NULL; 51 | angleThreshold = 0.0f; 52 | } 53 | 54 | void TuioObject::update (TuioTime ttime, float xp, float yp, float a, float xs, float ys, float rs, float ma, float ra) { 55 | TuioContainer::update(ttime,xp,yp,xs,ys,ma); 56 | angle = a; 57 | rotation_speed = rs; 58 | rotation_accel = ra; 59 | if ((rotation_accel!=0) && (state==TUIO_STOPPED)) state = TUIO_ROTATING; 60 | } 61 | 62 | 63 | void TuioObject::update (float xp, float yp, float a, float xs, float ys, float rs, float ma, float ra) { 64 | TuioContainer::update(xp,yp,xs,ys,ma); 65 | angle = a; 66 | rotation_speed = rs; 67 | rotation_accel = ra; 68 | if ((rotation_accel!=0) && (state==TUIO_STOPPED)) state = TUIO_ROTATING; 69 | } 70 | 71 | void TuioObject::update (TuioTime ttime, float xp, float yp, float a) { 72 | TuioPoint lastPoint = path.back(); 73 | TuioContainer::update(ttime,xp,yp); 74 | 75 | TuioTime diffTime = currentTime - lastPoint.getTuioTime(); 76 | float dt = diffTime.getTotalMilliseconds()/1000.0f; 77 | float last_rotation_speed = rotation_speed; 78 | 79 | float da = a-angle; 80 | if (da > M_PI) da -= 2*M_PI; 81 | else if (da < -M_PI) da+=2*M_PI; 82 | 83 | float prev_angle = angle; 84 | if (angleFilter) angle = angleFilter->filter(angle+da,dt); 85 | else angle = angle+da; 86 | if (fabs(angle-prev_angle) 2*M_PI) angle-=2*M_PI; 89 | else if (angle < 0) angle+=2*M_PI; 90 | 91 | da = angle-prev_angle; 92 | if (da > M_PI) da -= 2*M_PI; 93 | else if (da < -M_PI) da+=2*M_PI; 94 | da = da/(2*M_PI); 95 | 96 | rotation_speed = (float)da/dt; 97 | rotation_accel = (rotation_speed - last_rotation_speed)/dt; 98 | 99 | if ((rotation_accel!=0) && (state==TUIO_STOPPED)) state = TUIO_ROTATING; 100 | } 101 | 102 | void TuioObject::stop (TuioTime ttime) { 103 | update(ttime,xpos,ypos,angle); 104 | } 105 | 106 | void TuioObject::update (TuioObject *tobj) { 107 | TuioContainer::update(tobj); 108 | angle = tobj->getAngle(); 109 | rotation_speed = tobj->getRotationSpeed(); 110 | rotation_accel = tobj->getRotationAccel(); 111 | if ((rotation_accel!=0) && (state==TUIO_STOPPED)) state = TUIO_ROTATING; 112 | } 113 | 114 | int TuioObject::getSymbolID() const{ 115 | return symbol_id; 116 | } 117 | 118 | float TuioObject::getAngle() const{ 119 | return angle; 120 | } 121 | 122 | float TuioObject::getAngleDegrees() const{ 123 | return (float)(angle/M_PI*180); 124 | } 125 | 126 | float TuioObject::getRotationSpeed() const{ 127 | return rotation_speed; 128 | } 129 | 130 | float TuioObject::getRotationAccel() const{ 131 | return rotation_accel; 132 | } 133 | 134 | bool TuioObject::isMoving() const{ 135 | if ((state==TUIO_ACCELERATING) || (state==TUIO_DECELERATING) || (state==TUIO_ROTATING)) return true; 136 | else return false; 137 | } 138 | 139 | void TuioObject::addAngleThreshold(float thresh) { 140 | angleThreshold = thresh; 141 | } 142 | 143 | void TuioObject::removeAngleThreshold() { 144 | angleThreshold = 0.0f; 145 | } 146 | 147 | void TuioObject::addAngleFilter(float mcut, float beta) { 148 | 149 | if (angleFilter) delete angleFilter; 150 | angleFilter = new OneEuroFilter(60.0f, mcut, beta, 10.0f); 151 | } 152 | 153 | void TuioObject::removeAngleFilter() { 154 | 155 | if (angleFilter) delete angleFilter; 156 | angleFilter = NULL; 157 | } 158 | -------------------------------------------------------------------------------- /TUIO/TuioPoint.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | TUIO C++ Library 3 | Copyright (c) 2005-2017 Martin Kaltenbrunner 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 3.0 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library. 17 | */ 18 | 19 | #include "TuioPoint.h" 20 | 21 | using namespace TUIO; 22 | 23 | TuioPoint::TuioPoint (float xp, float yp) { 24 | xpos = xp; 25 | ypos = yp; 26 | currentTime = TuioTime::getSessionTime(); 27 | startTime = currentTime; 28 | 29 | xposFilter = NULL; 30 | yposFilter = NULL; 31 | 32 | posThreshold = 0.0f; 33 | } 34 | 35 | TuioPoint::TuioPoint (TuioTime ttime, float xp, float yp) { 36 | xpos = xp; 37 | ypos = yp; 38 | currentTime = ttime; 39 | startTime = currentTime; 40 | 41 | xposFilter = NULL; 42 | yposFilter = NULL; 43 | 44 | posThreshold = 0.0f; 45 | } 46 | 47 | TuioPoint::TuioPoint (TuioPoint *tpoint) { 48 | xpos = tpoint->getX(); 49 | ypos = tpoint->getY(); 50 | currentTime = TuioTime::getSessionTime(); 51 | startTime = currentTime; 52 | 53 | xposFilter = NULL; 54 | yposFilter = NULL; 55 | 56 | posThreshold = 0.0f; 57 | } 58 | 59 | void TuioPoint::update (TuioPoint *tpoint) { 60 | xpos = tpoint->getX(); 61 | ypos = tpoint->getY(); 62 | } 63 | 64 | void TuioPoint::update (float xp, float yp) { 65 | xpos = xp; 66 | ypos = yp; 67 | } 68 | 69 | void TuioPoint::update (TuioTime ttime, float xp, float yp) { 70 | 71 | if (xposFilter && yposFilter) { 72 | TuioTime diffTime = ttime - currentTime; 73 | float dt = diffTime.getTotalMilliseconds()/1000.0f; 74 | xp = xposFilter->filter(xp,dt); 75 | yp = yposFilter->filter(yp,dt); 76 | } 77 | 78 | float dx = fabs(xpos - xp); 79 | float dy = fabs(ypos - yp); 80 | if ((dx>posThreshold) || (dy>posThreshold)) { 81 | xpos = xp; 82 | ypos = yp; 83 | } 84 | 85 | currentTime = ttime; 86 | } 87 | 88 | 89 | float TuioPoint::getX() const{ 90 | return xpos; 91 | } 92 | 93 | float TuioPoint::getY() const{ 94 | return ypos; 95 | } 96 | 97 | float TuioPoint::getDistance(float xp, float yp) const{ 98 | float dx = xpos-xp; 99 | float dy = ypos-yp; 100 | return sqrtf(dx*dx+dy*dy); 101 | } 102 | 103 | float TuioPoint::getScreenDistance(float xp, float yp, int w, int h) const{ 104 | float dx = w*xpos-w*xp; 105 | float dy = h*ypos-h*yp; 106 | return sqrtf(dx*dx+dy*dy); 107 | } 108 | 109 | float TuioPoint::getDistance(TuioPoint *tpoint) const{ 110 | return getDistance(tpoint->getX(),tpoint->getY()); 111 | } 112 | 113 | 114 | float TuioPoint::getAngle(float xp, float yp) const{ 115 | float side = xpos-xp; 116 | float height = ypos-yp; 117 | float distance = getDistance(xp,yp); 118 | 119 | float angle = (float)(asin(side/distance)+M_PI/2); 120 | if (height<0) angle = 2.0f*(float)M_PI-angle; 121 | 122 | return angle; 123 | } 124 | 125 | float TuioPoint::getAngle(TuioPoint *tpoint) const{ 126 | return getAngle(tpoint->getX(),tpoint->getY()); 127 | } 128 | 129 | float TuioPoint::getAngleDegrees(float xp, float yp) const{ 130 | return ((getAngle(xp,yp)/(float)M_PI)*180.0f); 131 | } 132 | 133 | float TuioPoint::getAngleDegrees(TuioPoint *tpoint) const{ 134 | return ((getAngle(tpoint)/(float)M_PI)*180.0f); 135 | } 136 | 137 | int TuioPoint::getScreenX(int width) const{ 138 | return (int)floor(xpos*width+0.5f); 139 | } 140 | 141 | int TuioPoint::getScreenY(int height) const{ 142 | return (int)floor(ypos*height+0.5f); 143 | } 144 | 145 | TuioTime TuioPoint::getTuioTime() const{ 146 | return currentTime; 147 | } 148 | 149 | TuioTime TuioPoint::getStartTime() const{ 150 | return startTime; 151 | } 152 | 153 | void TuioPoint::addPositionThreshold(float thresh) { 154 | posThreshold = thresh; 155 | } 156 | 157 | void TuioPoint::removePositionThreshold() { 158 | posThreshold = 0.0f; 159 | } 160 | 161 | void TuioPoint::addPositionFilter(float mcut, float beta) { 162 | 163 | if (xposFilter) delete xposFilter; 164 | xposFilter = new OneEuroFilter(60.0f, mcut, beta, 10.0f); 165 | if (yposFilter) delete yposFilter; 166 | yposFilter = new OneEuroFilter(60.0f, mcut, beta, 10.0f); 167 | } 168 | 169 | void TuioPoint::removePositionFilter() { 170 | 171 | if (xposFilter) delete xposFilter; 172 | xposFilter = NULL; 173 | if (yposFilter) delete yposFilter; 174 | yposFilter = NULL; 175 | } 176 | -------------------------------------------------------------------------------- /TUIO/TuioTime.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | TUIO C++ Library 3 | Copyright (c) 2005-2017 Martin Kaltenbrunner 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 3.0 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library. 17 | */ 18 | 19 | #include "TuioTime.h" 20 | using namespace TUIO; 21 | 22 | long TuioTime::start_seconds = 0; 23 | long TuioTime::start_micro_seconds = 0; 24 | 25 | TuioTime::TuioTime (long msec) { 26 | seconds = msec/MSEC_SECOND; 27 | micro_seconds = USEC_MILLISECOND*(msec%MSEC_SECOND); 28 | } 29 | 30 | TuioTime::TuioTime (long sec, long usec) { 31 | seconds = sec; 32 | micro_seconds = usec; 33 | } 34 | 35 | TuioTime TuioTime::operator+(long us) { 36 | long sec = seconds + us/USEC_SECOND; 37 | long usec = micro_seconds + us%USEC_SECOND; 38 | return TuioTime(sec,usec); 39 | } 40 | 41 | TuioTime TuioTime::operator+(TuioTime ttime) { 42 | long sec = seconds + ttime.getSeconds(); 43 | long usec = micro_seconds + ttime.getMicroseconds(); 44 | sec += usec/USEC_SECOND; 45 | usec = usec%USEC_SECOND; 46 | return TuioTime(sec,usec); 47 | } 48 | 49 | TuioTime TuioTime::operator-(long us) { 50 | long sec = seconds - us/USEC_SECOND; 51 | long usec = micro_seconds - us%USEC_SECOND; 52 | 53 | if (usec<0) { 54 | usec += USEC_SECOND; 55 | sec--; 56 | } 57 | 58 | return TuioTime(sec,usec); 59 | } 60 | 61 | TuioTime TuioTime::operator-(TuioTime ttime) { 62 | long sec = seconds - ttime.getSeconds(); 63 | long usec = micro_seconds - ttime.getMicroseconds(); 64 | 65 | if (usec<0) { 66 | usec += USEC_SECOND; 67 | sec--; 68 | } 69 | 70 | return TuioTime(sec,usec); 71 | } 72 | 73 | void TuioTime::operator=(TuioTime ttime) { 74 | seconds = ttime.getSeconds(); 75 | micro_seconds = ttime.getMicroseconds(); 76 | } 77 | 78 | bool TuioTime::operator==(TuioTime ttime) { 79 | if ((seconds==(long)ttime.getSeconds()) && (micro_seconds==(long)ttime.getMicroseconds())) return true; 80 | else return false; 81 | } 82 | 83 | bool TuioTime::operator!=(TuioTime ttime) { 84 | if ((seconds!=(long)ttime.getSeconds()) || (micro_seconds!=(long)ttime.getMicroseconds())) return true; 85 | else return false; 86 | } 87 | 88 | void TuioTime::reset() { 89 | seconds = 0; 90 | micro_seconds = 0; 91 | } 92 | 93 | long TuioTime::getSeconds() const{ 94 | return seconds; 95 | } 96 | 97 | long TuioTime::getMicroseconds() const{ 98 | return micro_seconds; 99 | } 100 | 101 | long TuioTime::getTotalMilliseconds() const{ 102 | return seconds*MSEC_SECOND+micro_seconds/MSEC_SECOND; 103 | } 104 | 105 | void TuioTime::initSession() { 106 | TuioTime startTime = TuioTime::getSystemTime(); 107 | start_seconds = startTime.getSeconds(); 108 | start_micro_seconds = startTime.getMicroseconds(); 109 | } 110 | 111 | TuioTime TuioTime::getSessionTime() { 112 | return (getSystemTime() - getStartTime()); 113 | } 114 | 115 | TuioTime TuioTime::getStartTime() { 116 | return TuioTime(start_seconds,start_micro_seconds); 117 | } 118 | 119 | TuioTime TuioTime::getSystemTime() { 120 | #ifdef WIN32 121 | TuioTime systemTime(GetTickCount()); 122 | #else 123 | struct timeval tv; 124 | struct timezone tz; 125 | gettimeofday(&tv,&tz); 126 | TuioTime systemTime(tv.tv_sec,tv.tv_usec); 127 | #endif 128 | return systemTime; 129 | } 130 | -------------------------------------------------------------------------------- /TUIO/UdpReceiver.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | TUIO C++ Library 3 | Copyright (c) 2005-2017 Martin Kaltenbrunner 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 3.0 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library. 17 | */ 18 | 19 | #include "UdpReceiver.h" 20 | 21 | using namespace TUIO; 22 | using namespace osc; 23 | 24 | #ifndef WIN32 25 | static void* ClientThreadFunc( void* obj ) 26 | #else 27 | static DWORD WINAPI ClientThreadFunc( LPVOID obj ) 28 | #endif 29 | { 30 | static_cast(obj)->socket->Run(); 31 | return 0; 32 | }; 33 | 34 | UdpReceiver::UdpReceiver(int port):locked (false) { 35 | try { 36 | socket = new UdpListeningReceiveSocket(IpEndpointName( IpEndpointName::ANY_ADDRESS, port ), this ); 37 | } catch (std::exception &e) { 38 | std::cerr << "could not bind to UDP port " << port << std::endl; 39 | socket = NULL; 40 | } 41 | 42 | if (socket!=NULL) { 43 | if (!socket->IsBound()) { 44 | delete socket; 45 | socket = NULL; 46 | } else std::cout << "listening to TUIO/UDP messages on port " << port << std::endl; 47 | } 48 | } 49 | 50 | UdpReceiver::~UdpReceiver() { 51 | delete socket; 52 | } 53 | 54 | void UdpReceiver::connect(bool lk) { 55 | 56 | if (connected) return; 57 | if (socket==NULL) return; 58 | locked = lk; 59 | 60 | if (!locked) { 61 | #ifndef WIN32 62 | pthread_create(&thread , NULL, ClientThreadFunc, this); 63 | #else 64 | DWORD threadId; 65 | thread = CreateThread( 0, 0, ClientThreadFunc, this, 0, &threadId ); 66 | #endif 67 | } else socket->Run(); 68 | 69 | connected = true; 70 | } 71 | 72 | void UdpReceiver::disconnect() { 73 | 74 | if (!connected) return; 75 | if (socket==NULL) { 76 | connected = false; 77 | locked = false; 78 | return; 79 | } 80 | socket->Break(); 81 | 82 | if (!locked) { 83 | #ifdef WIN32 84 | if( thread ) CloseHandle( thread ); 85 | #endif 86 | thread = 0; 87 | } else locked = false; 88 | 89 | connected = false; 90 | } 91 | 92 | 93 | -------------------------------------------------------------------------------- /TUIO/UdpReceiver.h: -------------------------------------------------------------------------------- 1 | /* 2 | TUIO C++ Library 3 | Copyright (c) 2005-2017 Martin Kaltenbrunner 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 3.0 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library. 17 | */ 18 | 19 | #ifndef INCLUDED_UDPRECEIVER_H 20 | #define INCLUDED_UDPRECEIVER_H 21 | 22 | #include "OscReceiver.h" 23 | #include "ip/UdpSocket.h" 24 | 25 | namespace TUIO { 26 | 27 | /** 28 | * The UdpReceiver provides the OscReceiver functionality for the UDP transport method 29 | * 30 | * @author Martin Kaltenbrunner 31 | * @version 1.1.6 32 | */ 33 | class LIBDECL UdpReceiver: public OscReceiver { 34 | 35 | public: 36 | 37 | /** 38 | * The UDP socket is only public to be accessible from the thread function 39 | */ 40 | UdpListeningReceiveSocket *socket; 41 | 42 | /** 43 | * This constructor creates a UdpReceiver instance listening to the provided UDP port 44 | * 45 | * @param port the number of the UDP port to listen to, defaults to 3333 46 | */ 47 | UdpReceiver (int port=3333); 48 | 49 | /** 50 | * The destructor is doing nothing in particular. 51 | */ 52 | virtual ~UdpReceiver(); 53 | 54 | /** 55 | * The UdpReceiver connects and starts receiving TUIO messages via UDP 56 | * 57 | * @param lock running in the background if set to false (default) 58 | */ 59 | void connect(bool lock=false); 60 | 61 | /** 62 | * The UdpReceiver disconnects and stops receiving TUIO messages via UDP 63 | */ 64 | void disconnect(); 65 | 66 | private: 67 | 68 | #ifndef WIN32 69 | pthread_t thread; 70 | #else 71 | HANDLE thread; 72 | #endif 73 | 74 | bool locked; 75 | }; 76 | }; 77 | #endif /* INCLUDED_UDPRECEIVER_H */ 78 | -------------------------------------------------------------------------------- /TUIO/UdpSender.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | TUIO C++ Library 3 | Copyright (c) 2005-2017 Martin Kaltenbrunner 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 3.0 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library. 17 | */ 18 | 19 | #include "UdpSender.h" 20 | 21 | using namespace TUIO; 22 | 23 | UdpSender::UdpSender() { 24 | try { 25 | local = true; 26 | long unsigned int ip = GetHostByName("localhost"); 27 | socket = new UdpTransmitSocket(IpEndpointName(ip, 3333)); 28 | buffer_size = MAX_UDP_SIZE; 29 | std::cout << "TUIO/UDP messages to " << "127.0.0.1@3333" << std::endl; 30 | } catch (std::exception &e) { 31 | std::cout << "could not create UDP socket" << std::endl; 32 | socket = NULL; 33 | throw std::exception(); 34 | } 35 | } 36 | 37 | UdpSender::UdpSender(const char *host, int port) { 38 | try { 39 | if ((strcmp(host,"127.0.0.1")==0) || (strcmp(host,"localhost")==0)) { 40 | local = true; 41 | buffer_size = MAX_UDP_SIZE; 42 | } else { 43 | local = false; 44 | buffer_size = IP_MTU_SIZE; 45 | } 46 | long unsigned int ip = GetHostByName(host); 47 | socket = new UdpTransmitSocket(IpEndpointName(ip, port)); 48 | std::cout << "TUIO/UDP messages to " << host << "@" << port << std::endl; 49 | } catch (std::exception &e) { 50 | std::cout << "could not create UDP socket" << std::endl; 51 | socket = NULL; 52 | throw std::exception(); 53 | } 54 | } 55 | 56 | UdpSender::UdpSender(const char *host, int port, int size) { 57 | try { 58 | if ((strcmp(host,"127.0.0.1")==0) || (strcmp(host,"localhost")==0)) { 59 | local = true; 60 | } else local = false; 61 | long unsigned int ip = GetHostByName(host); 62 | socket = new UdpTransmitSocket(IpEndpointName(ip, port)); 63 | if (buffer_size>MAX_UDP_SIZE) buffer_size = MAX_UDP_SIZE; 64 | else if (buffer_sizeSize() > buffer_size ) return false; 85 | if ( bundle->Size() == 0 ) return false; 86 | 87 | socket->Send( bundle->Data(), bundle->Size() ); 88 | return true; 89 | } 90 | -------------------------------------------------------------------------------- /TUIO/UdpSender.h: -------------------------------------------------------------------------------- 1 | /* 2 | TUIO C++ Library 3 | Copyright (c) 2005-2017 Martin Kaltenbrunner 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 3.0 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library. 17 | */ 18 | 19 | #ifndef INCLUDED_UDPSENDER_H 20 | #define INCLUDED_UDPSENDER_H 21 | 22 | #include "OscSender.h" 23 | #include "ip/UdpSocket.h" 24 | 25 | #define IP_MTU_SIZE 1500 26 | #define MAX_UDP_SIZE 4096 27 | #define MIN_UDP_SIZE 576 28 | 29 | namespace TUIO { 30 | 31 | /** 32 | * The UdpSender implements the UDP transport method for OSC 33 | * 34 | * @author Martin Kaltenbrunner 35 | * @version 1.1.6 36 | */ 37 | class LIBDECL UdpSender : public OscSender { 38 | 39 | public: 40 | 41 | /** 42 | * The default constructor creates a UdpSender that sends to the default UDP port 3333 on localhost 43 | * using the maximum packet size of 65536 bytes for single packets on the loopback device 44 | */ 45 | UdpSender(); 46 | 47 | /** 48 | * This constructor creates a UdpSender that sends to the provided port on the the given host 49 | * using the default MTU size of 1500 bytes to deliver unfragmented UDP packets on a LAN 50 | * 51 | * @param host the receiving host name 52 | * @param port the outgoing UDP port number 53 | */ 54 | 55 | UdpSender(const char *host, int port); 56 | /** 57 | * This constructor creates a UdpSender that sends to the provided port on the the given host 58 | * the UDP packet size can be set to a value between 576 and 65536 bytes 59 | * 60 | * @param host the receiving host name 61 | * @param port the outgoing UDP port number 62 | * @param size the maximum UDP packet size 63 | */ 64 | UdpSender(const char *host, int port, int size); 65 | 66 | /** 67 | * The destructor closes the socket. 68 | */ 69 | virtual ~UdpSender(); 70 | 71 | /** 72 | * This method delivers the provided OSC data 73 | * 74 | * @param *bundle the OSC stream to deliver 75 | * @return true if the data was delivered successfully 76 | */ 77 | 78 | bool sendOscPacket (osc::OutboundPacketStream *bundle); 79 | 80 | /** 81 | * This method returns the connection state 82 | * 83 | * @return true if the connection is alive 84 | */ 85 | bool isConnected (); 86 | 87 | const char* tuio_type() { return "TUIO/UDP"; } 88 | 89 | private: 90 | UdpTransmitSocket *socket; 91 | }; 92 | } 93 | #endif /* INCLUDED_UDPSENDER_H */ 94 | -------------------------------------------------------------------------------- /TUIO/WebSockSender.h: -------------------------------------------------------------------------------- 1 | /* 2 | TUIO C++ Library 3 | Copyright (c) 2009-2017 Martin Kaltenbrunner 4 | WebSockSender (c) 2015 Florian Echtler 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 3.0 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this library. 18 | */ 19 | 20 | #ifndef INCLUDED_WEBSOCKSENDER_H 21 | #define INCLUDED_WEBSOCKSENDER_H 22 | 23 | #if defined(_MSC_VER) && _MSC_VER < 1900 24 | #include 25 | #include 26 | #define snprintf c99_snprintf 27 | #define vsnprintf c99_vsnprintf 28 | 29 | __inline int c99_vsnprintf(char *outBuf, size_t size, const char *format, va_list ap) 30 | { 31 | int count = -1; 32 | 33 | if (size != 0) 34 | count = _vsnprintf_s(outBuf, size, _TRUNCATE, format, ap); 35 | if (count == -1) 36 | count = _vscprintf(format, ap); 37 | 38 | return count; 39 | } 40 | 41 | __inline int c99_snprintf(char *outBuf, size_t size, const char *format, ...) 42 | { 43 | int count; 44 | va_list ap; 45 | 46 | va_start(ap, format); 47 | count = c99_vsnprintf(outBuf, size, format, ap); 48 | va_end(ap); 49 | 50 | return count; 51 | } 52 | 53 | #endif 54 | 55 | 56 | /* All of these macros assume use on a 32-bit variable. 57 | Additionally, SWAP assumes we're little-endian. */ 58 | #define SWAP(a) ((((a) >> 24) & 0x000000ff) | (((a) >> 8) & 0x0000ff00) | \ 59 | (((a) << 8) & 0x00ff0000) | (((a) << 24) & 0xff000000)) 60 | #define ROL(a, b) (((a) << (b)) | ((a) >> (32 - (b)))) 61 | #define ROR(a, b) ROL((a), (32 - (b))) 62 | #define SHA1_HASH_SIZE (160/8) 63 | 64 | #include "TcpSender.h" 65 | #include 66 | #include 67 | #include 68 | #include 69 | 70 | namespace TUIO { 71 | 72 | /** 73 | * The WebSockSender implements the WebSocket transport method for OSC 74 | * 75 | * @author Florian Echtler 76 | * @version 1.1.6 77 | */ 78 | class LIBDECL WebSockSender : public TcpSender { 79 | 80 | public: 81 | 82 | /** 83 | * The default constructor creates a WebSockSender that listens to the default HTTP-alt port 8080 on localhost 84 | */ 85 | WebSockSender(); 86 | 87 | /** 88 | * This constructor creates a WebSockSender that listens to the provided port 89 | * 90 | * @param port the listening WebSocket port number 91 | */ 92 | WebSockSender(int port); 93 | 94 | /** 95 | * The destructor closes the socket. 96 | */ 97 | virtual ~WebSockSender() {} 98 | 99 | /** 100 | * This method delivers the provided OSC data 101 | * 102 | * @param *bundle the OSC stream to deliver 103 | * @return true if the data was delivered successfully 104 | */ 105 | bool sendOscPacket (osc::OutboundPacketStream *bundle); 106 | 107 | /** 108 | * This method is called whenever a new client connects 109 | * 110 | * @param tcp_client the socket handle of the new client 111 | */ 112 | void newClient( int tcp_client ); 113 | 114 | const char* tuio_type() { return "TUIO/WEB"; } 115 | private: 116 | 117 | void sha1( uint8_t digest[SHA1_HASH_SIZE], const uint8_t* inbuf, size_t length ); 118 | std::string base64( uint8_t* buffer, size_t size ); 119 | }; 120 | } 121 | #endif /* INCLUDED_WEBSOCKSENDER_H */ 122 | -------------------------------------------------------------------------------- /TuioDemo.h: -------------------------------------------------------------------------------- 1 | /* 2 | TUIO C++ GUI Demo 3 | Copyright (c) 2005-2016 Martin Kaltenbrunner 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | #ifndef INCLUDED_TUIODEMO_H 21 | #define INCLUDED_TUIODEMO_H 22 | 23 | #include "TuioListener.h" 24 | #include "TuioClient.h" 25 | #include "UdpReceiver.h" 26 | #include "TcpReceiver.h" 27 | #include 28 | #include 29 | 30 | #ifdef __APPLE__ 31 | #include 32 | #include 33 | #include 34 | #include 35 | #else 36 | #include "SDL.h" 37 | #include 38 | #include 39 | #include 40 | #endif 41 | 42 | using namespace TUIO; 43 | 44 | class TuioDemo : public TuioListener { 45 | 46 | public: 47 | TuioDemo(const char *host, int port, bool udp, bool verbose, bool fullscreen); 48 | ~TuioDemo() { 49 | tuioClient->disconnect(); 50 | delete tuioClient; 51 | delete osc_receiver; 52 | } 53 | 54 | void addTuioObject(TuioObject *tobj); 55 | void updateTuioObject(TuioObject *tobj); 56 | void removeTuioObject(TuioObject *tobj); 57 | 58 | void addTuioCursor(TuioCursor *tcur); 59 | void updateTuioCursor(TuioCursor *tcur); 60 | void removeTuioCursor(TuioCursor *tcur); 61 | 62 | void addTuioBlob(TuioBlob *tblb); 63 | void updateTuioBlob(TuioBlob *tblb); 64 | void removeTuioBlob(TuioBlob *tblb); 65 | 66 | void refresh(TuioTime frameTime); 67 | 68 | void run(); 69 | 70 | private: 71 | void drawObjects(); 72 | void drawString(char *str); 73 | void processEvents(); 74 | void initWindow(); 75 | SDL_Window *window; 76 | SDL_Renderer *renderer; 77 | bool verbose, fullscreen, running; 78 | 79 | int width, height; 80 | int screen_width, screen_height; 81 | int window_width, window_height; 82 | 83 | TuioClient *tuioClient; 84 | OscReceiver *osc_receiver; 85 | }; 86 | 87 | #endif /* INCLUDED_TUIODEMO_H */ 88 | -------------------------------------------------------------------------------- /TuioDump.h: -------------------------------------------------------------------------------- 1 | /* 2 | TUIO C++ Example - part of the reacTIVision project 3 | http://reactivision.sourceforge.net/ 4 | Copyright (c) 2005-2016 Martin Kaltenbrunner 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining 7 | a copy of this software and associated documentation files 8 | (the "Software"), to deal in the Software without restriction, 9 | including without limitation the rights to use, copy, modify, merge, 10 | publish, distribute, sublicense, and/or sell copies of the Software, 11 | and to permit persons to whom the Software is furnished to do so, 12 | subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | Any person wishing to distribute modifications to the Software is 18 | requested to send the modifications to the original developer so that 19 | they can be incorporated into the canonical version. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 24 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 25 | ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 26 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | #ifndef INCLUDED_TUIODUMP_H 31 | #define INCLUDED_TUIODUMP_H 32 | 33 | #include "TuioListener.h" 34 | #include "TuioClient.h" 35 | #include "UdpReceiver.h" 36 | #include "TcpReceiver.h" 37 | #include 38 | 39 | using namespace TUIO; 40 | 41 | class TuioDump : public TuioListener { 42 | 43 | public: 44 | void addTuioObject(TuioObject *tobj); 45 | void updateTuioObject(TuioObject *tobj); 46 | void removeTuioObject(TuioObject *tobj); 47 | 48 | void addTuioCursor(TuioCursor *tcur); 49 | void updateTuioCursor(TuioCursor *tcur); 50 | void removeTuioCursor(TuioCursor *tcur); 51 | 52 | void addTuioBlob(TuioBlob *tblb); 53 | void updateTuioBlob(TuioBlob *tblb); 54 | void removeTuioBlob(TuioBlob *tblb); 55 | 56 | void refresh(TuioTime frameTime); 57 | }; 58 | 59 | #endif /* INCLUDED_TUIODUMP_H */ 60 | -------------------------------------------------------------------------------- /macosx/English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | CFBundleName = "SimpleSimulator"; 4 | CFBundleShortVersionString = "SimpleSimulator version 1.1.6"; 5 | CFBundleGetInfoString = "SimpleSimulator version 1.1.6, Copyright 2005-2016 Martin Kaltenbrunner"; 6 | NSHumanReadableCopyright = "Copyright 2005-2016\nMartin Kaltenbrunner\nmartin@tuio.org"; 7 | -------------------------------------------------------------------------------- /macosx/SimpleSimulator.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | SimpleSimulator 9 | CFBundleIconFile 10 | TUIO 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | SimpleSimulator 15 | CFBundlePackageType 16 | APPL 17 | CFBundleSignature 18 | TUIO 19 | CFBundleVersion 20 | 1606 21 | NSMainNibFile 22 | SDLMain 23 | NSPrincipalClass 24 | NSApplication 25 | Minimum system version 26 | 10.6 27 | 28 | 29 | -------------------------------------------------------------------------------- /macosx/TUIO.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkalten/TUIO11_CPP/7d5dd6d4e2b8e7369c932e032f500e1b3254fd1d/macosx/TUIO.icns -------------------------------------------------------------------------------- /macosx/TuioDemo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Minimum system version 6 | 10.6 7 | CFBundleDevelopmentRegion 8 | English 9 | CFBundleExecutable 10 | TuioDemo 11 | CFBundleIconFile 12 | TUIO 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | TuioDemo 17 | CFBundlePackageType 18 | APPL 19 | CFBundleSignature 20 | TUIO 21 | CFBundleVersion 22 | 1.1.6 23 | NSMainNibFile 24 | SDLMain 25 | NSPrincipalClass 26 | NSApplication 27 | 28 | 29 | -------------------------------------------------------------------------------- /oscpack/CHANGES: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkalten/TUIO11_CPP/7d5dd6d4e2b8e7369c932e032f500e1b3254fd1d/oscpack/CHANGES -------------------------------------------------------------------------------- /oscpack/LICENSE: -------------------------------------------------------------------------------- 1 | oscpack -- Open Sound Control (OSC) packet manipulation library 2 | http://www.rossbencina.com/code/oscpack 3 | 4 | Copyright (c) 2004-2013 Ross Bencina 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining 7 | a copy of this software and associated documentation files 8 | (the "Software"), to deal in the Software without restriction, 9 | including without limitation the rights to use, copy, modify, merge, 10 | publish, distribute, sublicense, and/or sell copies of the Software, 11 | and to permit persons to whom the Software is furnished to do so, 12 | subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 21 | ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 22 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | 25 | ### 26 | 27 | The text above constitutes the entire oscpack license; however, 28 | the oscpack developer(s) also make the following non-binding requests: 29 | 30 | Any person wishing to distribute modifications to the Software is 31 | requested to send the modifications to the original developer so that 32 | they can be incorporated into the canonical version. It is also 33 | requested that these non-binding requests be included whenever the 34 | above license is reproduced. -------------------------------------------------------------------------------- /oscpack/TODO: -------------------------------------------------------------------------------- 1 | TODO: 2 | 3 | - consider adding the local endpoint name to PacketListener::PacketReceived() params 4 | 5 | - consider adding ListenerThread class to support old seperate thread listener functionality, something like: 6 | 7 | class UdpSocketListenerThread{ 8 | public: 9 | UdpSocketListenerThread( UdpSocket& socket, Listener *listener ); 10 | UdpSocketListenerThread( UdpSocketReceiveMultiplexer *mux ); 11 | ~UdpSocketListenerThread(); 12 | 13 | void Run(); 14 | void Stop(); 15 | }; 16 | 17 | - work out a way to make the parsing classes totally safe. at a minimum this 18 | means adding functions to test for invalid float/doublevalues, 19 | making sure the iterators never pass the end of the message, ... 20 | (passing end of message can happen if: 21 | - too many args in type tags 22 | a. typetags overflow message size 23 | b. args fulfilling typetags overflow message size 24 | - strings too long or not terminated correctly 25 | - blobs too long or not terminated correctly 26 | 27 | if the message was fully checked during construction, the end() iterator 28 | could be moved back until only arguments which fit withing size() may 29 | be interated (this could be none). A flag could be set to indicate that 30 | something was wrong. 31 | 32 | - other packet badness could include: 33 | - time tags too far into the future (the scheduler should deal with 34 | that i guess). 35 | - message address patterns which aren't correctly terminated 36 | 37 | - improve the ability to parse messages without tags (SC uses methods which 38 | get the data and advance the iterator in one step.) 39 | - Check* could be modified to do this - ie if typetags are not present 40 | it could check that reading the field won't escape the message size 41 | and return the data, or return false if some consistency 42 | constraint is violated. 43 | (or alternately drop support for messages without type tags) 44 | 45 | 46 | - add a method to discard an inprogress message if it gets half 47 | constructed and the buffer is full in OutboundPacket 48 | 49 | - write a stress testing app which can send garbage packets to try to flush out other bugs in the parsing code. 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /oscpack/ip/IpEndpointName.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | oscpack -- Open Sound Control (OSC) packet manipulation library 3 | http://www.rossbencina.com/code/oscpack 4 | 5 | Copyright (c) 2004-2013 Ross Bencina 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining 8 | a copy of this software and associated documentation files 9 | (the "Software"), to deal in the Software without restriction, 10 | including without limitation the rights to use, copy, modify, merge, 11 | publish, distribute, sublicense, and/or sell copies of the Software, 12 | and to permit persons to whom the Software is furnished to do so, 13 | subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 22 | ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 23 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 24 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | /* 28 | The text above constitutes the entire oscpack license; however, 29 | the oscpack developer(s) also make the following non-binding requests: 30 | 31 | Any person wishing to distribute modifications to the Software is 32 | requested to send the modifications to the original developer so that 33 | they can be incorporated into the canonical version. It is also 34 | requested that these non-binding requests be included whenever the 35 | above license is reproduced. 36 | */ 37 | #include "IpEndpointName.h" 38 | 39 | #include 40 | 41 | #include "NetworkingUtils.h" 42 | 43 | 44 | unsigned long IpEndpointName::GetHostByName( const char *s ) 45 | { 46 | return ::GetHostByName(s); 47 | } 48 | 49 | 50 | void IpEndpointName::AddressAsString( char *s ) const 51 | { 52 | if( address == ANY_ADDRESS ){ 53 | std::sprintf( s, "" ); 54 | }else{ 55 | std::sprintf( s, "%d.%d.%d.%d", 56 | (int)((address >> 24) & 0xFF), 57 | (int)((address >> 16) & 0xFF), 58 | (int)((address >> 8) & 0xFF), 59 | (int)(address & 0xFF) ); 60 | } 61 | } 62 | 63 | 64 | void IpEndpointName::AddressAndPortAsString( char *s ) const 65 | { 66 | if( port == ANY_PORT ){ 67 | if( address == ANY_ADDRESS ){ 68 | std::sprintf( s, ":" ); 69 | }else{ 70 | std::sprintf( s, "%d.%d.%d.%d:", 71 | (int)((address >> 24) & 0xFF), 72 | (int)((address >> 16) & 0xFF), 73 | (int)((address >> 8) & 0xFF), 74 | (int)(address & 0xFF) ); 75 | } 76 | }else{ 77 | if( address == ANY_ADDRESS ){ 78 | std::sprintf( s, ":%d", port ); 79 | }else{ 80 | std::sprintf( s, "%d.%d.%d.%d:%d", 81 | (int)((address >> 24) & 0xFF), 82 | (int)((address >> 16) & 0xFF), 83 | (int)((address >> 8) & 0xFF), 84 | (int)(address & 0xFF), 85 | (int)port ); 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /oscpack/ip/IpEndpointName.h: -------------------------------------------------------------------------------- 1 | /* 2 | oscpack -- Open Sound Control (OSC) packet manipulation library 3 | http://www.rossbencina.com/code/oscpack 4 | 5 | Copyright (c) 2004-2013 Ross Bencina 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining 8 | a copy of this software and associated documentation files 9 | (the "Software"), to deal in the Software without restriction, 10 | including without limitation the rights to use, copy, modify, merge, 11 | publish, distribute, sublicense, and/or sell copies of the Software, 12 | and to permit persons to whom the Software is furnished to do so, 13 | subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 22 | ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 23 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 24 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | /* 28 | The text above constitutes the entire oscpack license; however, 29 | the oscpack developer(s) also make the following non-binding requests: 30 | 31 | Any person wishing to distribute modifications to the Software is 32 | requested to send the modifications to the original developer so that 33 | they can be incorporated into the canonical version. It is also 34 | requested that these non-binding requests be included whenever the 35 | above license is reproduced. 36 | */ 37 | #ifndef INCLUDED_OSCPACK_IPENDPOINTNAME_H 38 | #define INCLUDED_OSCPACK_IPENDPOINTNAME_H 39 | 40 | 41 | class IpEndpointName{ 42 | static unsigned long GetHostByName( const char *s ); 43 | public: 44 | static const unsigned long ANY_ADDRESS = 0xFFFFFFFF; 45 | static const int ANY_PORT = -1; 46 | 47 | IpEndpointName() 48 | : address( ANY_ADDRESS ), port( ANY_PORT ) {} 49 | IpEndpointName( int port_ ) 50 | : address( ANY_ADDRESS ), port( port_ ) {} 51 | IpEndpointName( unsigned long ipAddress_, int port_ ) 52 | : address( ipAddress_ ), port( port_ ) {} 53 | IpEndpointName( const char *addressName, int port_=ANY_PORT ) 54 | : address( GetHostByName( addressName ) ) 55 | , port( port_ ) {} 56 | IpEndpointName( int addressA, int addressB, int addressC, int addressD, int port_=ANY_PORT ) 57 | : address( ( (addressA << 24) | (addressB << 16) | (addressC << 8) | addressD ) ) 58 | , port( port_ ) {} 59 | 60 | // address and port are maintained in host byte order here 61 | unsigned long address; 62 | int port; 63 | 64 | bool IsMulticastAddress() const { return ((address >> 24) & 0xFF) >= 224 && ((address >> 24) & 0xFF) <= 239; } 65 | 66 | enum { ADDRESS_STRING_LENGTH=17 }; 67 | void AddressAsString( char *s ) const; 68 | 69 | enum { ADDRESS_AND_PORT_STRING_LENGTH=23}; 70 | void AddressAndPortAsString( char *s ) const; 71 | }; 72 | 73 | inline bool operator==( const IpEndpointName& lhs, const IpEndpointName& rhs ) 74 | { 75 | return (lhs.address == rhs.address && lhs.port == rhs.port ); 76 | } 77 | 78 | inline bool operator!=( const IpEndpointName& lhs, const IpEndpointName& rhs ) 79 | { 80 | return !(lhs == rhs); 81 | } 82 | 83 | #endif /* INCLUDED_OSCPACK_IPENDPOINTNAME_H */ 84 | -------------------------------------------------------------------------------- /oscpack/ip/NetworkingUtils.h: -------------------------------------------------------------------------------- 1 | /* 2 | oscpack -- Open Sound Control (OSC) packet manipulation library 3 | http://www.rossbencina.com/code/oscpack 4 | 5 | Copyright (c) 2004-2013 Ross Bencina 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining 8 | a copy of this software and associated documentation files 9 | (the "Software"), to deal in the Software without restriction, 10 | including without limitation the rights to use, copy, modify, merge, 11 | publish, distribute, sublicense, and/or sell copies of the Software, 12 | and to permit persons to whom the Software is furnished to do so, 13 | subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 22 | ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 23 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 24 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | /* 28 | The text above constitutes the entire oscpack license; however, 29 | the oscpack developer(s) also make the following non-binding requests: 30 | 31 | Any person wishing to distribute modifications to the Software is 32 | requested to send the modifications to the original developer so that 33 | they can be incorporated into the canonical version. It is also 34 | requested that these non-binding requests be included whenever the 35 | above license is reproduced. 36 | */ 37 | #ifndef INCLUDED_OSCPACK_NETWORKINGUTILS_H 38 | #define INCLUDED_OSCPACK_NETWORKINGUTILS_H 39 | 40 | 41 | // in general NetworkInitializer is only used internally, but if you're 42 | // application creates multiple sockets from different threads at runtime you 43 | // should instantiate one of these in main just to make sure the networking 44 | // layer is initialized. 45 | class NetworkInitializer{ 46 | public: 47 | NetworkInitializer(); 48 | ~NetworkInitializer(); 49 | }; 50 | 51 | 52 | // return ip address of host name in host byte order 53 | unsigned long GetHostByName( const char *name ); 54 | 55 | 56 | #endif /* INCLUDED_OSCPACK_NETWORKINGUTILS_H */ 57 | -------------------------------------------------------------------------------- /oscpack/ip/PacketListener.h: -------------------------------------------------------------------------------- 1 | /* 2 | oscpack -- Open Sound Control (OSC) packet manipulation library 3 | http://www.rossbencina.com/code/oscpack 4 | 5 | Copyright (c) 2004-2013 Ross Bencina 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining 8 | a copy of this software and associated documentation files 9 | (the "Software"), to deal in the Software without restriction, 10 | including without limitation the rights to use, copy, modify, merge, 11 | publish, distribute, sublicense, and/or sell copies of the Software, 12 | and to permit persons to whom the Software is furnished to do so, 13 | subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 22 | ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 23 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 24 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | /* 28 | The text above constitutes the entire oscpack license; however, 29 | the oscpack developer(s) also make the following non-binding requests: 30 | 31 | Any person wishing to distribute modifications to the Software is 32 | requested to send the modifications to the original developer so that 33 | they can be incorporated into the canonical version. It is also 34 | requested that these non-binding requests be included whenever the 35 | above license is reproduced. 36 | */ 37 | #ifndef INCLUDED_OSCPACK_PACKETLISTENER_H 38 | #define INCLUDED_OSCPACK_PACKETLISTENER_H 39 | 40 | 41 | class IpEndpointName; 42 | 43 | class PacketListener{ 44 | public: 45 | virtual ~PacketListener() {} 46 | virtual void ProcessPacket( const char *data, int size, 47 | const IpEndpointName& remoteEndpoint ) = 0; 48 | }; 49 | 50 | #endif /* INCLUDED_OSCPACK_PACKETLISTENER_H */ 51 | -------------------------------------------------------------------------------- /oscpack/ip/TimerListener.h: -------------------------------------------------------------------------------- 1 | /* 2 | oscpack -- Open Sound Control (OSC) packet manipulation library 3 | http://www.rossbencina.com/code/oscpack 4 | 5 | Copyright (c) 2004-2013 Ross Bencina 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining 8 | a copy of this software and associated documentation files 9 | (the "Software"), to deal in the Software without restriction, 10 | including without limitation the rights to use, copy, modify, merge, 11 | publish, distribute, sublicense, and/or sell copies of the Software, 12 | and to permit persons to whom the Software is furnished to do so, 13 | subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 22 | ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 23 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 24 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | /* 28 | The text above constitutes the entire oscpack license; however, 29 | the oscpack developer(s) also make the following non-binding requests: 30 | 31 | Any person wishing to distribute modifications to the Software is 32 | requested to send the modifications to the original developer so that 33 | they can be incorporated into the canonical version. It is also 34 | requested that these non-binding requests be included whenever the 35 | above license is reproduced. 36 | */ 37 | #ifndef INCLUDED_OSCPACK_TIMERLISTENER_H 38 | #define INCLUDED_OSCPACK_TIMERLISTENER_H 39 | 40 | 41 | class TimerListener{ 42 | public: 43 | virtual ~TimerListener() {} 44 | virtual void TimerExpired() = 0; 45 | }; 46 | 47 | #endif /* INCLUDED_OSCPACK_TIMERLISTENER_H */ 48 | -------------------------------------------------------------------------------- /oscpack/ip/posix/NetworkingUtils.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | oscpack -- Open Sound Control (OSC) packet manipulation library 3 | http://www.rossbencina.com/code/oscpack 4 | 5 | Copyright (c) 2004-2013 Ross Bencina 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining 8 | a copy of this software and associated documentation files 9 | (the "Software"), to deal in the Software without restriction, 10 | including without limitation the rights to use, copy, modify, merge, 11 | publish, distribute, sublicense, and/or sell copies of the Software, 12 | and to permit persons to whom the Software is furnished to do so, 13 | subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 22 | ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 23 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 24 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | /* 28 | The text above constitutes the entire oscpack license; however, 29 | the oscpack developer(s) also make the following non-binding requests: 30 | 31 | Any person wishing to distribute modifications to the Software is 32 | requested to send the modifications to the original developer so that 33 | they can be incorporated into the canonical version. It is also 34 | requested that these non-binding requests be included whenever the 35 | above license is reproduced. 36 | */ 37 | #include "ip/NetworkingUtils.h" 38 | 39 | #include 40 | #include 41 | #include 42 | 43 | #include 44 | 45 | 46 | 47 | NetworkInitializer::NetworkInitializer() {} 48 | 49 | NetworkInitializer::~NetworkInitializer() {} 50 | 51 | 52 | unsigned long GetHostByName( const char *name ) 53 | { 54 | unsigned long result = 0; 55 | 56 | struct hostent *h = gethostbyname( name ); 57 | if( h ){ 58 | struct in_addr a; 59 | std::memcpy( &a, h->h_addr_list[0], h->h_length ); 60 | result = ntohl(a.s_addr); 61 | } 62 | 63 | return result; 64 | } 65 | -------------------------------------------------------------------------------- /oscpack/ip/win32/NetworkingUtils.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | oscpack -- Open Sound Control (OSC) packet manipulation library 3 | http://www.rossbencina.com/code/oscpack 4 | 5 | Copyright (c) 2004-2013 Ross Bencina 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining 8 | a copy of this software and associated documentation files 9 | (the "Software"), to deal in the Software without restriction, 10 | including without limitation the rights to use, copy, modify, merge, 11 | publish, distribute, sublicense, and/or sell copies of the Software, 12 | and to permit persons to whom the Software is furnished to do so, 13 | subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 22 | ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 23 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 24 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | /* 28 | The text above constitutes the entire oscpack license; however, 29 | the oscpack developer(s) also make the following non-binding requests: 30 | 31 | Any person wishing to distribute modifications to the Software is 32 | requested to send the modifications to the original developer so that 33 | they can be incorporated into the canonical version. It is also 34 | requested that these non-binding requests be included whenever the 35 | above license is reproduced. 36 | */ 37 | #include "ip/NetworkingUtils.h" 38 | 39 | #include // this must come first to prevent errors with MSVC7 40 | #include 41 | 42 | #include 43 | 44 | 45 | static LONG initCount_ = 0; 46 | static bool winsockInitialized_ = false; 47 | 48 | NetworkInitializer::NetworkInitializer() 49 | { 50 | if( InterlockedIncrement( &initCount_ ) == 1 ){ 51 | // there is a race condition here if one thread tries to access 52 | // the library while another is still initializing it. 53 | // i can't think of an easy way to fix it so i'm telling you here 54 | // incase you need to init the library from two threads at once. 55 | // this is why the header file advises to instantiate one of these 56 | // in main() so that the initialization happens globally 57 | 58 | // initialize winsock 59 | WSAData wsaData; 60 | int nCode = WSAStartup(MAKEWORD(1, 1), &wsaData); 61 | if( nCode != 0 ){ 62 | //std::cout << "WSAStartup() failed with error code " << nCode << "\n"; 63 | }else{ 64 | winsockInitialized_ = true; 65 | } 66 | } 67 | } 68 | 69 | 70 | NetworkInitializer::~NetworkInitializer() 71 | { 72 | if( InterlockedDecrement( &initCount_ ) == 0 ){ 73 | if( winsockInitialized_ ){ 74 | WSACleanup(); 75 | winsockInitialized_ = false; 76 | } 77 | } 78 | } 79 | 80 | 81 | unsigned long GetHostByName( const char *name ) 82 | { 83 | NetworkInitializer networkInitializer; 84 | 85 | unsigned long result = 0; 86 | 87 | struct hostent *h = gethostbyname( name ); 88 | if( h ){ 89 | struct in_addr a; 90 | std::memcpy( &a, h->h_addr_list[0], h->h_length ); 91 | result = ntohl(a.s_addr); 92 | } 93 | 94 | return result; 95 | } 96 | -------------------------------------------------------------------------------- /oscpack/osc/MessageMappingOscPacketListener.h: -------------------------------------------------------------------------------- 1 | /* 2 | oscpack -- Open Sound Control (OSC) packet manipulation library 3 | http://www.rossbencina.com/code/oscpack 4 | 5 | Copyright (c) 2004-2013 Ross Bencina 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining 8 | a copy of this software and associated documentation files 9 | (the "Software"), to deal in the Software without restriction, 10 | including without limitation the rights to use, copy, modify, merge, 11 | publish, distribute, sublicense, and/or sell copies of the Software, 12 | and to permit persons to whom the Software is furnished to do so, 13 | subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 22 | ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 23 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 24 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | /* 28 | The text above constitutes the entire oscpack license; however, 29 | the oscpack developer(s) also make the following non-binding requests: 30 | 31 | Any person wishing to distribute modifications to the Software is 32 | requested to send the modifications to the original developer so that 33 | they can be incorporated into the canonical version. It is also 34 | requested that these non-binding requests be included whenever the 35 | above license is reproduced. 36 | */ 37 | #ifndef INCLUDED_OSCPACK_MESSAGEMAPPINGOSCPACKETLISTENER_H 38 | #define INCLUDED_OSCPACK_MESSAGEMAPPINGOSCPACKETLISTENER_H 39 | 40 | #include 41 | #include 42 | 43 | #include "OscPacketListener.h" 44 | 45 | 46 | 47 | namespace osc{ 48 | 49 | template< class T > 50 | class MessageMappingOscPacketListener : public OscPacketListener{ 51 | public: 52 | typedef void (T::*function_type)(const osc::ReceivedMessage&, const IpEndpointName&); 53 | 54 | protected: 55 | void RegisterMessageFunction( const char *addressPattern, function_type f ) 56 | { 57 | functions_.insert( std::make_pair( addressPattern, f ) ); 58 | } 59 | 60 | virtual void ProcessMessage( const osc::ReceivedMessage& m, 61 | const IpEndpointName& remoteEndpoint ) 62 | { 63 | typename function_map_type::iterator i = functions_.find( m.AddressPattern() ); 64 | if( i != functions_.end() ) 65 | (dynamic_cast(this)->*(i->second))( m, remoteEndpoint ); 66 | } 67 | 68 | private: 69 | struct cstr_compare{ 70 | bool operator()( const char *lhs, const char *rhs ) const 71 | { return std::strcmp( lhs, rhs ) < 0; } 72 | }; 73 | 74 | typedef std::map function_map_type; 75 | function_map_type functions_; 76 | }; 77 | 78 | } // namespace osc 79 | 80 | #endif /* INCLUDED_OSCPACK_MESSAGEMAPPINGOSCPACKETLISTENER_H */ -------------------------------------------------------------------------------- /oscpack/osc/OscException.h: -------------------------------------------------------------------------------- 1 | /* 2 | oscpack -- Open Sound Control (OSC) packet manipulation library 3 | http://www.rossbencina.com/code/oscpack 4 | 5 | Copyright (c) 2004-2013 Ross Bencina 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining 8 | a copy of this software and associated documentation files 9 | (the "Software"), to deal in the Software without restriction, 10 | including without limitation the rights to use, copy, modify, merge, 11 | publish, distribute, sublicense, and/or sell copies of the Software, 12 | and to permit persons to whom the Software is furnished to do so, 13 | subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 22 | ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 23 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 24 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | /* 28 | The text above constitutes the entire oscpack license; however, 29 | the oscpack developer(s) also make the following non-binding requests: 30 | 31 | Any person wishing to distribute modifications to the Software is 32 | requested to send the modifications to the original developer so that 33 | they can be incorporated into the canonical version. It is also 34 | requested that these non-binding requests be included whenever the 35 | above license is reproduced. 36 | */ 37 | #ifndef INCLUDED_OSCPACK_OSCEXCEPTION_H 38 | #define INCLUDED_OSCPACK_OSCEXCEPTION_H 39 | 40 | #include 41 | 42 | namespace osc{ 43 | 44 | class Exception : public std::exception { 45 | const char *what_; 46 | 47 | public: 48 | Exception() throw() {} 49 | Exception( const Exception& src ) throw() 50 | : std::exception( src ) 51 | , what_( src.what_ ) {} 52 | Exception( const char *w ) throw() 53 | : what_( w ) {} 54 | Exception& operator=( const Exception& src ) throw() 55 | { what_ = src.what_; return *this; } 56 | virtual ~Exception() throw() {} 57 | virtual const char* what() const throw() { return what_; } 58 | }; 59 | 60 | } // namespace osc 61 | 62 | #endif /* INCLUDED_OSCPACK_OSCEXCEPTION_H */ 63 | -------------------------------------------------------------------------------- /oscpack/osc/OscHostEndianness.h: -------------------------------------------------------------------------------- 1 | /* 2 | oscpack -- Open Sound Control (OSC) packet manipulation library 3 | http://www.rossbencina.com/code/oscpack 4 | 5 | Copyright (c) 2004-2013 Ross Bencina 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining 8 | a copy of this software and associated documentation files 9 | (the "Software"), to deal in the Software without restriction, 10 | including without limitation the rights to use, copy, modify, merge, 11 | publish, distribute, sublicense, and/or sell copies of the Software, 12 | and to permit persons to whom the Software is furnished to do so, 13 | subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 22 | ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 23 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 24 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | /* 28 | The text above constitutes the entire oscpack license; however, 29 | the oscpack developer(s) also make the following non-binding requests: 30 | 31 | Any person wishing to distribute modifications to the Software is 32 | requested to send the modifications to the original developer so that 33 | they can be incorporated into the canonical version. It is also 34 | requested that these non-binding requests be included whenever the 35 | above license is reproduced. 36 | */ 37 | #ifndef INCLUDED_OSCPACK_OSCHOSTENDIANNESS_H 38 | #define INCLUDED_OSCPACK_OSCHOSTENDIANNESS_H 39 | 40 | /* 41 | Make sure either OSC_HOST_LITTLE_ENDIAN or OSC_HOST_BIG_ENDIAN is defined 42 | 43 | We try to use preprocessor symbols to deduce the host endianness. 44 | 45 | Alternatively you can define one of the above symbols from the command line. 46 | Usually you do this with the -D flag to the compiler. e.g.: 47 | 48 | $ g++ -DOSC_HOST_LITTLE_ENDIAN ... 49 | */ 50 | 51 | #if defined(OSC_HOST_LITTLE_ENDIAN) || defined(OSC_HOST_BIG_ENDIAN) 52 | 53 | // endianness defined on the command line. nothing to do here. 54 | 55 | #elif defined(__WIN32__) || defined(WIN32) || defined(WINCE) 56 | 57 | // assume that __WIN32__ is only defined on little endian systems 58 | 59 | #define OSC_HOST_LITTLE_ENDIAN 1 60 | #undef OSC_HOST_BIG_ENDIAN 61 | 62 | #elif defined(__APPLE__) 63 | 64 | #if defined(__LITTLE_ENDIAN__) 65 | 66 | #define OSC_HOST_LITTLE_ENDIAN 1 67 | #undef OSC_HOST_BIG_ENDIAN 68 | 69 | #elif defined(__BIG_ENDIAN__) 70 | 71 | #define OSC_HOST_BIG_ENDIAN 1 72 | #undef OSC_HOST_LITTLE_ENDIAN 73 | 74 | #endif 75 | 76 | #elif defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__) 77 | 78 | // should cover gcc and clang 79 | 80 | #if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) 81 | 82 | #define OSC_HOST_LITTLE_ENDIAN 1 83 | #undef OSC_HOST_BIG_ENDIAN 84 | 85 | #elif (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) 86 | 87 | #define OSC_HOST_BIG_ENDIAN 1 88 | #undef OSC_HOST_LITTLE_ENDIAN 89 | 90 | #endif 91 | 92 | #else 93 | 94 | // gcc defines __LITTLE_ENDIAN__ and __BIG_ENDIAN__ 95 | // for others used here see http://sourceforge.net/p/predef/wiki/Endianness/ 96 | #if (defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)) \ 97 | || (defined(__ARMEL__) && !defined(__ARMEB__)) \ 98 | || (defined(__AARCH64EL__) && !defined(__AARCH64EB__)) \ 99 | || (defined(_MIPSEL) && !defined(_MIPSEB)) \ 100 | || (defined(__MIPSEL) && !defined(__MIPSEB)) \ 101 | || (defined(__MIPSEL__) && !defined(__MIPSEB__)) 102 | 103 | #define OSC_HOST_LITTLE_ENDIAN 1 104 | #undef OSC_HOST_BIG_ENDIAN 105 | 106 | #elif (defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__)) \ 107 | || (defined(__ARMEB__) && !defined(__ARMEL__)) \ 108 | || (defined(__AARCH64EB__) && !defined(__AARCH64EL__)) \ 109 | || (defined(_MIPSEB) && !defined(_MIPSEL)) \ 110 | || (defined(__MIPSEB) && !defined(__MIPSEL)) \ 111 | || (defined(__MIPSEB__) && !defined(__MIPSEL__)) 112 | 113 | #define OSC_HOST_BIG_ENDIAN 1 114 | #undef OSC_HOST_LITTLE_ENDIAN 115 | 116 | #endif 117 | 118 | #endif 119 | 120 | #if !defined(OSC_HOST_LITTLE_ENDIAN) && !defined(OSC_HOST_BIG_ENDIAN) 121 | 122 | #error please edit OSCHostEndianness.h or define one of {OSC_HOST_LITTLE_ENDIAN, OSC_HOST_BIG_ENDIAN} to configure endianness 123 | 124 | #endif 125 | 126 | #endif /* INCLUDED_OSCPACK_OSCHOSTENDIANNESS_H */ 127 | 128 | -------------------------------------------------------------------------------- /oscpack/osc/OscPacketListener.h: -------------------------------------------------------------------------------- 1 | /* 2 | oscpack -- Open Sound Control (OSC) packet manipulation library 3 | http://www.rossbencina.com/code/oscpack 4 | 5 | Copyright (c) 2004-2013 Ross Bencina 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining 8 | a copy of this software and associated documentation files 9 | (the "Software"), to deal in the Software without restriction, 10 | including without limitation the rights to use, copy, modify, merge, 11 | publish, distribute, sublicense, and/or sell copies of the Software, 12 | and to permit persons to whom the Software is furnished to do so, 13 | subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 22 | ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 23 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 24 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | /* 28 | The text above constitutes the entire oscpack license; however, 29 | the oscpack developer(s) also make the following non-binding requests: 30 | 31 | Any person wishing to distribute modifications to the Software is 32 | requested to send the modifications to the original developer so that 33 | they can be incorporated into the canonical version. It is also 34 | requested that these non-binding requests be included whenever the 35 | above license is reproduced. 36 | */ 37 | #ifndef INCLUDED_OSCPACK_OSCPACKETLISTENER_H 38 | #define INCLUDED_OSCPACK_OSCPACKETLISTENER_H 39 | 40 | #include "OscReceivedElements.h" 41 | #include "../ip/PacketListener.h" 42 | 43 | 44 | namespace osc{ 45 | 46 | class OscPacketListener : public PacketListener{ 47 | protected: 48 | virtual void ProcessBundle( const osc::ReceivedBundle& b, 49 | const IpEndpointName& remoteEndpoint ) 50 | { 51 | // ignore bundle time tag for now 52 | 53 | for( ReceivedBundle::const_iterator i = b.ElementsBegin(); 54 | i != b.ElementsEnd(); ++i ){ 55 | if( i->IsBundle() ) 56 | ProcessBundle( ReceivedBundle(*i), remoteEndpoint ); 57 | else 58 | ProcessMessage( ReceivedMessage(*i), remoteEndpoint ); 59 | } 60 | } 61 | 62 | virtual void ProcessMessage( const osc::ReceivedMessage& m, 63 | const IpEndpointName& remoteEndpoint ) = 0; 64 | 65 | public: 66 | virtual void ProcessPacket( const char *data, int size, 67 | const IpEndpointName& remoteEndpoint ) 68 | { 69 | osc::ReceivedPacket p( data, size ); 70 | if( p.IsBundle() ) 71 | ProcessBundle( ReceivedBundle(p), remoteEndpoint ); 72 | else 73 | ProcessMessage( ReceivedMessage(p), remoteEndpoint ); 74 | } 75 | }; 76 | 77 | } // namespace osc 78 | 79 | #endif /* INCLUDED_OSCPACK_OSCPACKETLISTENER_H */ 80 | -------------------------------------------------------------------------------- /oscpack/osc/OscPrintReceivedElements.h: -------------------------------------------------------------------------------- 1 | /* 2 | oscpack -- Open Sound Control (OSC) packet manipulation library 3 | http://www.rossbencina.com/code/oscpack 4 | 5 | Copyright (c) 2004-2013 Ross Bencina 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining 8 | a copy of this software and associated documentation files 9 | (the "Software"), to deal in the Software without restriction, 10 | including without limitation the rights to use, copy, modify, merge, 11 | publish, distribute, sublicense, and/or sell copies of the Software, 12 | and to permit persons to whom the Software is furnished to do so, 13 | subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 22 | ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 23 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 24 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | /* 28 | The text above constitutes the entire oscpack license; however, 29 | the oscpack developer(s) also make the following non-binding requests: 30 | 31 | Any person wishing to distribute modifications to the Software is 32 | requested to send the modifications to the original developer so that 33 | they can be incorporated into the canonical version. It is also 34 | requested that these non-binding requests be included whenever the 35 | above license is reproduced. 36 | */ 37 | #ifndef INCLUDED_OSCPACK_OSCPRINTRECEIVEDELEMENTS_H 38 | #define INCLUDED_OSCPACK_OSCPRINTRECEIVEDELEMENTS_H 39 | 40 | #include 41 | 42 | #include "OscReceivedElements.h" 43 | 44 | 45 | namespace osc{ 46 | 47 | std::ostream& operator<<( std::ostream & os, const ReceivedPacket& p ); 48 | std::ostream& operator<<( std::ostream & os, const ReceivedMessageArgument& arg ); 49 | std::ostream& operator<<( std::ostream & os, const ReceivedMessage& m ); 50 | std::ostream& operator<<( std::ostream & os, const ReceivedBundle& b ); 51 | 52 | } // namespace osc 53 | 54 | #endif /* INCLUDED_OSCPACK_OSCPRINTRECEIVEDELEMENTS_H */ 55 | -------------------------------------------------------------------------------- /oscpack/osc/OscTypes.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | oscpack -- Open Sound Control (OSC) packet manipulation library 3 | http://www.rossbencina.com/code/oscpack 4 | 5 | Copyright (c) 2004-2013 Ross Bencina 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining 8 | a copy of this software and associated documentation files 9 | (the "Software"), to deal in the Software without restriction, 10 | including without limitation the rights to use, copy, modify, merge, 11 | publish, distribute, sublicense, and/or sell copies of the Software, 12 | and to permit persons to whom the Software is furnished to do so, 13 | subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 22 | ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 23 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 24 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | /* 28 | The text above constitutes the entire oscpack license; however, 29 | the oscpack developer(s) also make the following non-binding requests: 30 | 31 | Any person wishing to distribute modifications to the Software is 32 | requested to send the modifications to the original developer so that 33 | they can be incorporated into the canonical version. It is also 34 | requested that these non-binding requests be included whenever the 35 | above license is reproduced. 36 | */ 37 | #include "OscTypes.h" 38 | 39 | namespace osc{ 40 | 41 | BundleInitiator BeginBundleImmediate(1); 42 | BundleTerminator EndBundle; 43 | MessageTerminator EndMessage; 44 | NilType OscNil; 45 | #ifndef _OBJC_OBJC_H_ 46 | NilType Nil; // Objective-C defines Nil. so our Nil is deprecated. use OscNil instead 47 | #endif 48 | InfinitumType Infinitum; 49 | ArrayInitiator BeginArray; 50 | ArrayTerminator EndArray; 51 | 52 | } // namespace osc 53 | -------------------------------------------------------------------------------- /windows/SimpleSimulator.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | //#include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "windows.h" 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // English (U.S.) resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 19 | #ifdef _WIN32 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | #pragma code_page(1252) 22 | 23 | 24 | ///////////////////////////////////////////////////////////////////////////// 25 | // 26 | // Version 27 | // 28 | 29 | VS_VERSION_INFO VERSIONINFO 30 | PRODUCTVERSION 1,1,6 31 | FILEVERSION 1,1,6,0 32 | FILETYPE 0x1L 33 | FILESUBTYPE 0x0L 34 | BEGIN 35 | BLOCK "StringFileInfo" 36 | BEGIN 37 | BLOCK "040904b0" 38 | BEGIN 39 | VALUE "Comments", "\0" 40 | VALUE "CompanyName", "TUIO.org\0" 41 | VALUE "FileDescription", "Tangible Interaction Framework\0" 42 | VALUE "FileVersion", "1, 1, 6, 0\0" 43 | VALUE "InternalName", "SimpleSimulator.exe\0" 44 | VALUE "LegalCopyright", "2016 Martin Kaltenbrunner.\0" 45 | VALUE "LegalTrademarks", "\0" 46 | VALUE "OriginalFilename", "SimpleSimulator.exe\0" 47 | VALUE "ProductName", "SimpleSimulator\0" 48 | VALUE "ProductVersion", "1, 1, 6\0" 49 | VALUE "SpecialBuild", "Release\0" 50 | END 51 | END 52 | BLOCK "VarFileInfo" 53 | BEGIN 54 | VALUE "Translation", 0x409, 1200 55 | END 56 | END 57 | 58 | #endif //_WIN32 59 | 60 | ///////////////////////////////////////////////////////////////////////////// 61 | // 62 | // Icon 63 | // 64 | 65 | // Icon with lowest ID value placed first to ensure application icon 66 | // remains consistent on all systems. 67 | IDI_ICON1 ICON "TUIO.ico" 68 | #endif // English (U.S.) resources 69 | ///////////////////////////////////////////////////////////////////////////// 70 | 71 | 72 | -------------------------------------------------------------------------------- /windows/SimpleSimulator.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | 19 | 20 | Header Files 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /windows/SimpleSimulator.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | PATH=%PATH%;$(SolutionDir)sdl\$(Platform)\; $(LocalDebuggerEnvironment) 5 | WindowsLocalDebugger 6 | 7 | 8 | PATH=%PATH%;$(SolutionDir)sdl\$(Platform)\; $(LocalDebuggerEnvironment) 9 | WindowsLocalDebugger 10 | 11 | 12 | PATH=%PATH%;$(SolutionDir)sdl\$(Platform)\; $(LocalDebuggerEnvironment) 13 | WindowsLocalDebugger 14 | 15 | 16 | PATH=%PATH%;$(SolutionDir)sdl\$(Platform)\; $(LocalDebuggerEnvironment) 17 | WindowsLocalDebugger 18 | 19 | -------------------------------------------------------------------------------- /windows/TUIO.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkalten/TUIO11_CPP/7d5dd6d4e2b8e7369c932e032f500e1b3254fd1d/windows/TUIO.ico -------------------------------------------------------------------------------- /windows/TUIO_CPP.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio Express 2012 for Windows Desktop 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TuioDump", "TuioDump.vcxproj", "{5E2EAE4F-8668-4647-98CA-562358EACC10}" 4 | EndProject 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TuioDemo", "TuioDemo.vcxproj", "{8737A4B6-C44F-4397-9BB5-432646375E9F}" 6 | EndProject 7 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libTUIO", "libTUIO.vcxproj", "{E1C28E7D-466C-4D0A-AEB1-CFFD0F6F5645}" 8 | EndProject 9 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimpleSimulator", "SimpleSimulator.vcxproj", "{810E065A-EC96-4C3F-8C8B-7EAE285DC797}" 10 | EndProject 11 | Global 12 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 13 | Debug|Win32 = Debug|Win32 14 | Debug|x64 = Debug|x64 15 | Release|Win32 = Release|Win32 16 | Release|x64 = Release|x64 17 | EndGlobalSection 18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 19 | {5E2EAE4F-8668-4647-98CA-562358EACC10}.Debug|Win32.ActiveCfg = Debug|Win32 20 | {5E2EAE4F-8668-4647-98CA-562358EACC10}.Debug|Win32.Build.0 = Debug|Win32 21 | {5E2EAE4F-8668-4647-98CA-562358EACC10}.Debug|x64.ActiveCfg = Debug|x64 22 | {5E2EAE4F-8668-4647-98CA-562358EACC10}.Debug|x64.Build.0 = Debug|x64 23 | {5E2EAE4F-8668-4647-98CA-562358EACC10}.Release|Win32.ActiveCfg = Release|Win32 24 | {5E2EAE4F-8668-4647-98CA-562358EACC10}.Release|Win32.Build.0 = Release|Win32 25 | {5E2EAE4F-8668-4647-98CA-562358EACC10}.Release|x64.ActiveCfg = Release|x64 26 | {5E2EAE4F-8668-4647-98CA-562358EACC10}.Release|x64.Build.0 = Release|x64 27 | {8737A4B6-C44F-4397-9BB5-432646375E9F}.Debug|Win32.ActiveCfg = Debug|Win32 28 | {8737A4B6-C44F-4397-9BB5-432646375E9F}.Debug|Win32.Build.0 = Debug|Win32 29 | {8737A4B6-C44F-4397-9BB5-432646375E9F}.Debug|x64.ActiveCfg = Debug|x64 30 | {8737A4B6-C44F-4397-9BB5-432646375E9F}.Debug|x64.Build.0 = Debug|x64 31 | {8737A4B6-C44F-4397-9BB5-432646375E9F}.Release|Win32.ActiveCfg = Release|Win32 32 | {8737A4B6-C44F-4397-9BB5-432646375E9F}.Release|Win32.Build.0 = Release|Win32 33 | {8737A4B6-C44F-4397-9BB5-432646375E9F}.Release|x64.ActiveCfg = Release|x64 34 | {8737A4B6-C44F-4397-9BB5-432646375E9F}.Release|x64.Build.0 = Release|x64 35 | {E1C28E7D-466C-4D0A-AEB1-CFFD0F6F5645}.Debug|Win32.ActiveCfg = Debug|Win32 36 | {E1C28E7D-466C-4D0A-AEB1-CFFD0F6F5645}.Debug|Win32.Build.0 = Debug|Win32 37 | {E1C28E7D-466C-4D0A-AEB1-CFFD0F6F5645}.Debug|x64.ActiveCfg = Debug|x64 38 | {E1C28E7D-466C-4D0A-AEB1-CFFD0F6F5645}.Debug|x64.Build.0 = Debug|x64 39 | {E1C28E7D-466C-4D0A-AEB1-CFFD0F6F5645}.Release|Win32.ActiveCfg = Release|Win32 40 | {E1C28E7D-466C-4D0A-AEB1-CFFD0F6F5645}.Release|Win32.Build.0 = Release|Win32 41 | {E1C28E7D-466C-4D0A-AEB1-CFFD0F6F5645}.Release|x64.ActiveCfg = Release|x64 42 | {E1C28E7D-466C-4D0A-AEB1-CFFD0F6F5645}.Release|x64.Build.0 = Release|x64 43 | {810E065A-EC96-4C3F-8C8B-7EAE285DC797}.Debug|Win32.ActiveCfg = Debug|Win32 44 | {810E065A-EC96-4C3F-8C8B-7EAE285DC797}.Debug|Win32.Build.0 = Debug|Win32 45 | {810E065A-EC96-4C3F-8C8B-7EAE285DC797}.Debug|x64.ActiveCfg = Debug|x64 46 | {810E065A-EC96-4C3F-8C8B-7EAE285DC797}.Debug|x64.Build.0 = Debug|x64 47 | {810E065A-EC96-4C3F-8C8B-7EAE285DC797}.Release|Win32.ActiveCfg = Release|Win32 48 | {810E065A-EC96-4C3F-8C8B-7EAE285DC797}.Release|Win32.Build.0 = Release|Win32 49 | {810E065A-EC96-4C3F-8C8B-7EAE285DC797}.Release|x64.ActiveCfg = Release|x64 50 | {810E065A-EC96-4C3F-8C8B-7EAE285DC797}.Release|x64.Build.0 = Release|x64 51 | EndGlobalSection 52 | GlobalSection(SolutionProperties) = preSolution 53 | HideSolutionNode = FALSE 54 | EndGlobalSection 55 | EndGlobal 56 | -------------------------------------------------------------------------------- /windows/TuioDemo.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | //#include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "windows.h" 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // English (U.S.) resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 19 | #ifdef _WIN32 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | #pragma code_page(1252) 22 | 23 | 24 | ///////////////////////////////////////////////////////////////////////////// 25 | // 26 | // Version 27 | // 28 | 29 | VS_VERSION_INFO VERSIONINFO 30 | PRODUCTVERSION 1,1,6 31 | FILEVERSION 1,1,6,0 32 | FILETYPE 0x1L 33 | FILESUBTYPE 0x0L 34 | BEGIN 35 | BLOCK "StringFileInfo" 36 | BEGIN 37 | BLOCK "040904b0" 38 | BEGIN 39 | VALUE "Comments", "\0" 40 | VALUE "CompanyName", "TUIO.org\0" 41 | VALUE "FileDescription", "Tangible Interaction Framework\0" 42 | VALUE "FileVersion", "1, 1, 6, 0\0" 43 | VALUE "InternalName", "TuioDemo.exe\0" 44 | VALUE "LegalCopyright", "2016 Martin Kaltenbrunner.\0" 45 | VALUE "LegalTrademarks", "\0" 46 | VALUE "OriginalFilename", "TuioDemo.exe\0" 47 | VALUE "ProductName", "TuioDemo\0" 48 | VALUE "ProductVersion", "1, 1, 6\0" 49 | VALUE "SpecialBuild", "Release\0" 50 | END 51 | END 52 | BLOCK "VarFileInfo" 53 | BEGIN 54 | VALUE "Translation", 0x409, 1200 55 | END 56 | END 57 | 58 | #endif //_WIN32 59 | 60 | ///////////////////////////////////////////////////////////////////////////// 61 | // 62 | // Icon 63 | // 64 | 65 | // Icon with lowest ID value placed first to ensure application icon 66 | // remains consistent on all systems. 67 | IDI_ICON1 ICON "TUIO.ico" 68 | #endif // English (U.S.) resources 69 | ///////////////////////////////////////////////////////////////////////////// 70 | 71 | 72 | -------------------------------------------------------------------------------- /windows/TuioDemo.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | 19 | 20 | Header Files 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /windows/TuioDemo.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | PATH=%PATH%;$(SolutionDir)sdl\$(Platform)\; $(LocalDebuggerEnvironment) 5 | WindowsLocalDebugger 6 | 7 | 8 | PATH=%PATH%;$(SolutionDir)sdl\$(Platform)\; $(LocalDebuggerEnvironment) 9 | WindowsLocalDebugger 10 | 11 | 12 | PATH=%PATH%;$(SolutionDir)sdl\$(Platform)\; $(LocalDebuggerEnvironment) 13 | WindowsLocalDebugger 14 | 15 | 16 | PATH=%PATH%;$(SolutionDir)sdl\$(Platform)\; $(LocalDebuggerEnvironment) 17 | WindowsLocalDebugger 18 | 19 | -------------------------------------------------------------------------------- /windows/TuioDump.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | 19 | 20 | Header Files 21 | 22 | 23 | -------------------------------------------------------------------------------- /windows/TuioDump.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /windows/libTUIO.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /windows/sdl/Win32/SDL2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkalten/TUIO11_CPP/7d5dd6d4e2b8e7369c932e032f500e1b3254fd1d/windows/sdl/Win32/SDL2.dll -------------------------------------------------------------------------------- /windows/sdl/Win32/SDL2.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkalten/TUIO11_CPP/7d5dd6d4e2b8e7369c932e032f500e1b3254fd1d/windows/sdl/Win32/SDL2.lib -------------------------------------------------------------------------------- /windows/sdl/Win32/SDL2main.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkalten/TUIO11_CPP/7d5dd6d4e2b8e7369c932e032f500e1b3254fd1d/windows/sdl/Win32/SDL2main.lib -------------------------------------------------------------------------------- /windows/sdl/Win32/freeglut.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkalten/TUIO11_CPP/7d5dd6d4e2b8e7369c932e032f500e1b3254fd1d/windows/sdl/Win32/freeglut.dll -------------------------------------------------------------------------------- /windows/sdl/Win32/freeglut.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkalten/TUIO11_CPP/7d5dd6d4e2b8e7369c932e032f500e1b3254fd1d/windows/sdl/Win32/freeglut.lib -------------------------------------------------------------------------------- /windows/sdl/include/GL/freeglut.h: -------------------------------------------------------------------------------- 1 | #ifndef __FREEGLUT_H__ 2 | #define __FREEGLUT_H__ 3 | 4 | /* 5 | * freeglut.h 6 | * 7 | * The freeglut library include file 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 10 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 11 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 12 | * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 13 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 14 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 15 | */ 16 | 17 | #include "freeglut_std.h" 18 | #include "freeglut_ext.h" 19 | 20 | /*** END OF FILE ***/ 21 | 22 | #endif /* __FREEGLUT_H__ */ 23 | -------------------------------------------------------------------------------- /windows/sdl/include/GL/glut.h: -------------------------------------------------------------------------------- 1 | #ifndef __GLUT_H__ 2 | #define __GLUT_H__ 3 | 4 | /* 5 | * glut.h 6 | * 7 | * The freeglut library include file 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 10 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 11 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 12 | * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 13 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 14 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 15 | */ 16 | 17 | #include "freeglut_std.h" 18 | 19 | /*** END OF FILE ***/ 20 | 21 | #endif /* __GLUT_H__ */ 22 | -------------------------------------------------------------------------------- /windows/sdl/include/SDL.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL.h 24 | * 25 | * Main include header for the SDL library 26 | */ 27 | 28 | 29 | #ifndef _SDL_H 30 | #define _SDL_H 31 | 32 | #include "SDL_main.h" 33 | #include "SDL_stdinc.h" 34 | #include "SDL_assert.h" 35 | #include "SDL_atomic.h" 36 | #include "SDL_audio.h" 37 | #include "SDL_clipboard.h" 38 | #include "SDL_cpuinfo.h" 39 | #include "SDL_endian.h" 40 | #include "SDL_error.h" 41 | #include "SDL_events.h" 42 | #include "SDL_filesystem.h" 43 | #include "SDL_joystick.h" 44 | #include "SDL_gamecontroller.h" 45 | #include "SDL_haptic.h" 46 | #include "SDL_hints.h" 47 | #include "SDL_loadso.h" 48 | #include "SDL_log.h" 49 | #include "SDL_messagebox.h" 50 | #include "SDL_mutex.h" 51 | #include "SDL_power.h" 52 | #include "SDL_render.h" 53 | #include "SDL_rwops.h" 54 | #include "SDL_system.h" 55 | #include "SDL_thread.h" 56 | #include "SDL_timer.h" 57 | #include "SDL_version.h" 58 | #include "SDL_video.h" 59 | 60 | #include "begin_code.h" 61 | /* Set up for C function definitions, even when using C++ */ 62 | #ifdef __cplusplus 63 | extern "C" { 64 | #endif 65 | 66 | /* As of version 0.5, SDL is loaded dynamically into the application */ 67 | 68 | /** 69 | * \name SDL_INIT_* 70 | * 71 | * These are the flags which may be passed to SDL_Init(). You should 72 | * specify the subsystems which you will be using in your application. 73 | */ 74 | /* @{ */ 75 | #define SDL_INIT_TIMER 0x00000001 76 | #define SDL_INIT_AUDIO 0x00000010 77 | #define SDL_INIT_VIDEO 0x00000020 /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */ 78 | #define SDL_INIT_JOYSTICK 0x00000200 /**< SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS */ 79 | #define SDL_INIT_HAPTIC 0x00001000 80 | #define SDL_INIT_GAMECONTROLLER 0x00002000 /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */ 81 | #define SDL_INIT_EVENTS 0x00004000 82 | #define SDL_INIT_NOPARACHUTE 0x00100000 /**< compatibility; this flag is ignored. */ 83 | #define SDL_INIT_EVERYTHING ( \ 84 | SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \ 85 | SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER \ 86 | ) 87 | /* @} */ 88 | 89 | /** 90 | * This function initializes the subsystems specified by \c flags 91 | */ 92 | extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags); 93 | 94 | /** 95 | * This function initializes specific SDL subsystems 96 | * 97 | * Subsystem initialization is ref-counted, you must call 98 | * SDL_QuitSubSystem for each SDL_InitSubSystem to correctly 99 | * shutdown a subsystem manually (or call SDL_Quit to force shutdown). 100 | * If a subsystem is already loaded then this call will 101 | * increase the ref-count and return. 102 | */ 103 | extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags); 104 | 105 | /** 106 | * This function cleans up specific SDL subsystems 107 | */ 108 | extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags); 109 | 110 | /** 111 | * This function returns a mask of the specified subsystems which have 112 | * previously been initialized. 113 | * 114 | * If \c flags is 0, it returns a mask of all initialized subsystems. 115 | */ 116 | extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags); 117 | 118 | /** 119 | * This function cleans up all initialized subsystems. You should 120 | * call it upon all exit conditions. 121 | */ 122 | extern DECLSPEC void SDLCALL SDL_Quit(void); 123 | 124 | /* Ends C function definitions when using C++ */ 125 | #ifdef __cplusplus 126 | } 127 | #endif 128 | #include "close_code.h" 129 | 130 | #endif /* _SDL_H */ 131 | 132 | /* vi: set ts=4 sw=4 expandtab: */ 133 | -------------------------------------------------------------------------------- /windows/sdl/include/SDL_bits.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_bits.h 24 | * 25 | * Functions for fiddling with bits and bitmasks. 26 | */ 27 | 28 | #ifndef _SDL_bits_h 29 | #define _SDL_bits_h 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /** 40 | * \file SDL_bits.h 41 | */ 42 | 43 | /** 44 | * Get the index of the most significant bit. Result is undefined when called 45 | * with 0. This operation can also be stated as "count leading zeroes" and 46 | * "log base 2". 47 | * 48 | * \return Index of the most significant bit, or -1 if the value is 0. 49 | */ 50 | SDL_FORCE_INLINE int 51 | SDL_MostSignificantBitIndex32(Uint32 x) 52 | { 53 | #if defined(__GNUC__) && __GNUC__ >= 4 54 | /* Count Leading Zeroes builtin in GCC. 55 | * http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html 56 | */ 57 | if (x == 0) { 58 | return -1; 59 | } 60 | return 31 - __builtin_clz(x); 61 | #else 62 | /* Based off of Bit Twiddling Hacks by Sean Eron Anderson 63 | * , released in the public domain. 64 | * http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog 65 | */ 66 | const Uint32 b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000}; 67 | const int S[] = {1, 2, 4, 8, 16}; 68 | 69 | int msbIndex = 0; 70 | int i; 71 | 72 | if (x == 0) { 73 | return -1; 74 | } 75 | 76 | for (i = 4; i >= 0; i--) 77 | { 78 | if (x & b[i]) 79 | { 80 | x >>= S[i]; 81 | msbIndex |= S[i]; 82 | } 83 | } 84 | 85 | return msbIndex; 86 | #endif 87 | } 88 | 89 | /* Ends C function definitions when using C++ */ 90 | #ifdef __cplusplus 91 | } 92 | #endif 93 | #include "close_code.h" 94 | 95 | #endif /* _SDL_bits_h */ 96 | 97 | /* vi: set ts=4 sw=4 expandtab: */ 98 | -------------------------------------------------------------------------------- /windows/sdl/include/SDL_blendmode.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_blendmode.h 24 | * 25 | * Header file declaring the SDL_BlendMode enumeration 26 | */ 27 | 28 | #ifndef _SDL_blendmode_h 29 | #define _SDL_blendmode_h 30 | 31 | #include "begin_code.h" 32 | /* Set up for C function definitions, even when using C++ */ 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /** 38 | * \brief The blend mode used in SDL_RenderCopy() and drawing operations. 39 | */ 40 | typedef enum 41 | { 42 | SDL_BLENDMODE_NONE = 0x00000000, /**< no blending 43 | dstRGBA = srcRGBA */ 44 | SDL_BLENDMODE_BLEND = 0x00000001, /**< alpha blending 45 | dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA)) 46 | dstA = srcA + (dstA * (1-srcA)) */ 47 | SDL_BLENDMODE_ADD = 0x00000002, /**< additive blending 48 | dstRGB = (srcRGB * srcA) + dstRGB 49 | dstA = dstA */ 50 | SDL_BLENDMODE_MOD = 0x00000004 /**< color modulate 51 | dstRGB = srcRGB * dstRGB 52 | dstA = dstA */ 53 | } SDL_BlendMode; 54 | 55 | /* Ends C function definitions when using C++ */ 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | #include "close_code.h" 60 | 61 | #endif /* _SDL_blendmode_h */ 62 | 63 | /* vi: set ts=4 sw=4 expandtab: */ 64 | -------------------------------------------------------------------------------- /windows/sdl/include/SDL_clipboard.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_clipboard.h 24 | * 25 | * Include file for SDL clipboard handling 26 | */ 27 | 28 | #ifndef _SDL_clipboard_h 29 | #define _SDL_clipboard_h 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /* Function prototypes */ 40 | 41 | /** 42 | * \brief Put UTF-8 text into the clipboard 43 | * 44 | * \sa SDL_GetClipboardText() 45 | */ 46 | extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text); 47 | 48 | /** 49 | * \brief Get UTF-8 text from the clipboard, which must be freed with SDL_free() 50 | * 51 | * \sa SDL_SetClipboardText() 52 | */ 53 | extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void); 54 | 55 | /** 56 | * \brief Returns a flag indicating whether the clipboard exists and contains a text string that is non-empty 57 | * 58 | * \sa SDL_GetClipboardText() 59 | */ 60 | extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void); 61 | 62 | 63 | /* Ends C function definitions when using C++ */ 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | #include "close_code.h" 68 | 69 | #endif /* _SDL_clipboard_h */ 70 | 71 | /* vi: set ts=4 sw=4 expandtab: */ 72 | -------------------------------------------------------------------------------- /windows/sdl/include/SDL_cpuinfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_cpuinfo.h 24 | * 25 | * CPU feature detection for SDL. 26 | */ 27 | 28 | #ifndef _SDL_cpuinfo_h 29 | #define _SDL_cpuinfo_h 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | /* Need to do this here because intrin.h has C++ code in it */ 34 | /* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */ 35 | #if defined(_MSC_VER) && (_MSC_VER >= 1500) && (defined(_M_IX86) || defined(_M_X64)) 36 | #include 37 | #ifndef _WIN64 38 | #define __MMX__ 39 | #define __3dNOW__ 40 | #endif 41 | #define __SSE__ 42 | #define __SSE2__ 43 | #elif defined(__MINGW64_VERSION_MAJOR) 44 | #include 45 | #else 46 | #ifdef __ALTIVEC__ 47 | #if HAVE_ALTIVEC_H && !defined(__APPLE_ALTIVEC__) 48 | #include 49 | #undef pixel 50 | #endif 51 | #endif 52 | #ifdef __MMX__ 53 | #include 54 | #endif 55 | #ifdef __3dNOW__ 56 | #include 57 | #endif 58 | #ifdef __SSE__ 59 | #include 60 | #endif 61 | #ifdef __SSE2__ 62 | #include 63 | #endif 64 | #endif 65 | 66 | #include "begin_code.h" 67 | /* Set up for C function definitions, even when using C++ */ 68 | #ifdef __cplusplus 69 | extern "C" { 70 | #endif 71 | 72 | /* This is a guess for the cacheline size used for padding. 73 | * Most x86 processors have a 64 byte cache line. 74 | * The 64-bit PowerPC processors have a 128 byte cache line. 75 | * We'll use the larger value to be generally safe. 76 | */ 77 | #define SDL_CACHELINE_SIZE 128 78 | 79 | /** 80 | * This function returns the number of CPU cores available. 81 | */ 82 | extern DECLSPEC int SDLCALL SDL_GetCPUCount(void); 83 | 84 | /** 85 | * This function returns the L1 cache line size of the CPU 86 | * 87 | * This is useful for determining multi-threaded structure padding 88 | * or SIMD prefetch sizes. 89 | */ 90 | extern DECLSPEC int SDLCALL SDL_GetCPUCacheLineSize(void); 91 | 92 | /** 93 | * This function returns true if the CPU has the RDTSC instruction. 94 | */ 95 | extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void); 96 | 97 | /** 98 | * This function returns true if the CPU has AltiVec features. 99 | */ 100 | extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void); 101 | 102 | /** 103 | * This function returns true if the CPU has MMX features. 104 | */ 105 | extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void); 106 | 107 | /** 108 | * This function returns true if the CPU has 3DNow! features. 109 | */ 110 | extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void); 111 | 112 | /** 113 | * This function returns true if the CPU has SSE features. 114 | */ 115 | extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void); 116 | 117 | /** 118 | * This function returns true if the CPU has SSE2 features. 119 | */ 120 | extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void); 121 | 122 | /** 123 | * This function returns true if the CPU has SSE3 features. 124 | */ 125 | extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE3(void); 126 | 127 | /** 128 | * This function returns true if the CPU has SSE4.1 features. 129 | */ 130 | extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE41(void); 131 | 132 | /** 133 | * This function returns true if the CPU has SSE4.2 features. 134 | */ 135 | extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE42(void); 136 | 137 | /** 138 | * This function returns true if the CPU has AVX features. 139 | */ 140 | extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX(void); 141 | 142 | /** 143 | * This function returns true if the CPU has AVX2 features. 144 | */ 145 | extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void); 146 | 147 | /** 148 | * This function returns the amount of RAM configured in the system, in MB. 149 | */ 150 | extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void); 151 | 152 | 153 | /* Ends C function definitions when using C++ */ 154 | #ifdef __cplusplus 155 | } 156 | #endif 157 | #include "close_code.h" 158 | 159 | #endif /* _SDL_cpuinfo_h */ 160 | 161 | /* vi: set ts=4 sw=4 expandtab: */ 162 | -------------------------------------------------------------------------------- /windows/sdl/include/SDL_error.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_error.h 24 | * 25 | * Simple error message routines for SDL. 26 | */ 27 | 28 | #ifndef _SDL_error_h 29 | #define _SDL_error_h 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /* Public functions */ 40 | /* SDL_SetError() unconditionally returns -1. */ 41 | extern DECLSPEC int SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); 42 | extern DECLSPEC const char *SDLCALL SDL_GetError(void); 43 | extern DECLSPEC void SDLCALL SDL_ClearError(void); 44 | 45 | /** 46 | * \name Internal error functions 47 | * 48 | * \internal 49 | * Private error reporting function - used internally. 50 | */ 51 | /* @{ */ 52 | #define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM) 53 | #define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED) 54 | #define SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param)) 55 | typedef enum 56 | { 57 | SDL_ENOMEM, 58 | SDL_EFREAD, 59 | SDL_EFWRITE, 60 | SDL_EFSEEK, 61 | SDL_UNSUPPORTED, 62 | SDL_LASTERROR 63 | } SDL_errorcode; 64 | /* SDL_Error() unconditionally returns -1. */ 65 | extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code); 66 | /* @} *//* Internal error functions */ 67 | 68 | /* Ends C function definitions when using C++ */ 69 | #ifdef __cplusplus 70 | } 71 | #endif 72 | #include "close_code.h" 73 | 74 | #endif /* _SDL_error_h */ 75 | 76 | /* vi: set ts=4 sw=4 expandtab: */ 77 | -------------------------------------------------------------------------------- /windows/sdl/include/SDL_gesture.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_gesture.h 24 | * 25 | * Include file for SDL gesture event handling. 26 | */ 27 | 28 | #ifndef _SDL_gesture_h 29 | #define _SDL_gesture_h 30 | 31 | #include "SDL_stdinc.h" 32 | #include "SDL_error.h" 33 | #include "SDL_video.h" 34 | 35 | #include "SDL_touch.h" 36 | 37 | 38 | #include "begin_code.h" 39 | /* Set up for C function definitions, even when using C++ */ 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | typedef Sint64 SDL_GestureID; 45 | 46 | /* Function prototypes */ 47 | 48 | /** 49 | * \brief Begin Recording a gesture on the specified touch, or all touches (-1) 50 | * 51 | * 52 | */ 53 | extern DECLSPEC int SDLCALL SDL_RecordGesture(SDL_TouchID touchId); 54 | 55 | 56 | /** 57 | * \brief Save all currently loaded Dollar Gesture templates 58 | * 59 | * 60 | */ 61 | extern DECLSPEC int SDLCALL SDL_SaveAllDollarTemplates(SDL_RWops *dst); 62 | 63 | /** 64 | * \brief Save a currently loaded Dollar Gesture template 65 | * 66 | * 67 | */ 68 | extern DECLSPEC int SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_RWops *dst); 69 | 70 | 71 | /** 72 | * \brief Load Dollar Gesture templates from a file 73 | * 74 | * 75 | */ 76 | extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src); 77 | 78 | 79 | /* Ends C function definitions when using C++ */ 80 | #ifdef __cplusplus 81 | } 82 | #endif 83 | #include "close_code.h" 84 | 85 | #endif /* _SDL_gesture_h */ 86 | 87 | /* vi: set ts=4 sw=4 expandtab: */ 88 | -------------------------------------------------------------------------------- /windows/sdl/include/SDL_loadso.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_loadso.h 24 | * 25 | * System dependent library loading routines 26 | * 27 | * Some things to keep in mind: 28 | * \li These functions only work on C function names. Other languages may 29 | * have name mangling and intrinsic language support that varies from 30 | * compiler to compiler. 31 | * \li Make sure you declare your function pointers with the same calling 32 | * convention as the actual library function. Your code will crash 33 | * mysteriously if you do not do this. 34 | * \li Avoid namespace collisions. If you load a symbol from the library, 35 | * it is not defined whether or not it goes into the global symbol 36 | * namespace for the application. If it does and it conflicts with 37 | * symbols in your code or other shared libraries, you will not get 38 | * the results you expect. :) 39 | */ 40 | 41 | #ifndef _SDL_loadso_h 42 | #define _SDL_loadso_h 43 | 44 | #include "SDL_stdinc.h" 45 | #include "SDL_error.h" 46 | 47 | #include "begin_code.h" 48 | /* Set up for C function definitions, even when using C++ */ 49 | #ifdef __cplusplus 50 | extern "C" { 51 | #endif 52 | 53 | /** 54 | * This function dynamically loads a shared object and returns a pointer 55 | * to the object handle (or NULL if there was an error). 56 | * The 'sofile' parameter is a system dependent name of the object file. 57 | */ 58 | extern DECLSPEC void *SDLCALL SDL_LoadObject(const char *sofile); 59 | 60 | /** 61 | * Given an object handle, this function looks up the address of the 62 | * named function in the shared object and returns it. This address 63 | * is no longer valid after calling SDL_UnloadObject(). 64 | */ 65 | extern DECLSPEC void *SDLCALL SDL_LoadFunction(void *handle, 66 | const char *name); 67 | 68 | /** 69 | * Unload a shared object from memory. 70 | */ 71 | extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle); 72 | 73 | /* Ends C function definitions when using C++ */ 74 | #ifdef __cplusplus 75 | } 76 | #endif 77 | #include "close_code.h" 78 | 79 | #endif /* _SDL_loadso_h */ 80 | 81 | /* vi: set ts=4 sw=4 expandtab: */ 82 | -------------------------------------------------------------------------------- /windows/sdl/include/SDL_name.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef _SDLname_h_ 23 | #define _SDLname_h_ 24 | 25 | #if defined(__STDC__) || defined(__cplusplus) 26 | #define NeedFunctionPrototypes 1 27 | #endif 28 | 29 | #define SDL_NAME(X) SDL_##X 30 | 31 | #endif /* _SDLname_h_ */ 32 | 33 | /* vi: set ts=4 sw=4 expandtab: */ 34 | -------------------------------------------------------------------------------- /windows/sdl/include/SDL_opengles.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_opengles.h 24 | * 25 | * This is a simple file to encapsulate the OpenGL ES 1.X API headers. 26 | */ 27 | 28 | #ifdef __IPHONEOS__ 29 | #include 30 | #include 31 | #else 32 | #include 33 | #include 34 | #endif 35 | 36 | #ifndef APIENTRY 37 | #define APIENTRY 38 | #endif 39 | -------------------------------------------------------------------------------- /windows/sdl/include/SDL_opengles2.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_opengles2.h 24 | * 25 | * This is a simple file to encapsulate the OpenGL ES 2.0 API headers. 26 | */ 27 | #ifndef _MSC_VER 28 | 29 | #ifdef __IPHONEOS__ 30 | #include 31 | #include 32 | #else 33 | #include 34 | #include 35 | #include 36 | #endif 37 | 38 | #else /* _MSC_VER */ 39 | 40 | /* OpenGL ES2 headers for Visual Studio */ 41 | #include "SDL_opengles2_khrplatform.h" 42 | #include "SDL_opengles2_gl2platform.h" 43 | #include "SDL_opengles2_gl2.h" 44 | #include "SDL_opengles2_gl2ext.h" 45 | 46 | #endif /* _MSC_VER */ 47 | 48 | #ifndef APIENTRY 49 | #define APIENTRY GL_APIENTRY 50 | #endif 51 | -------------------------------------------------------------------------------- /windows/sdl/include/SDL_opengles2_gl2platform.h: -------------------------------------------------------------------------------- 1 | #ifndef __gl2platform_h_ 2 | #define __gl2platform_h_ 3 | 4 | /* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */ 5 | 6 | /* 7 | * This document is licensed under the SGI Free Software B License Version 8 | * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . 9 | */ 10 | 11 | /* Platform-specific types and definitions for OpenGL ES 2.X gl2.h 12 | * 13 | * Adopters may modify khrplatform.h and this file to suit their platform. 14 | * You are encouraged to submit all modifications to the Khronos group so that 15 | * they can be included in future versions of this file. Please submit changes 16 | * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) 17 | * by filing a bug against product "OpenGL-ES" component "Registry". 18 | */ 19 | 20 | /*#include */ 21 | 22 | #ifndef GL_APICALL 23 | #define GL_APICALL KHRONOS_APICALL 24 | #endif 25 | 26 | #ifndef GL_APIENTRY 27 | #define GL_APIENTRY KHRONOS_APIENTRY 28 | #endif 29 | 30 | #endif /* __gl2platform_h_ */ 31 | -------------------------------------------------------------------------------- /windows/sdl/include/SDL_power.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef _SDL_power_h 23 | #define _SDL_power_h 24 | 25 | /** 26 | * \file SDL_power.h 27 | * 28 | * Header for the SDL power management routines. 29 | */ 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /** 40 | * \brief The basic state for the system's power supply. 41 | */ 42 | typedef enum 43 | { 44 | SDL_POWERSTATE_UNKNOWN, /**< cannot determine power status */ 45 | SDL_POWERSTATE_ON_BATTERY, /**< Not plugged in, running on the battery */ 46 | SDL_POWERSTATE_NO_BATTERY, /**< Plugged in, no battery available */ 47 | SDL_POWERSTATE_CHARGING, /**< Plugged in, charging battery */ 48 | SDL_POWERSTATE_CHARGED /**< Plugged in, battery charged */ 49 | } SDL_PowerState; 50 | 51 | 52 | /** 53 | * \brief Get the current power supply details. 54 | * 55 | * \param secs Seconds of battery life left. You can pass a NULL here if 56 | * you don't care. Will return -1 if we can't determine a 57 | * value, or we're not running on a battery. 58 | * 59 | * \param pct Percentage of battery life left, between 0 and 100. You can 60 | * pass a NULL here if you don't care. Will return -1 if we 61 | * can't determine a value, or we're not running on a battery. 62 | * 63 | * \return The state of the battery (if any). 64 | */ 65 | extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct); 66 | 67 | /* Ends C function definitions when using C++ */ 68 | #ifdef __cplusplus 69 | } 70 | #endif 71 | #include "close_code.h" 72 | 73 | #endif /* _SDL_power_h */ 74 | 75 | /* vi: set ts=4 sw=4 expandtab: */ 76 | -------------------------------------------------------------------------------- /windows/sdl/include/SDL_quit.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_quit.h 24 | * 25 | * Include file for SDL quit event handling. 26 | */ 27 | 28 | #ifndef _SDL_quit_h 29 | #define _SDL_quit_h 30 | 31 | #include "SDL_stdinc.h" 32 | #include "SDL_error.h" 33 | 34 | /** 35 | * \file SDL_quit.h 36 | * 37 | * An ::SDL_QUIT event is generated when the user tries to close the application 38 | * window. If it is ignored or filtered out, the window will remain open. 39 | * If it is not ignored or filtered, it is queued normally and the window 40 | * is allowed to close. When the window is closed, screen updates will 41 | * complete, but have no effect. 42 | * 43 | * SDL_Init() installs signal handlers for SIGINT (keyboard interrupt) 44 | * and SIGTERM (system termination request), if handlers do not already 45 | * exist, that generate ::SDL_QUIT events as well. There is no way 46 | * to determine the cause of an ::SDL_QUIT event, but setting a signal 47 | * handler in your application will override the default generation of 48 | * quit events for that signal. 49 | * 50 | * \sa SDL_Quit() 51 | */ 52 | 53 | /* There are no functions directly affecting the quit event */ 54 | 55 | #define SDL_QuitRequested() \ 56 | (SDL_PumpEvents(), (SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUIT,SDL_QUIT) > 0)) 57 | 58 | #endif /* _SDL_quit_h */ 59 | -------------------------------------------------------------------------------- /windows/sdl/include/SDL_rect.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_rect.h 24 | * 25 | * Header file for SDL_rect definition and management functions. 26 | */ 27 | 28 | #ifndef _SDL_rect_h 29 | #define _SDL_rect_h 30 | 31 | #include "SDL_stdinc.h" 32 | #include "SDL_error.h" 33 | #include "SDL_pixels.h" 34 | #include "SDL_rwops.h" 35 | 36 | #include "begin_code.h" 37 | /* Set up for C function definitions, even when using C++ */ 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | /** 43 | * \brief The structure that defines a point 44 | * 45 | * \sa SDL_EnclosePoints 46 | * \sa SDL_PointInRect 47 | */ 48 | typedef struct SDL_Point 49 | { 50 | int x; 51 | int y; 52 | } SDL_Point; 53 | 54 | /** 55 | * \brief A rectangle, with the origin at the upper left. 56 | * 57 | * \sa SDL_RectEmpty 58 | * \sa SDL_RectEquals 59 | * \sa SDL_HasIntersection 60 | * \sa SDL_IntersectRect 61 | * \sa SDL_UnionRect 62 | * \sa SDL_EnclosePoints 63 | */ 64 | typedef struct SDL_Rect 65 | { 66 | int x, y; 67 | int w, h; 68 | } SDL_Rect; 69 | 70 | /** 71 | * \brief Returns true if point resides inside a rectangle. 72 | */ 73 | SDL_FORCE_INLINE SDL_bool SDL_PointInRect(const SDL_Point *p, const SDL_Rect *r) 74 | { 75 | return ( (p->x >= r->x) && (p->x < (r->x + r->w)) && 76 | (p->y >= r->y) && (p->y < (r->y + r->h)) ) ? SDL_TRUE : SDL_FALSE; 77 | } 78 | 79 | /** 80 | * \brief Returns true if the rectangle has no area. 81 | */ 82 | SDL_FORCE_INLINE SDL_bool SDL_RectEmpty(const SDL_Rect *r) 83 | { 84 | return ((!r) || (r->w <= 0) || (r->h <= 0)) ? SDL_TRUE : SDL_FALSE; 85 | } 86 | 87 | /** 88 | * \brief Returns true if the two rectangles are equal. 89 | */ 90 | SDL_FORCE_INLINE SDL_bool SDL_RectEquals(const SDL_Rect *a, const SDL_Rect *b) 91 | { 92 | return (a && b && (a->x == b->x) && (a->y == b->y) && 93 | (a->w == b->w) && (a->h == b->h)) ? SDL_TRUE : SDL_FALSE; 94 | } 95 | 96 | /** 97 | * \brief Determine whether two rectangles intersect. 98 | * 99 | * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise. 100 | */ 101 | extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect * A, 102 | const SDL_Rect * B); 103 | 104 | /** 105 | * \brief Calculate the intersection of two rectangles. 106 | * 107 | * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise. 108 | */ 109 | extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect * A, 110 | const SDL_Rect * B, 111 | SDL_Rect * result); 112 | 113 | /** 114 | * \brief Calculate the union of two rectangles. 115 | */ 116 | extern DECLSPEC void SDLCALL SDL_UnionRect(const SDL_Rect * A, 117 | const SDL_Rect * B, 118 | SDL_Rect * result); 119 | 120 | /** 121 | * \brief Calculate a minimal rectangle enclosing a set of points 122 | * 123 | * \return SDL_TRUE if any points were within the clipping rect 124 | */ 125 | extern DECLSPEC SDL_bool SDLCALL SDL_EnclosePoints(const SDL_Point * points, 126 | int count, 127 | const SDL_Rect * clip, 128 | SDL_Rect * result); 129 | 130 | /** 131 | * \brief Calculate the intersection of a rectangle and line segment. 132 | * 133 | * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise. 134 | */ 135 | extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect * 136 | rect, int *X1, 137 | int *Y1, int *X2, 138 | int *Y2); 139 | 140 | /* Ends C function definitions when using C++ */ 141 | #ifdef __cplusplus 142 | } 143 | #endif 144 | #include "close_code.h" 145 | 146 | #endif /* _SDL_rect_h */ 147 | 148 | /* vi: set ts=4 sw=4 expandtab: */ 149 | -------------------------------------------------------------------------------- /windows/sdl/include/SDL_revision.h: -------------------------------------------------------------------------------- 1 | #define SDL_REVISION "hg-10001:e12c38730512" 2 | #define SDL_REVISION_NUMBER 10001 3 | -------------------------------------------------------------------------------- /windows/sdl/include/SDL_test.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | #ifndef _SDL_test_h 31 | #define _SDL_test_h 32 | 33 | #include "SDL.h" 34 | #include "SDL_test_common.h" 35 | #include "SDL_test_font.h" 36 | #include "SDL_test_random.h" 37 | #include "SDL_test_fuzzer.h" 38 | #include "SDL_test_crc32.h" 39 | #include "SDL_test_md5.h" 40 | #include "SDL_test_log.h" 41 | #include "SDL_test_assert.h" 42 | #include "SDL_test_harness.h" 43 | #include "SDL_test_images.h" 44 | #include "SDL_test_compare.h" 45 | 46 | #include "begin_code.h" 47 | /* Set up for C function definitions, even when using C++ */ 48 | #ifdef __cplusplus 49 | extern "C" { 50 | #endif 51 | 52 | /* Global definitions */ 53 | 54 | /* 55 | * Note: Maximum size of SDLTest log message is less than SDL's limit 56 | * to ensure we can fit additional information such as the timestamp. 57 | */ 58 | #define SDLTEST_MAX_LOGMESSAGE_LENGTH 3584 59 | 60 | /* Ends C function definitions when using C++ */ 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | #include "close_code.h" 65 | 66 | #endif /* _SDL_test_h */ 67 | 68 | /* vi: set ts=4 sw=4 expandtab: */ 69 | -------------------------------------------------------------------------------- /windows/sdl/include/SDL_test_assert.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_assert.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | * 32 | * Assert API for test code and test cases 33 | * 34 | */ 35 | 36 | #ifndef _SDL_test_assert_h 37 | #define _SDL_test_assert_h 38 | 39 | #include "begin_code.h" 40 | /* Set up for C function definitions, even when using C++ */ 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | /** 46 | * \brief Fails the assert. 47 | */ 48 | #define ASSERT_FAIL 0 49 | 50 | /** 51 | * \brief Passes the assert. 52 | */ 53 | #define ASSERT_PASS 1 54 | 55 | /** 56 | * \brief Assert that logs and break execution flow on failures. 57 | * 58 | * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0). 59 | * \param assertDescription Message to log with the assert describing it. 60 | */ 61 | void SDLTest_Assert(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2); 62 | 63 | /** 64 | * \brief Assert for test cases that logs but does not break execution flow on failures. Updates assertion counters. 65 | * 66 | * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0). 67 | * \param assertDescription Message to log with the assert describing it. 68 | * 69 | * \returns Returns the assertCondition so it can be used to externally to break execution flow if desired. 70 | */ 71 | int SDLTest_AssertCheck(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2); 72 | 73 | /** 74 | * \brief Explicitly pass without checking an assertion condition. Updates assertion counter. 75 | * 76 | * \param assertDescription Message to log with the assert describing it. 77 | */ 78 | void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(1); 79 | 80 | /** 81 | * \brief Resets the assert summary counters to zero. 82 | */ 83 | void SDLTest_ResetAssertSummary(); 84 | 85 | /** 86 | * \brief Logs summary of all assertions (total, pass, fail) since last reset as INFO or ERROR. 87 | */ 88 | void SDLTest_LogAssertSummary(); 89 | 90 | 91 | /** 92 | * \brief Converts the current assert summary state to a test result. 93 | * 94 | * \returns TEST_RESULT_PASSED, TEST_RESULT_FAILED, or TEST_RESULT_NO_ASSERT 95 | */ 96 | int SDLTest_AssertSummaryToTestResult(); 97 | 98 | #ifdef __cplusplus 99 | } 100 | #endif 101 | #include "close_code.h" 102 | 103 | #endif /* _SDL_test_assert_h */ 104 | 105 | /* vi: set ts=4 sw=4 expandtab: */ 106 | -------------------------------------------------------------------------------- /windows/sdl/include/SDL_test_compare.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_compare.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | 32 | Defines comparison functions (i.e. for surfaces). 33 | 34 | */ 35 | 36 | #ifndef _SDL_test_compare_h 37 | #define _SDL_test_compare_h 38 | 39 | #include "SDL.h" 40 | 41 | #include "SDL_test_images.h" 42 | 43 | #include "begin_code.h" 44 | /* Set up for C function definitions, even when using C++ */ 45 | #ifdef __cplusplus 46 | extern "C" { 47 | #endif 48 | 49 | /** 50 | * \brief Compares a surface and with reference image data for equality 51 | * 52 | * \param surface Surface used in comparison 53 | * \param referenceSurface Test Surface used in comparison 54 | * \param allowable_error Allowable difference (=sum of squared difference for each RGB component) in blending accuracy. 55 | * 56 | * \returns 0 if comparison succeeded, >0 (=number of pixels for which the comparison failed) if comparison failed, -1 if any of the surfaces were NULL, -2 if the surface sizes differ. 57 | */ 58 | int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error); 59 | 60 | 61 | /* Ends C function definitions when using C++ */ 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | #include "close_code.h" 66 | 67 | #endif /* _SDL_test_compare_h */ 68 | 69 | /* vi: set ts=4 sw=4 expandtab: */ 70 | -------------------------------------------------------------------------------- /windows/sdl/include/SDL_test_crc32.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_crc32.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | 32 | Implements CRC32 calculations (default output is Perl String::CRC32 compatible). 33 | 34 | */ 35 | 36 | #ifndef _SDL_test_crc32_h 37 | #define _SDL_test_crc32_h 38 | 39 | #include "begin_code.h" 40 | /* Set up for C function definitions, even when using C++ */ 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | 46 | /* ------------ Definitions --------- */ 47 | 48 | /* Definition shared by all CRC routines */ 49 | 50 | #ifndef CrcUint32 51 | #define CrcUint32 unsigned int 52 | #endif 53 | #ifndef CrcUint8 54 | #define CrcUint8 unsigned char 55 | #endif 56 | 57 | #ifdef ORIGINAL_METHOD 58 | #define CRC32_POLY 0x04c11db7 /* AUTODIN II, Ethernet, & FDDI */ 59 | #else 60 | #define CRC32_POLY 0xEDB88320 /* Perl String::CRC32 compatible */ 61 | #endif 62 | 63 | /** 64 | * Data structure for CRC32 (checksum) computation 65 | */ 66 | typedef struct { 67 | CrcUint32 crc32_table[256]; /* CRC table */ 68 | } SDLTest_Crc32Context; 69 | 70 | /* ---------- Function Prototypes ------------- */ 71 | 72 | /** 73 | * \brief Initialize the CRC context 74 | * 75 | * Note: The function initializes the crc table required for all crc calculations. 76 | * 77 | * \param crcContext pointer to context variable 78 | * 79 | * \returns 0 for OK, -1 on error 80 | * 81 | */ 82 | int SDLTest_Crc32Init(SDLTest_Crc32Context * crcContext); 83 | 84 | 85 | /** 86 | * \brief calculate a crc32 from a data block 87 | * 88 | * \param crcContext pointer to context variable 89 | * \param inBuf input buffer to checksum 90 | * \param inLen length of input buffer 91 | * \param crc32 pointer to Uint32 to store the final CRC into 92 | * 93 | * \returns 0 for OK, -1 on error 94 | * 95 | */ 96 | int SDLTest_crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32); 97 | 98 | /* Same routine broken down into three steps */ 99 | int SDLTest_Crc32CalcStart(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32); 100 | int SDLTest_Crc32CalcEnd(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32); 101 | int SDLTest_Crc32CalcBuffer(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32); 102 | 103 | 104 | /** 105 | * \brief clean up CRC context 106 | * 107 | * \param crcContext pointer to context variable 108 | * 109 | * \returns 0 for OK, -1 on error 110 | * 111 | */ 112 | 113 | int SDLTest_Crc32Done(SDLTest_Crc32Context * crcContext); 114 | 115 | 116 | /* Ends C function definitions when using C++ */ 117 | #ifdef __cplusplus 118 | } 119 | #endif 120 | #include "close_code.h" 121 | 122 | #endif /* _SDL_test_crc32_h */ 123 | 124 | /* vi: set ts=4 sw=4 expandtab: */ 125 | -------------------------------------------------------------------------------- /windows/sdl/include/SDL_test_font.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_font.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | #ifndef _SDL_test_font_h 31 | #define _SDL_test_font_h 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /* Function prototypes */ 40 | 41 | #define FONT_CHARACTER_SIZE 8 42 | 43 | /** 44 | * \brief Draw a string in the currently set font. 45 | * 46 | * \param renderer The renderer to draw on. 47 | * \param x The X coordinate of the upper left corner of the character. 48 | * \param y The Y coordinate of the upper left corner of the character. 49 | * \param c The character to draw. 50 | * 51 | * \returns Returns 0 on success, -1 on failure. 52 | */ 53 | int SDLTest_DrawCharacter( SDL_Renderer *renderer, int x, int y, char c ); 54 | 55 | /** 56 | * \brief Draw a string in the currently set font. 57 | * 58 | * \param renderer The renderer to draw on. 59 | * \param x The X coordinate of the upper left corner of the string. 60 | * \param y The Y coordinate of the upper left corner of the string. 61 | * \param s The string to draw. 62 | * 63 | * \returns Returns 0 on success, -1 on failure. 64 | */ 65 | int SDLTest_DrawString( SDL_Renderer * renderer, int x, int y, const char *s ); 66 | 67 | 68 | /* Ends C function definitions when using C++ */ 69 | #ifdef __cplusplus 70 | } 71 | #endif 72 | #include "close_code.h" 73 | 74 | #endif /* _SDL_test_font_h */ 75 | 76 | /* vi: set ts=4 sw=4 expandtab: */ 77 | -------------------------------------------------------------------------------- /windows/sdl/include/SDL_test_harness.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_harness.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | Defines types for test case definitions and the test execution harness API. 32 | 33 | Based on original GSOC code by Markus Kauppila 34 | */ 35 | 36 | #ifndef _SDL_test_harness_h 37 | #define _SDL_test_harness_h 38 | 39 | #include "begin_code.h" 40 | /* Set up for C function definitions, even when using C++ */ 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | 46 | /* ! Definitions for test case structures */ 47 | #define TEST_ENABLED 1 48 | #define TEST_DISABLED 0 49 | 50 | /* ! Definition of all the possible test return values of the test case method */ 51 | #define TEST_ABORTED -1 52 | #define TEST_STARTED 0 53 | #define TEST_COMPLETED 1 54 | #define TEST_SKIPPED 2 55 | 56 | /* ! Definition of all the possible test results for the harness */ 57 | #define TEST_RESULT_PASSED 0 58 | #define TEST_RESULT_FAILED 1 59 | #define TEST_RESULT_NO_ASSERT 2 60 | #define TEST_RESULT_SKIPPED 3 61 | #define TEST_RESULT_SETUP_FAILURE 4 62 | 63 | /* !< Function pointer to a test case setup function (run before every test) */ 64 | typedef void (*SDLTest_TestCaseSetUpFp)(void *arg); 65 | 66 | /* !< Function pointer to a test case function */ 67 | typedef int (*SDLTest_TestCaseFp)(void *arg); 68 | 69 | /* !< Function pointer to a test case teardown function (run after every test) */ 70 | typedef void (*SDLTest_TestCaseTearDownFp)(void *arg); 71 | 72 | /** 73 | * Holds information about a single test case. 74 | */ 75 | typedef struct SDLTest_TestCaseReference { 76 | /* !< Func2Stress */ 77 | SDLTest_TestCaseFp testCase; 78 | /* !< Short name (or function name) "Func2Stress" */ 79 | char *name; 80 | /* !< Long name or full description "This test pushes func2() to the limit." */ 81 | char *description; 82 | /* !< Set to TEST_ENABLED or TEST_DISABLED (test won't be run) */ 83 | int enabled; 84 | } SDLTest_TestCaseReference; 85 | 86 | /** 87 | * Holds information about a test suite (multiple test cases). 88 | */ 89 | typedef struct SDLTest_TestSuiteReference { 90 | /* !< "PlatformSuite" */ 91 | char *name; 92 | /* !< The function that is run before each test. NULL skips. */ 93 | SDLTest_TestCaseSetUpFp testSetUp; 94 | /* !< The test cases that are run as part of the suite. Last item should be NULL. */ 95 | const SDLTest_TestCaseReference **testCases; 96 | /* !< The function that is run after each test. NULL skips. */ 97 | SDLTest_TestCaseTearDownFp testTearDown; 98 | } SDLTest_TestSuiteReference; 99 | 100 | 101 | /** 102 | * \brief Execute a test suite using the given run seed and execution key. 103 | * 104 | * \param testSuites Suites containing the test case. 105 | * \param userRunSeed Custom run seed provided by user, or NULL to autogenerate one. 106 | * \param userExecKey Custom execution key provided by user, or 0 to autogenerate one. 107 | * \param filter Filter specification. NULL disables. Case sensitive. 108 | * \param testIterations Number of iterations to run each test case. 109 | * 110 | * \returns Test run result; 0 when all tests passed, 1 if any tests failed. 111 | */ 112 | int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *userRunSeed, Uint64 userExecKey, const char *filter, int testIterations); 113 | 114 | 115 | /* Ends C function definitions when using C++ */ 116 | #ifdef __cplusplus 117 | } 118 | #endif 119 | #include "close_code.h" 120 | 121 | #endif /* _SDL_test_harness_h */ 122 | 123 | /* vi: set ts=4 sw=4 expandtab: */ 124 | -------------------------------------------------------------------------------- /windows/sdl/include/SDL_test_images.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_images.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | 32 | Defines some images for tests. 33 | 34 | */ 35 | 36 | #ifndef _SDL_test_images_h 37 | #define _SDL_test_images_h 38 | 39 | #include "SDL.h" 40 | 41 | #include "begin_code.h" 42 | /* Set up for C function definitions, even when using C++ */ 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | /** 48 | *Type for test images. 49 | */ 50 | typedef struct SDLTest_SurfaceImage_s { 51 | int width; 52 | int height; 53 | unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */ 54 | const char *pixel_data; 55 | } SDLTest_SurfaceImage_t; 56 | 57 | /* Test images */ 58 | SDL_Surface *SDLTest_ImageBlit(); 59 | SDL_Surface *SDLTest_ImageBlitColor(); 60 | SDL_Surface *SDLTest_ImageBlitAlpha(); 61 | SDL_Surface *SDLTest_ImageBlitBlendAdd(); 62 | SDL_Surface *SDLTest_ImageBlitBlend(); 63 | SDL_Surface *SDLTest_ImageBlitBlendMod(); 64 | SDL_Surface *SDLTest_ImageBlitBlendNone(); 65 | SDL_Surface *SDLTest_ImageBlitBlendAll(); 66 | SDL_Surface *SDLTest_ImageFace(); 67 | SDL_Surface *SDLTest_ImagePrimitives(); 68 | SDL_Surface *SDLTest_ImagePrimitivesBlend(); 69 | 70 | /* Ends C function definitions when using C++ */ 71 | #ifdef __cplusplus 72 | } 73 | #endif 74 | #include "close_code.h" 75 | 76 | #endif /* _SDL_test_images_h */ 77 | 78 | /* vi: set ts=4 sw=4 expandtab: */ 79 | -------------------------------------------------------------------------------- /windows/sdl/include/SDL_test_log.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_log.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | * 32 | * Wrapper to log in the TEST category 33 | * 34 | */ 35 | 36 | #ifndef _SDL_test_log_h 37 | #define _SDL_test_log_h 38 | 39 | #include "begin_code.h" 40 | /* Set up for C function definitions, even when using C++ */ 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | /** 46 | * \brief Prints given message with a timestamp in the TEST category and INFO priority. 47 | * 48 | * \param fmt Message to be logged 49 | */ 50 | void SDLTest_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); 51 | 52 | /** 53 | * \brief Prints given message with a timestamp in the TEST category and the ERROR priority. 54 | * 55 | * \param fmt Message to be logged 56 | */ 57 | void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); 58 | 59 | /* Ends C function definitions when using C++ */ 60 | #ifdef __cplusplus 61 | } 62 | #endif 63 | #include "close_code.h" 64 | 65 | #endif /* _SDL_test_log_h */ 66 | 67 | /* vi: set ts=4 sw=4 expandtab: */ 68 | -------------------------------------------------------------------------------- /windows/sdl/include/SDL_test_md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_md5.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | *********************************************************************** 32 | ** Header file for implementation of MD5 ** 33 | ** RSA Data Security, Inc. MD5 Message-Digest Algorithm ** 34 | ** Created: 2/17/90 RLR ** 35 | ** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version ** 36 | ** Revised (for MD5): RLR 4/27/91 ** 37 | ** -- G modified to have y&~z instead of y&z ** 38 | ** -- FF, GG, HH modified to add in last register done ** 39 | ** -- Access pattern: round 2 works mod 5, round 3 works mod 3 ** 40 | ** -- distinct additive constant for each step ** 41 | ** -- round 4 added, working mod 7 ** 42 | *********************************************************************** 43 | */ 44 | 45 | /* 46 | *********************************************************************** 47 | ** Message-digest routines: ** 48 | ** To form the message digest for a message M ** 49 | ** (1) Initialize a context buffer mdContext using MD5Init ** 50 | ** (2) Call MD5Update on mdContext and M ** 51 | ** (3) Call MD5Final on mdContext ** 52 | ** The message digest is now in mdContext->digest[0...15] ** 53 | *********************************************************************** 54 | */ 55 | 56 | #ifndef _SDL_test_md5_h 57 | #define _SDL_test_md5_h 58 | 59 | #include "begin_code.h" 60 | /* Set up for C function definitions, even when using C++ */ 61 | #ifdef __cplusplus 62 | extern "C" { 63 | #endif 64 | 65 | /* ------------ Definitions --------- */ 66 | 67 | /* typedef a 32-bit type */ 68 | typedef unsigned long int MD5UINT4; 69 | 70 | /* Data structure for MD5 (Message-Digest) computation */ 71 | typedef struct { 72 | MD5UINT4 i[2]; /* number of _bits_ handled mod 2^64 */ 73 | MD5UINT4 buf[4]; /* scratch buffer */ 74 | unsigned char in[64]; /* input buffer */ 75 | unsigned char digest[16]; /* actual digest after Md5Final call */ 76 | } SDLTest_Md5Context; 77 | 78 | /* ---------- Function Prototypes ------------- */ 79 | 80 | /** 81 | * \brief initialize the context 82 | * 83 | * \param mdContext pointer to context variable 84 | * 85 | * Note: The function initializes the message-digest context 86 | * mdContext. Call before each new use of the context - 87 | * all fields are set to zero. 88 | */ 89 | void SDLTest_Md5Init(SDLTest_Md5Context * mdContext); 90 | 91 | 92 | /** 93 | * \brief update digest from variable length data 94 | * 95 | * \param mdContext pointer to context variable 96 | * \param inBuf pointer to data array/string 97 | * \param inLen length of data array/string 98 | * 99 | * Note: The function updates the message-digest context to account 100 | * for the presence of each of the characters inBuf[0..inLen-1] 101 | * in the message whose digest is being computed. 102 | */ 103 | 104 | void SDLTest_Md5Update(SDLTest_Md5Context * mdContext, unsigned char *inBuf, 105 | unsigned int inLen); 106 | 107 | 108 | /** 109 | * \brief complete digest computation 110 | * 111 | * \param mdContext pointer to context variable 112 | * 113 | * Note: The function terminates the message-digest computation and 114 | * ends with the desired message digest in mdContext.digest[0..15]. 115 | * Always call before using the digest[] variable. 116 | */ 117 | 118 | void SDLTest_Md5Final(SDLTest_Md5Context * mdContext); 119 | 120 | 121 | /* Ends C function definitions when using C++ */ 122 | #ifdef __cplusplus 123 | } 124 | #endif 125 | #include "close_code.h" 126 | 127 | #endif /* _SDL_test_md5_h */ 128 | 129 | /* vi: set ts=4 sw=4 expandtab: */ 130 | -------------------------------------------------------------------------------- /windows/sdl/include/SDL_test_random.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_random.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | 32 | A "32-bit Multiply with carry random number generator. Very fast. 33 | Includes a list of recommended multipliers. 34 | 35 | multiply-with-carry generator: x(n) = a*x(n-1) + carry mod 2^32. 36 | period: (a*2^31)-1 37 | 38 | */ 39 | 40 | #ifndef _SDL_test_random_h 41 | #define _SDL_test_random_h 42 | 43 | #include "begin_code.h" 44 | /* Set up for C function definitions, even when using C++ */ 45 | #ifdef __cplusplus 46 | extern "C" { 47 | #endif 48 | 49 | /* --- Definitions */ 50 | 51 | /* 52 | * Macros that return a random number in a specific format. 53 | */ 54 | #define SDLTest_RandomInt(c) ((int)SDLTest_Random(c)) 55 | 56 | /* 57 | * Context structure for the random number generator state. 58 | */ 59 | typedef struct { 60 | unsigned int a; 61 | unsigned int x; 62 | unsigned int c; 63 | unsigned int ah; 64 | unsigned int al; 65 | } SDLTest_RandomContext; 66 | 67 | 68 | /* --- Function prototypes */ 69 | 70 | /** 71 | * \brief Initialize random number generator with two integers. 72 | * 73 | * Note: The random sequence of numbers returned by ...Random() is the 74 | * same for the same two integers and has a period of 2^31. 75 | * 76 | * \param rndContext pointer to context structure 77 | * \param xi integer that defines the random sequence 78 | * \param ci integer that defines the random sequence 79 | * 80 | */ 81 | void SDLTest_RandomInit(SDLTest_RandomContext * rndContext, unsigned int xi, 82 | unsigned int ci); 83 | 84 | /** 85 | * \brief Initialize random number generator based on current system time. 86 | * 87 | * \param rndContext pointer to context structure 88 | * 89 | */ 90 | void SDLTest_RandomInitTime(SDLTest_RandomContext *rndContext); 91 | 92 | 93 | /** 94 | * \brief Initialize random number generator based on current system time. 95 | * 96 | * Note: ...RandomInit() or ...RandomInitTime() must have been called 97 | * before using this function. 98 | * 99 | * \param rndContext pointer to context structure 100 | * 101 | * \returns A random number (32bit unsigned integer) 102 | * 103 | */ 104 | unsigned int SDLTest_Random(SDLTest_RandomContext *rndContext); 105 | 106 | 107 | /* Ends C function definitions when using C++ */ 108 | #ifdef __cplusplus 109 | } 110 | #endif 111 | #include "close_code.h" 112 | 113 | #endif /* _SDL_test_random_h */ 114 | 115 | /* vi: set ts=4 sw=4 expandtab: */ 116 | -------------------------------------------------------------------------------- /windows/sdl/include/SDL_timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef _SDL_timer_h 23 | #define _SDL_timer_h 24 | 25 | /** 26 | * \file SDL_timer.h 27 | * 28 | * Header for the SDL time management routines. 29 | */ 30 | 31 | #include "SDL_stdinc.h" 32 | #include "SDL_error.h" 33 | 34 | #include "begin_code.h" 35 | /* Set up for C function definitions, even when using C++ */ 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /** 41 | * \brief Get the number of milliseconds since the SDL library initialization. 42 | * 43 | * \note This value wraps if the program runs for more than ~49 days. 44 | */ 45 | extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void); 46 | 47 | /** 48 | * \brief Compare SDL ticks values, and return true if A has passed B 49 | * 50 | * e.g. if you want to wait 100 ms, you could do this: 51 | * Uint32 timeout = SDL_GetTicks() + 100; 52 | * while (!SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) { 53 | * ... do work until timeout has elapsed 54 | * } 55 | */ 56 | #define SDL_TICKS_PASSED(A, B) ((Sint32)((B) - (A)) <= 0) 57 | 58 | /** 59 | * \brief Get the current value of the high resolution counter 60 | */ 61 | extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceCounter(void); 62 | 63 | /** 64 | * \brief Get the count per second of the high resolution counter 65 | */ 66 | extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceFrequency(void); 67 | 68 | /** 69 | * \brief Wait a specified number of milliseconds before returning. 70 | */ 71 | extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms); 72 | 73 | /** 74 | * Function prototype for the timer callback function. 75 | * 76 | * The callback function is passed the current timer interval and returns 77 | * the next timer interval. If the returned value is the same as the one 78 | * passed in, the periodic alarm continues, otherwise a new alarm is 79 | * scheduled. If the callback returns 0, the periodic alarm is cancelled. 80 | */ 81 | typedef Uint32 (SDLCALL * SDL_TimerCallback) (Uint32 interval, void *param); 82 | 83 | /** 84 | * Definition of the timer ID type. 85 | */ 86 | typedef int SDL_TimerID; 87 | 88 | /** 89 | * \brief Add a new timer to the pool of timers already running. 90 | * 91 | * \return A timer ID, or 0 when an error occurs. 92 | */ 93 | extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval, 94 | SDL_TimerCallback callback, 95 | void *param); 96 | 97 | /** 98 | * \brief Remove a timer knowing its ID. 99 | * 100 | * \return A boolean value indicating success or failure. 101 | * 102 | * \warning It is not safe to remove a timer multiple times. 103 | */ 104 | extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID id); 105 | 106 | 107 | /* Ends C function definitions when using C++ */ 108 | #ifdef __cplusplus 109 | } 110 | #endif 111 | #include "close_code.h" 112 | 113 | #endif /* _SDL_timer_h */ 114 | 115 | /* vi: set ts=4 sw=4 expandtab: */ 116 | -------------------------------------------------------------------------------- /windows/sdl/include/SDL_touch.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_touch.h 24 | * 25 | * Include file for SDL touch event handling. 26 | */ 27 | 28 | #ifndef _SDL_touch_h 29 | #define _SDL_touch_h 30 | 31 | #include "SDL_stdinc.h" 32 | #include "SDL_error.h" 33 | #include "SDL_video.h" 34 | 35 | #include "begin_code.h" 36 | /* Set up for C function definitions, even when using C++ */ 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | typedef Sint64 SDL_TouchID; 42 | typedef Sint64 SDL_FingerID; 43 | 44 | typedef struct SDL_Finger 45 | { 46 | SDL_FingerID id; 47 | float x; 48 | float y; 49 | float pressure; 50 | } SDL_Finger; 51 | 52 | /* Used as the device ID for mouse events simulated with touch input */ 53 | #define SDL_TOUCH_MOUSEID ((Uint32)-1) 54 | 55 | 56 | /* Function prototypes */ 57 | 58 | /** 59 | * \brief Get the number of registered touch devices. 60 | */ 61 | extern DECLSPEC int SDLCALL SDL_GetNumTouchDevices(void); 62 | 63 | /** 64 | * \brief Get the touch ID with the given index, or 0 if the index is invalid. 65 | */ 66 | extern DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice(int index); 67 | 68 | /** 69 | * \brief Get the number of active fingers for a given touch device. 70 | */ 71 | extern DECLSPEC int SDLCALL SDL_GetNumTouchFingers(SDL_TouchID touchID); 72 | 73 | /** 74 | * \brief Get the finger object of the given touch, with the given index. 75 | */ 76 | extern DECLSPEC SDL_Finger * SDLCALL SDL_GetTouchFinger(SDL_TouchID touchID, int index); 77 | 78 | /* Ends C function definitions when using C++ */ 79 | #ifdef __cplusplus 80 | } 81 | #endif 82 | #include "close_code.h" 83 | 84 | #endif /* _SDL_touch_h */ 85 | 86 | /* vi: set ts=4 sw=4 expandtab: */ 87 | -------------------------------------------------------------------------------- /windows/sdl/include/SDL_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_types.h 24 | * 25 | * \deprecated 26 | */ 27 | 28 | /* DEPRECATED */ 29 | #include "SDL_stdinc.h" 30 | -------------------------------------------------------------------------------- /windows/sdl/include/begin_code.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file begin_code.h 24 | * 25 | * This file sets things up for C dynamic library function definitions, 26 | * static inlined functions, and structures aligned at 4-byte alignment. 27 | * If you don't like ugly C preprocessor code, don't look at this file. :) 28 | */ 29 | 30 | /* This shouldn't be nested -- included it around code only. */ 31 | #ifdef _begin_code_h 32 | #error Nested inclusion of begin_code.h 33 | #endif 34 | #define _begin_code_h 35 | 36 | #ifndef SDL_DEPRECATED 37 | # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ 38 | # define SDL_DEPRECATED __attribute__((deprecated)) 39 | # else 40 | # define SDL_DEPRECATED 41 | # endif 42 | #endif 43 | 44 | #ifndef SDL_UNUSED 45 | # ifdef __GNUC__ 46 | # define SDL_UNUSED __attribute__((unused)) 47 | # else 48 | # define SDL_UNUSED 49 | # endif 50 | #endif 51 | 52 | /* Some compilers use a special export keyword */ 53 | #ifndef DECLSPEC 54 | # if defined(__WIN32__) || defined(__WINRT__) 55 | # ifdef __BORLANDC__ 56 | # ifdef BUILD_SDL 57 | # define DECLSPEC 58 | # else 59 | # define DECLSPEC __declspec(dllimport) 60 | # endif 61 | # else 62 | # define DECLSPEC __declspec(dllexport) 63 | # endif 64 | # else 65 | # if defined(__GNUC__) && __GNUC__ >= 4 66 | # define DECLSPEC __attribute__ ((visibility("default"))) 67 | # else 68 | # define DECLSPEC 69 | # endif 70 | # endif 71 | #endif 72 | 73 | /* By default SDL uses the C calling convention */ 74 | #ifndef SDLCALL 75 | #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) 76 | #define SDLCALL __cdecl 77 | #else 78 | #define SDLCALL 79 | #endif 80 | #endif /* SDLCALL */ 81 | 82 | /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ 83 | #ifdef __SYMBIAN32__ 84 | #undef DECLSPEC 85 | #define DECLSPEC 86 | #endif /* __SYMBIAN32__ */ 87 | 88 | /* Force structure packing at 4 byte alignment. 89 | This is necessary if the header is included in code which has structure 90 | packing set to an alternate value, say for loading structures from disk. 91 | The packing is reset to the previous value in close_code.h 92 | */ 93 | #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) 94 | #ifdef _MSC_VER 95 | #pragma warning(disable: 4103) 96 | #endif 97 | #ifdef __BORLANDC__ 98 | #pragma nopackwarning 99 | #endif 100 | #ifdef _M_X64 101 | /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ 102 | #pragma pack(push,8) 103 | #else 104 | #pragma pack(push,4) 105 | #endif 106 | #endif /* Compiler needs structure packing set */ 107 | 108 | #ifndef SDL_INLINE 109 | #if defined(__GNUC__) 110 | #define SDL_INLINE __inline__ 111 | #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ 112 | defined(__DMC__) || defined(__SC__) || \ 113 | defined(__WATCOMC__) || defined(__LCC__) || \ 114 | defined(__DECC) 115 | #define SDL_INLINE __inline 116 | #ifndef __inline__ 117 | #define __inline__ __inline 118 | #endif 119 | #else 120 | #define SDL_INLINE inline 121 | #ifndef __inline__ 122 | #define __inline__ inline 123 | #endif 124 | #endif 125 | #endif /* SDL_INLINE not defined */ 126 | 127 | #ifndef SDL_FORCE_INLINE 128 | #if defined(_MSC_VER) 129 | #define SDL_FORCE_INLINE __forceinline 130 | #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) 131 | #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ 132 | #else 133 | #define SDL_FORCE_INLINE static SDL_INLINE 134 | #endif 135 | #endif /* SDL_FORCE_INLINE not defined */ 136 | 137 | /* Apparently this is needed by several Windows compilers */ 138 | #if !defined(__MACH__) 139 | #ifndef NULL 140 | #ifdef __cplusplus 141 | #define NULL 0 142 | #else 143 | #define NULL ((void *)0) 144 | #endif 145 | #endif /* NULL */ 146 | #endif /* ! Mac OS X - breaks precompiled headers */ 147 | -------------------------------------------------------------------------------- /windows/sdl/include/close_code.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2016 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file close_code.h 24 | * 25 | * This file reverses the effects of begin_code.h and should be included 26 | * after you finish any function and structure declarations in your headers 27 | */ 28 | 29 | #undef _begin_code_h 30 | 31 | /* Reset structure packing at previous byte alignment */ 32 | #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) 33 | #ifdef __BORLANDC__ 34 | #pragma nopackwarning 35 | #endif 36 | #pragma pack(pop) 37 | #endif /* Compiler needs structure packing set */ 38 | -------------------------------------------------------------------------------- /windows/sdl/x64/SDL2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkalten/TUIO11_CPP/7d5dd6d4e2b8e7369c932e032f500e1b3254fd1d/windows/sdl/x64/SDL2.dll -------------------------------------------------------------------------------- /windows/sdl/x64/SDL2.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkalten/TUIO11_CPP/7d5dd6d4e2b8e7369c932e032f500e1b3254fd1d/windows/sdl/x64/SDL2.lib -------------------------------------------------------------------------------- /windows/sdl/x64/SDL2main.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkalten/TUIO11_CPP/7d5dd6d4e2b8e7369c932e032f500e1b3254fd1d/windows/sdl/x64/SDL2main.lib -------------------------------------------------------------------------------- /windows/sdl/x64/freeglut.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkalten/TUIO11_CPP/7d5dd6d4e2b8e7369c932e032f500e1b3254fd1d/windows/sdl/x64/freeglut.dll -------------------------------------------------------------------------------- /windows/sdl/x64/freeglut.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkalten/TUIO11_CPP/7d5dd6d4e2b8e7369c932e032f500e1b3254fd1d/windows/sdl/x64/freeglut.lib --------------------------------------------------------------------------------