├── .gitignore ├── README.md ├── addon_config.mk ├── example ├── Makefile ├── addons.make ├── config.make ├── example.qbs ├── example.sln ├── example.vcxproj └── src │ ├── MyTestObject.h │ ├── main.cpp │ ├── ofApp.cpp │ └── ofApp.h ├── license.md └── src ├── ofxMSAInteractiveObject.cpp └── ofxMSAInteractiveObject.h /.gitignore: -------------------------------------------------------------------------------- 1 | ######################### 2 | # openFrameworks patterns 3 | ######################### 4 | 5 | # build files 6 | openFrameworks.a 7 | openFrameworksDebug.a 8 | openFrameworksUniversal.a 9 | libs/openFrameworksCompiled/lib/*/* 10 | !libs/openFrameworksCompiled/lib/*/.gitkeep 11 | 12 | # apothecary 13 | scripts/apothecary 14 | 15 | # rule to avoid non-official addons going into git 16 | # see addons/.gitignore 17 | addons/* 18 | 19 | # rule to avoid non-official apps going into git 20 | # see apps/.gitignore 21 | apps/* 22 | 23 | # rule to ignore compiled / downloaded libs 24 | /libs/* 25 | !/libs/openFrameworks 26 | !/libs/openFrameworksCompiled 27 | 28 | # also, see examples/.gitignore 29 | 30 | ######################### 31 | # general 32 | ######################### 33 | 34 | [Bb]uild/ 35 | [Oo]bj/ 36 | *.o 37 | examples/**/[Dd]ebug*/ 38 | examples/**/[Rr]elease*/ 39 | examples/**/gcc-debug/ 40 | examples/**/gcc-release/ 41 | tests/**/[Dd]ebug*/ 42 | tests/**/[Rr]elease*/ 43 | tests/**/gcc-debug/ 44 | tests/**/gcc-release/ 45 | *.mode* 46 | *.app/ 47 | *.pyc 48 | .svn/ 49 | *.log 50 | *.cpp.eep 51 | *.cpp.elf 52 | *.cpp.hex 53 | 54 | ######################### 55 | # IDE 56 | ######################### 57 | 58 | # XCode 59 | *.pbxuser 60 | *.perspective 61 | *.perspectivev3 62 | *.mode1v3 63 | *.mode2v3 64 | # XCode 4 65 | xcuserdata 66 | *.xcworkspace 67 | 68 | # Code::Blocks 69 | *.depend 70 | *.layout 71 | 72 | # Visual Studio 73 | *.sdf 74 | *.opensdf 75 | *.suo 76 | *.pdb 77 | *.ilk 78 | *.aps 79 | ipch/ 80 | **/.vs/* 81 | 82 | # Eclipse 83 | .metadata 84 | local.properties 85 | .externalToolBuilders 86 | 87 | # Android Studio 88 | .idea 89 | .gradle 90 | gradle 91 | gradlew 92 | gradlew.bat 93 | 94 | # QtCreator 95 | *.qbs.user 96 | *.pro.user 97 | *.pri 98 | 99 | 100 | ######################### 101 | # operating system 102 | ######################### 103 | 104 | # Linux 105 | *~ 106 | # KDE 107 | .directory 108 | .AppleDouble 109 | 110 | # OSX 111 | .DS_Store 112 | *.swp 113 | *~.nib 114 | # Thumbnails 115 | ._* 116 | examples/ios/**/mediaAssets 117 | 118 | # Windows 119 | # Windows image file caches 120 | Thumbs.db 121 | # Folder config file 122 | Desktop.ini 123 | 124 | # Android 125 | .csettings 126 | /libs/openFrameworksCompiled/project/android/paths.make 127 | 128 | # Android Studio 129 | *.iml 130 | 131 | ######################### 132 | # miscellaneous 133 | ######################### 134 | 135 | .mailmap 136 | /apps*/ 137 | 138 | ######################### 139 | # core examples 140 | ######################### 141 | 142 | bin/* 143 | !bin/data/ 144 | 145 | **/bin/* 146 | !**/bin/data/ 147 | 148 | ######################### 149 | # IDE 150 | ######################### 151 | 152 | # XCode 153 | *.xcodeproj 154 | Project.xcconfig 155 | openFrameworks-Info.plist 156 | ofxiOS-Info.plist 157 | ofxiOS_Prefix.pch 158 | */*/Default*.png 159 | */*/Icon*.png 160 | 161 | # Code::Blocks 162 | # *.cbp 163 | # *.workspace 164 | 165 | # Visual Studio 166 | # *.sln 167 | # *.vcxproj 168 | *.vcxproj.user 169 | *.vcxproj.filters 170 | icon.rc 171 | 172 | # Eclipse 173 | .cproject 174 | .project 175 | .settings/ 176 | 177 | # QtCreator 178 | # *.qbs 179 | *.qbs.user* 180 | *.pro 181 | *.pro.user 182 | qtc_Desktop_* 183 | 184 | ######################### 185 | # operating system 186 | ######################### 187 | 188 | # Linux 189 | # Makefile 190 | # config.make 191 | # Leave Android files in until project generation works 192 | !/android/*/Makefile 193 | !/android/*/config.make 194 | 195 | # Android 196 | android/*/test link 197 | android/*/gen 198 | android/*/res/raw 199 | libOFAndroidApp*.so 200 | gdbserver 201 | gdb.setup 202 | libneondetection.so 203 | Application.mk 204 | Android.mk 205 | 206 | !android/*/.cproject 207 | !android/*/.project 208 | !android/*/.settings 209 | !android/*/.settings/* 210 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ofxMSAInteractiveObject 2 | ===================================== 3 | 4 | Introduction 5 | ------------ 6 | C++ openFrameworks addon which wraps up some poco functionality to make flash-like objects which auto updates/draws and adds mouse methods like onRollOver, onPress, OnRollout? etc with bounds checking with easy to remember functions to register/un-register callbacks. 7 | 8 | Licence 9 | ------- 10 | The code in this repository is available under the [MIT License](https://secure.wikimedia.org/wikipedia/en/wiki/Mit_license). 11 | Copyright (c) 2008-2012 Memo Akten, [www.memo.tv](http://www.memo.tv) 12 | The Mega Super Awesome Visuals Company 13 | 14 | 15 | Installation 16 | ------------ 17 | Copy to your openFrameworks/addons folder. 18 | 19 | Dependencies 20 | ------------ 21 | none 22 | 23 | Compatibility 24 | ------------ 25 | OF0072 26 | 27 | Known issues 28 | ------------ 29 | none 30 | 31 | Version history 32 | ------------ 33 | 34 | ### v2.2 23/09/2012 35 | - compatible with OF0072 36 | - renamed (uppercase) MSA namespace to (lowercase) msa. (kept MSA as an alias for backwards compatibility) 37 | 38 | ### v2.1 07/04/2009 39 | - changed license to revised BSD (a lot more more permissive than GPL) 40 | 41 | ### v2.0 23/02/08 42 | - updated to work with the oF 006 event system (thanks to arturo) 43 | - added onDragOutside() callback 44 | - fixed bug with onReleaseOutside() 45 | 46 | ### v1.01 16/10/08 47 | - minor poco compatibility update 48 | 49 | ### v1.0 14/10/08 50 | - initial version 51 | 52 | 53 | -------------------------------------------------------------------------------- /addon_config.mk: -------------------------------------------------------------------------------- 1 | meta: 2 | ADDON_NAME = ofxMSAInteractiveObject 3 | ADDON_DESCRIPTION = C++ openFrameworks addon which wraps up some auto event functionality 4 | ADDON_AUTHOR = Memo Akten, www.memo.tv 5 | ADDON_TAGS = "GUI" 6 | ADDON_URL = https://github.com/memo/ofxMSAInteractiveObject 7 | -------------------------------------------------------------------------------- /example/Makefile: -------------------------------------------------------------------------------- 1 | # Attempt to load a config.make file. 2 | # If none is found, project defaults in config.project.make will be used. 3 | ifneq ($(wildcard config.make),) 4 | include config.make 5 | endif 6 | 7 | # make sure the the OF_ROOT location is defined 8 | ifndef OF_ROOT 9 | OF_ROOT=$(realpath ../../..) 10 | endif 11 | 12 | # call the project makefile! 13 | include $(OF_ROOT)/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk 14 | -------------------------------------------------------------------------------- /example/addons.make: -------------------------------------------------------------------------------- 1 | ofxMSAInteractiveObject 2 | -------------------------------------------------------------------------------- /example/config.make: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # CONFIGURE PROJECT MAKEFILE (optional) 3 | # This file is where we make project specific configurations. 4 | ################################################################################ 5 | 6 | ################################################################################ 7 | # OF ROOT 8 | # The location of your root openFrameworks installation 9 | # (default) OF_ROOT = ../../.. 10 | ################################################################################ 11 | # OF_ROOT = ../../.. 12 | 13 | ################################################################################ 14 | # PROJECT ROOT 15 | # The location of the project - a starting place for searching for files 16 | # (default) PROJECT_ROOT = . (this directory) 17 | # 18 | ################################################################################ 19 | # PROJECT_ROOT = . 20 | 21 | ################################################################################ 22 | # PROJECT SPECIFIC CHECKS 23 | # This is a project defined section to create internal makefile flags to 24 | # conditionally enable or disable the addition of various features within 25 | # this makefile. For instance, if you want to make changes based on whether 26 | # GTK is installed, one might test that here and create a variable to check. 27 | ################################################################################ 28 | # None 29 | 30 | ################################################################################ 31 | # PROJECT EXTERNAL SOURCE PATHS 32 | # These are fully qualified paths that are not within the PROJECT_ROOT folder. 33 | # Like source folders in the PROJECT_ROOT, these paths are subject to 34 | # exlclusion via the PROJECT_EXLCUSIONS list. 35 | # 36 | # (default) PROJECT_EXTERNAL_SOURCE_PATHS = (blank) 37 | # 38 | # Note: Leave a leading space when adding list items with the += operator 39 | ################################################################################ 40 | # PROJECT_EXTERNAL_SOURCE_PATHS = 41 | 42 | ################################################################################ 43 | # PROJECT EXCLUSIONS 44 | # These makefiles assume that all folders in your current project directory 45 | # and any listed in the PROJECT_EXTERNAL_SOURCH_PATHS are are valid locations 46 | # to look for source code. The any folders or files that match any of the 47 | # items in the PROJECT_EXCLUSIONS list below will be ignored. 48 | # 49 | # Each item in the PROJECT_EXCLUSIONS list will be treated as a complete 50 | # string unless teh user adds a wildcard (%) operator to match subdirectories. 51 | # GNU make only allows one wildcard for matching. The second wildcard (%) is 52 | # treated literally. 53 | # 54 | # (default) PROJECT_EXCLUSIONS = (blank) 55 | # 56 | # Will automatically exclude the following: 57 | # 58 | # $(PROJECT_ROOT)/bin% 59 | # $(PROJECT_ROOT)/obj% 60 | # $(PROJECT_ROOT)/%.xcodeproj 61 | # 62 | # Note: Leave a leading space when adding list items with the += operator 63 | ################################################################################ 64 | # PROJECT_EXCLUSIONS = 65 | 66 | ################################################################################ 67 | # PROJECT LINKER FLAGS 68 | # These flags will be sent to the linker when compiling the executable. 69 | # 70 | # (default) PROJECT_LDFLAGS = -Wl,-rpath=./libs 71 | # 72 | # Note: Leave a leading space when adding list items with the += operator 73 | # 74 | # Currently, shared libraries that are needed are copied to the 75 | # $(PROJECT_ROOT)/bin/libs directory. The following LDFLAGS tell the linker to 76 | # add a runtime path to search for those shared libraries, since they aren't 77 | # incorporated directly into the final executable application binary. 78 | ################################################################################ 79 | # PROJECT_LDFLAGS=-Wl,-rpath=./libs 80 | 81 | ################################################################################ 82 | # PROJECT DEFINES 83 | # Create a space-delimited list of DEFINES. The list will be converted into 84 | # CFLAGS with the "-D" flag later in the makefile. 85 | # 86 | # (default) PROJECT_DEFINES = (blank) 87 | # 88 | # Note: Leave a leading space when adding list items with the += operator 89 | ################################################################################ 90 | # PROJECT_DEFINES = 91 | 92 | ################################################################################ 93 | # PROJECT CFLAGS 94 | # This is a list of fully qualified CFLAGS required when compiling for this 95 | # project. These CFLAGS will be used IN ADDITION TO the PLATFORM_CFLAGS 96 | # defined in your platform specific core configuration files. These flags are 97 | # presented to the compiler BEFORE the PROJECT_OPTIMIZATION_CFLAGS below. 98 | # 99 | # (default) PROJECT_CFLAGS = (blank) 100 | # 101 | # Note: Before adding PROJECT_CFLAGS, note that the PLATFORM_CFLAGS defined in 102 | # your platform specific configuration file will be applied by default and 103 | # further flags here may not be needed. 104 | # 105 | # Note: Leave a leading space when adding list items with the += operator 106 | ################################################################################ 107 | # PROJECT_CFLAGS = 108 | 109 | ################################################################################ 110 | # PROJECT OPTIMIZATION CFLAGS 111 | # These are lists of CFLAGS that are target-specific. While any flags could 112 | # be conditionally added, they are usually limited to optimization flags. 113 | # These flags are added BEFORE the PROJECT_CFLAGS. 114 | # 115 | # PROJECT_OPTIMIZATION_CFLAGS_RELEASE flags are only applied to RELEASE targets. 116 | # 117 | # (default) PROJECT_OPTIMIZATION_CFLAGS_RELEASE = (blank) 118 | # 119 | # PROJECT_OPTIMIZATION_CFLAGS_DEBUG flags are only applied to DEBUG targets. 120 | # 121 | # (default) PROJECT_OPTIMIZATION_CFLAGS_DEBUG = (blank) 122 | # 123 | # Note: Before adding PROJECT_OPTIMIZATION_CFLAGS, please note that the 124 | # PLATFORM_OPTIMIZATION_CFLAGS defined in your platform specific configuration 125 | # file will be applied by default and further optimization flags here may not 126 | # be needed. 127 | # 128 | # Note: Leave a leading space when adding list items with the += operator 129 | ################################################################################ 130 | # PROJECT_OPTIMIZATION_CFLAGS_RELEASE = 131 | # PROJECT_OPTIMIZATION_CFLAGS_DEBUG = 132 | 133 | ################################################################################ 134 | # PROJECT COMPILERS 135 | # Custom compilers can be set for CC and CXX 136 | # (default) PROJECT_CXX = (blank) 137 | # (default) PROJECT_CC = (blank) 138 | # Note: Leave a leading space when adding list items with the += operator 139 | ################################################################################ 140 | # PROJECT_CXX = 141 | # PROJECT_CC = 142 | -------------------------------------------------------------------------------- /example/example.qbs: -------------------------------------------------------------------------------- 1 | import qbs 2 | import qbs.Process 3 | import qbs.File 4 | import qbs.FileInfo 5 | import qbs.TextFile 6 | import "../../../libs/openFrameworksCompiled/project/qtcreator/ofApp.qbs" as ofApp 7 | 8 | Project{ 9 | property string of_root: '../../..' 10 | 11 | ofApp { 12 | name: { return FileInfo.baseName(sourceDirectory) } 13 | 14 | files: [ 15 | 'src/main.cpp', 16 | 'src/ofApp.cpp', 17 | 'src/ofApp.h', 18 | ] 19 | 20 | // This project is using addons.make to include the addons 21 | // since it was imported from old code. To change it to include 22 | // the addons from the qbs file change the following lines to 23 | // the list of used addons in array format. eg: 24 | // 25 | // of.addons: [ 26 | // 'ofxGui', 27 | // 'ofxOpenCv', 28 | // ] 29 | 30 | // additional flags for the project. the of module sets some 31 | // flags by default to add the core libraries, search paths... 32 | // this flags can be augmented through the following properties: 33 | of.pkgConfigs: [] // list of additional system pkgs to include 34 | of.includePaths: [] // include search paths 35 | of.cFlags: [] // flags passed to the c compiler 36 | of.cxxFlags: [] // flags passed to the c++ compiler 37 | of.linkerFlags: [] // flags passed to the linker 38 | of.defines: [] // defines are passed as -D to the compiler 39 | // and can be checked with #ifdef or #if in the code 40 | of.frameworks: [] // osx only, additional frameworks to link with the project 41 | of.staticLibraries: [] // static libraries 42 | of.dynamicLibraries: [] // dynamic libraries 43 | 44 | // create a console window when the application start 45 | consoleApplication: true 46 | 47 | // other flags can be set through the cpp module: http://doc.qt.io/qbs/cpp-module.html 48 | // eg: this will enable ccache when compiling 49 | // 50 | // cpp.compilerWrapper: 'ccache' 51 | 52 | Depends{ 53 | name: "cpp" 54 | } 55 | 56 | // common rules that parse the include search paths, core libraries... 57 | Depends{ 58 | name: "of" 59 | } 60 | 61 | // dependency with the OF library 62 | Depends{ 63 | name: "openFrameworks" 64 | } 65 | } 66 | 67 | property bool makeOF: true // use makfiles to compile the OF library 68 | // will compile OF only once for all your projects 69 | // otherwise compiled per project with qbs 70 | 71 | property bool precompileOfMain: false // precompile ofMain.h 72 | // faster to recompile when including ofMain.h 73 | // but might use a lot of space per project 74 | 75 | references: [FileInfo.joinPaths(of_root, "/libs/openFrameworksCompiled/project/qtcreator/openFrameworks.qbs")] 76 | } 77 | -------------------------------------------------------------------------------- /example/example.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 15 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example", "example.vcxproj", "{7FD42DF7-442E-479A-BA76-D0022F99702A}" 4 | EndProject 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openframeworksLib", "..\..\..\libs\openFrameworksCompiled\project\vs\openframeworksLib.vcxproj", "{5837595D-ACA9-485C-8E76-729040CE4B0B}" 6 | EndProject 7 | Global 8 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 9 | Debug|Win32 = Debug|Win32 10 | Debug|x64 = Debug|x64 11 | Release|Win32 = Release|Win32 12 | Release|x64 = Release|x64 13 | EndGlobalSection 14 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 15 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.ActiveCfg = Debug|Win32 16 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.Build.0 = Debug|Win32 17 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.ActiveCfg = Debug|x64 18 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.Build.0 = Debug|x64 19 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.ActiveCfg = Release|Win32 20 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.Build.0 = Release|Win32 21 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.ActiveCfg = Release|x64 22 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.Build.0 = Release|x64 23 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.ActiveCfg = Debug|Win32 24 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.Build.0 = Debug|Win32 25 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.ActiveCfg = Debug|x64 26 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.Build.0 = Debug|x64 27 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.ActiveCfg = Release|Win32 28 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.Build.0 = Release|Win32 29 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|x64.ActiveCfg = Release|x64 30 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|x64.Build.0 = Release|x64 31 | EndGlobalSection 32 | GlobalSection(SolutionProperties) = preSolution 33 | HideSolutionNode = FALSE 34 | EndGlobalSection 35 | EndGlobal 36 | -------------------------------------------------------------------------------- /example/example.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | $([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0')) 23 | $(LatestTargetPlatformVersion) 24 | $(WindowsTargetPlatformVersion) 25 | 26 | 27 | {7FD42DF7-442E-479A-BA76-D0022F99702A} 28 | Win32Proj 29 | emptyExample 30 | 31 | 32 | 33 | Application 34 | Unicode 35 | v141 36 | 37 | 38 | Application 39 | Unicode 40 | v141 41 | 42 | 43 | Application 44 | Unicode 45 | true 46 | v141 47 | 48 | 49 | Application 50 | Unicode 51 | true 52 | v141 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | bin\ 74 | obj\$(Platform)\$(Configuration)\ 75 | $(ProjectName)_debug 76 | true 77 | true 78 | 79 | 80 | bin\ 81 | obj\$(Platform)\$(Configuration)\ 82 | $(ProjectName)_debug 83 | true 84 | true 85 | 86 | 87 | bin\ 88 | obj\$(Platform)\$(Configuration)\ 89 | false 90 | 91 | 92 | bin\ 93 | obj\$(Platform)\$(Configuration)\ 94 | false 95 | 96 | 97 | 98 | Disabled 99 | EnableFastChecks 100 | %(PreprocessorDefinitions) 101 | MultiThreadedDebugDLL 102 | Level3 103 | %(AdditionalIncludeDirectories);src;..\..\..\addons\ofxMSAInteractiveObject\src 104 | CompileAsCpp 105 | $(IntDir) 106 | 107 | 108 | true 109 | Console 110 | false 111 | %(AdditionalDependencies) 112 | %(AdditionalLibraryDirectories) 113 | 114 | 115 | 116 | 117 | 118 | Disabled 119 | EnableFastChecks 120 | %(PreprocessorDefinitions) 121 | MultiThreadedDebugDLL 122 | Level3 123 | %(AdditionalIncludeDirectories);src;..\..\..\addons\ofxMSAInteractiveObject\src 124 | CompileAsCpp 125 | true 126 | $(IntDir) 127 | 128 | 129 | true 130 | Console 131 | false 132 | %(AdditionalDependencies) 133 | %(AdditionalLibraryDirectories) 134 | 135 | 136 | 137 | 138 | 139 | false 140 | %(PreprocessorDefinitions) 141 | MultiThreadedDLL 142 | Level3 143 | %(AdditionalIncludeDirectories);src;..\..\..\addons\ofxMSAInteractiveObject\src 144 | CompileAsCpp 145 | true 146 | $(IntDir) 147 | 148 | 149 | false 150 | false 151 | Console 152 | true 153 | true 154 | false 155 | %(AdditionalDependencies) 156 | %(AdditionalLibraryDirectories) 157 | 158 | 159 | 160 | 161 | 162 | false 163 | %(PreprocessorDefinitions) 164 | MultiThreadedDLL 165 | Level3 166 | %(AdditionalIncludeDirectories);src;..\..\..\addons\ofxMSAInteractiveObject\src 167 | CompileAsCpp 168 | $(IntDir) 169 | 170 | 171 | false 172 | false 173 | Console 174 | true 175 | true 176 | false 177 | %(AdditionalDependencies) 178 | %(AdditionalLibraryDirectories) 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | {5837595d-aca9-485c-8e76-729040ce4b0b} 195 | 196 | 197 | 198 | 199 | /D_DEBUG %(AdditionalOptions) 200 | /D_DEBUG %(AdditionalOptions) 201 | $(OF_ROOT)\libs\openFrameworksCompiled\project\vs 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | -------------------------------------------------------------------------------- /example/src/MyTestObject.h: -------------------------------------------------------------------------------- 1 | /******** Test sample for ofxInteractiveObject ********/ 2 | /******** Make sure you open your console to see all the events being output ********/ 3 | 4 | 5 | #pragma once 6 | 7 | #include "ofxMSAInteractiveObject.h" 8 | 9 | #define IDLE_COLOR 0xFFFFFF 10 | #define OVER_COLOR 0x00FF00 11 | #define DOWN_COLOR 0xFF0000 12 | 13 | 14 | class MyTestObject : public ofxMSAInteractiveObject { 15 | public: 16 | void setup() { 17 | printf("MyTestObject::setup() - hello!\n"); 18 | enableMouseEvents(); 19 | enableKeyEvents(); 20 | } 21 | 22 | 23 | void exit() { 24 | printf("MyTestObject::exit() - goodbye!\n"); 25 | } 26 | 27 | 28 | void update() { 29 | // x = ofGetWidth()/2 + cos(ofGetElapsedTimef() * 0.2) * ofGetWidth()/4; 30 | // y = ofGetHeight()/2 + sin(ofGetElapsedTimef() * 0.2) * ofGetHeight()/4; 31 | } 32 | 33 | 34 | void draw() { 35 | if(isMousePressed()) ofSetHexColor(DOWN_COLOR); 36 | else if(isMouseOver()) ofSetHexColor(OVER_COLOR); 37 | else ofSetHexColor(IDLE_COLOR); 38 | 39 | ofRect(x, y, width, height); 40 | } 41 | 42 | virtual void onRollOver(int x, int y) { 43 | printf("MyTestObject::onRollOver(x: %i, y: %i)\n", x, y); 44 | } 45 | 46 | virtual void onRollOut() { 47 | printf("MyTestObject::onRollOut()\n"); 48 | } 49 | 50 | virtual void onMouseMove(int x, int y){ 51 | printf("MyTestObject::onMouseMove(x: %i, y: %i)\n", x, y); 52 | } 53 | 54 | virtual void onDragOver(int x, int y, int button) { 55 | printf("MyTestObject::onDragOver(x: %i, y: %i, button: %i)\n", x, y, button); 56 | } 57 | 58 | virtual void onDragOutside(int x, int y, int button) { 59 | printf("MyTestObject::onDragOutside(x: %i, y: %i, button: %i)\n", x, y, button); 60 | } 61 | 62 | virtual void onPress(int x, int y, int button) { 63 | printf("MyTestObject::onPress(x: %i, y: %i, button: %i)\n", x, y, button); 64 | } 65 | 66 | virtual void onRelease(int x, int y, int button) { 67 | printf("MyTestObject::onRelease(x: %i, y: %i, button: %i)\n", x, y, button); 68 | } 69 | 70 | virtual void onReleaseOutside(int x, int y, int button) { 71 | printf("MyTestObject::onReleaseOutside(x: %i, y: %i, button: %i)\n", x, y, button); 72 | } 73 | 74 | virtual void keyPressed(int key) { 75 | printf("MyTestObject::keyPressed(key: %i)\n", key); 76 | } 77 | 78 | virtual void keyReleased(int key) { 79 | printf("MyTestObject::keyReleased(key: %i)\n", key); 80 | } 81 | 82 | }; -------------------------------------------------------------------------------- /example/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ofMain.h" 2 | #include "ofApp.h" 3 | 4 | //======================================================================== 5 | int main( ){ 6 | ofSetupOpenGL(600,400, OF_WINDOW); // <-------- setup the GL context 7 | ofRunApp(new testApp); 8 | } 9 | -------------------------------------------------------------------------------- /example/src/ofApp.cpp: -------------------------------------------------------------------------------- 1 | #include "ofApp.h" 2 | 3 | void testApp::setup(){ 4 | obj.set(300, 50, 100, 200); 5 | } 6 | 7 | void testApp::draw() { 8 | stringstream s; 9 | s << "isMouseOver: " << obj.isMouseOver() << endl; 10 | s << "isMousePressed(0): " << obj.isMousePressed(0) << endl; 11 | s << "isMousePressed(1): " << obj.isMousePressed(1) << endl; 12 | s << "isMousePressed(2): " << obj.isMousePressed(2) << endl; 13 | s << "getStateChangeMillis(): " << obj.getStateChangeMillis() << endl; 14 | 15 | ofSetColor(0); 16 | ofDrawBitmapString(s.str(), 10, 30); 17 | } 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /example/src/ofApp.h: -------------------------------------------------------------------------------- 1 | #ifndef _TEST_APP 2 | #define _TEST_APP 3 | 4 | 5 | #include "ofMain.h" 6 | 7 | #include "MyTestObject.h" 8 | 9 | class testApp : public ofBaseApp { 10 | 11 | public: 12 | 13 | MyTestObject obj; 14 | void setup(); 15 | void draw(); 16 | }; 17 | 18 | #endif 19 | 20 | -------------------------------------------------------------------------------- /license.md: -------------------------------------------------------------------------------- 1 | The code in this repository is available under the [MIT License](https://secure.wikimedia.org/wikipedia/en/wiki/Mit_license). 2 | 3 | Copyright (c) 2008-2012 Memo Akten, [www.memo.tv](http://www.memo.tv) 4 | The Mega Super Awesome Visuals Company 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 7 | 8 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 9 | 10 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /src/ofxMSAInteractiveObject.cpp: -------------------------------------------------------------------------------- 1 | // __ 2 | // ____ ___ ___ ____ ___ ____ / /__ __ 3 | // / __ `__ \/ _ \/ __ `__ \/ __ \ / __/ | / / 4 | // / / / / / / __/ / / / / / /_/ // /_ | |/ / 5 | // /_/ /_/ /_/\___/_/ /_/ /_/\____(_)__/ |___/ 6 | // 7 | // 8 | // Created by Memo Akten, www.memo.tv 9 | // 10 | // 11 | 12 | #include "ofxMSAInteractiveObject.h" 13 | #include "ofMain.h" 14 | 15 | //-------------------------------------------------------------- 16 | ofxMSAInteractiveObject::ofxMSAInteractiveObject() { 17 | _isMouseOver = false; 18 | enabled = true; 19 | verbose = false; 20 | _stateChangeTimestampMillis = 0; 21 | 22 | enableAppEvents(); 23 | disableMouseEvents(); 24 | disableKeyEvents(); 25 | } 26 | 27 | //-------------------------------------------------------------- 28 | ofxMSAInteractiveObject::~ofxMSAInteractiveObject() { 29 | disableAllEvents(); 30 | } 31 | 32 | //-------------------------------------------------------------- 33 | void ofxMSAInteractiveObject::enableAllEvents() { 34 | enableMouseEvents(); 35 | enableKeyEvents(); 36 | enableAppEvents(); 37 | } 38 | 39 | //-------------------------------------------------------------- 40 | void ofxMSAInteractiveObject::disableAllEvents() { 41 | disableMouseEvents(); 42 | disableKeyEvents(); 43 | disableAppEvents(); 44 | } 45 | 46 | 47 | //-------------------------------------------------------------- 48 | void ofxMSAInteractiveObject::enableMouseEvents() { 49 | ofAddListener(ofEvents().mousePressed, this, &ofxMSAInteractiveObject::_mousePressed); 50 | ofAddListener(ofEvents().mouseMoved, this, &ofxMSAInteractiveObject::_mouseMoved); 51 | ofAddListener(ofEvents().mouseDragged, this, &ofxMSAInteractiveObject::_mouseDragged); 52 | ofAddListener(ofEvents().mouseReleased, this, &ofxMSAInteractiveObject::_mouseReleased); 53 | } 54 | 55 | //-------------------------------------------------------------- 56 | void ofxMSAInteractiveObject::disableMouseEvents() { 57 | ofRemoveListener(ofEvents().mousePressed, this, &ofxMSAInteractiveObject::_mousePressed); 58 | ofRemoveListener(ofEvents().mouseMoved, this, &ofxMSAInteractiveObject::_mouseMoved); 59 | ofRemoveListener(ofEvents().mouseDragged, this, &ofxMSAInteractiveObject::_mouseDragged); 60 | ofRemoveListener(ofEvents().mouseReleased, this, &ofxMSAInteractiveObject::_mouseReleased); 61 | } 62 | 63 | //-------------------------------------------------------------- 64 | void ofxMSAInteractiveObject::enableKeyEvents() { 65 | ofAddListener(ofEvents().keyPressed, this, &ofxMSAInteractiveObject::_keyPressed); 66 | ofAddListener(ofEvents().keyReleased, this, &ofxMSAInteractiveObject::_keyReleased); 67 | } 68 | 69 | //-------------------------------------------------------------- 70 | void ofxMSAInteractiveObject::disableKeyEvents() { 71 | ofRemoveListener(ofEvents().keyPressed, this, &ofxMSAInteractiveObject::_keyPressed); 72 | ofRemoveListener(ofEvents().keyReleased, this, &ofxMSAInteractiveObject::_keyReleased); 73 | } 74 | 75 | //-------------------------------------------------------------- 76 | void ofxMSAInteractiveObject::enableAppEvents() { 77 | ofAddListener(ofEvents().setup, this, &ofxMSAInteractiveObject::_setup); 78 | ofAddListener(ofEvents().update, this, &ofxMSAInteractiveObject::_update); 79 | ofAddListener(ofEvents().draw, this, &ofxMSAInteractiveObject::_draw); 80 | ofAddListener(ofEvents().exit, this, &ofxMSAInteractiveObject::_exit); 81 | } 82 | 83 | //-------------------------------------------------------------- 84 | void ofxMSAInteractiveObject::disableAppEvents() { 85 | ofRemoveListener(ofEvents().setup, this, &ofxMSAInteractiveObject::_setup); 86 | ofRemoveListener(ofEvents().update, this, &ofxMSAInteractiveObject::_update); 87 | ofRemoveListener(ofEvents().draw, this, &ofxMSAInteractiveObject::_draw); 88 | ofRemoveListener(ofEvents().exit, this, &ofxMSAInteractiveObject::_exit); 89 | } 90 | 91 | 92 | //-------------------------------------------------------------- 93 | //void ofxMSAInteractiveObject::setPosition(float _x, float _y) { 94 | // x = _x; 95 | // y = _y; 96 | //} 97 | 98 | //-------------------------------------------------------------- 99 | void ofxMSAInteractiveObject::setSize(float _w, float _h) { 100 | width = _w; 101 | height = _h; 102 | } 103 | 104 | //-------------------------------------------------------------- 105 | //void ofxMSAInteractiveObject::setPosAndSize(float _x, float _y, float _w, float _h) { 106 | // setPosition(_x, _y); 107 | // setSize(_w, _h); 108 | //} 109 | 110 | //-------------------------------------------------------------- 111 | bool ofxMSAInteractiveObject::isMouseOver() const { 112 | return _isMouseOver; 113 | } 114 | 115 | //-------------------------------------------------------------- 116 | bool ofxMSAInteractiveObject::isMousePressed(int mouseButton) const { 117 | if(_isMousePressed.find(mouseButton) == _isMousePressed.end()) return false; 118 | return _isMousePressed.at(mouseButton); 119 | } 120 | 121 | 122 | //-------------------------------------------------------------- 123 | int ofxMSAInteractiveObject::getMouseX() const { 124 | return ofGetMouseX(); 125 | } 126 | 127 | //-------------------------------------------------------------- 128 | int ofxMSAInteractiveObject::getMouseY() const { 129 | return ofGetMouseY(); 130 | } 131 | 132 | //-------------------------------------------------------------- 133 | unsigned long ofxMSAInteractiveObject::getStateChangeMillis() const { 134 | return ofGetElapsedTimeMillis() - _stateChangeTimestampMillis; 135 | } 136 | 137 | //-------------------------------------------------------------- 138 | bool ofxMSAInteractiveObject::hitTest(int tx, int ty) const { 139 | return ((tx > x) && (tx < x + width) && (ty > y) && (ty < y + height)); 140 | } 141 | 142 | 143 | 144 | //-------------------------------------------------------------- 145 | void ofxMSAInteractiveObject::_setup(ofEventArgs &e) { 146 | if(!enabled) return; 147 | setup(); 148 | } 149 | 150 | //-------------------------------------------------------------- 151 | void ofxMSAInteractiveObject::_update(ofEventArgs &e) { 152 | if(!enabled) return; 153 | 154 | // check to see if object has moved, and if so update mouse events 155 | // if(oldRect.x != this->x || oldRect.y != this->y || oldRect.width != this->width ||oldRect.height != this->height) { 156 | // ofMouseEventArgs e; 157 | // e.button = _mouseButton; 158 | // e.x = _mouseX; 159 | // e.y = _mouseY; 160 | // if(_isMousePressed) _mouseDragged(e); 161 | // else _mouseMoved(e); 162 | // 163 | // oldRect = (ofRectangle) (*this); 164 | // } 165 | update(); 166 | } 167 | 168 | //-------------------------------------------------------------- 169 | void ofxMSAInteractiveObject::_draw(ofEventArgs &e) { 170 | if(!enabled) return; 171 | draw(); 172 | } 173 | 174 | //-------------------------------------------------------------- 175 | void ofxMSAInteractiveObject::_exit(ofEventArgs &e) { 176 | if(!enabled) return; 177 | exit(); 178 | } 179 | 180 | 181 | //-------------------------------------------------------------- 182 | void ofxMSAInteractiveObject::_mouseMoved(ofMouseEventArgs &e) { 183 | int x = e.x; 184 | int y = e.y; 185 | int button = e.button; 186 | if(verbose) printf("ofxMSAInteractiveObject::_mouseMoved(x: %i, y: %i)\n", x, y); 187 | if(!enabled) return; 188 | 189 | // _mouseX = x; 190 | // _mouseY = y; 191 | 192 | if(hitTest(x, y)) { // if mouse is over the object 193 | if(!_isMouseOver) { // if wasn't over previous frame 194 | _isMouseOver = true; // update flag 195 | onRollOver(x, y); // call onRollOver 196 | } 197 | onMouseMove(x, y); // and trigger onMouseMove 198 | } else if(_isMouseOver) { // if mouse is not over the object, but the flag is true (From previous frame) 199 | onRollOut(); // call onRollOut 200 | _isMouseOver = false; // update flag 201 | } 202 | 203 | _stateChangeTimestampMillis = ofGetElapsedTimeMillis(); 204 | 205 | mouseMoved(x, y); 206 | } 207 | 208 | 209 | //-------------------------------------------------------------- 210 | void ofxMSAInteractiveObject::_mousePressed(ofMouseEventArgs &e) { 211 | int x = e.x; 212 | int y = e.y; 213 | int button = e.button; 214 | 215 | if(verbose) printf("ofxMSAInteractiveObject::_mousePressed(x: %i, y: %i, button: %i)\n", x, y, button); 216 | if(!enabled) { 217 | _isMousePressed[button] = false; 218 | return; 219 | } 220 | 221 | if(hitTest(x, y)) { // if mouse is over 222 | if(!isMousePressed(button)) { // if wasn't down previous frame 223 | _isMousePressed[button] = true; // update flag 224 | onPress(x, y, button); // call onPress 225 | } 226 | } else { // if mouse is not over 227 | _isMousePressed[button] = false; // update flag 228 | onPressOutside(x, y, button); 229 | } 230 | 231 | _stateChangeTimestampMillis = ofGetElapsedTimeMillis(); 232 | 233 | mousePressed(x, y, button); 234 | } 235 | 236 | //-------------------------------------------------------------- 237 | void ofxMSAInteractiveObject::_mouseDragged(ofMouseEventArgs &e) { 238 | int x = e.x; 239 | int y = e.y; 240 | int button = e.button; 241 | 242 | if(verbose) printf("ofxMSAInteractiveObject::_mouseDragged(x: %i, y: %i, button: %i)\n", x, y, button); 243 | if(!enabled) { 244 | _isMousePressed[button] = false; 245 | return; 246 | } 247 | 248 | if(hitTest(x, y)) { // if mouse is over the object 249 | if(!_isMouseOver) { // if wasn't over previous frame 250 | // onPress(x, y); // call onPress - maybe not 251 | _isMouseOver = true; // update flag 252 | onRollOver(x, y); // call onRollOver 253 | } 254 | onDragOver(x, y, button); // and trigger onDragOver 255 | } else { 256 | if(_isMouseOver) { // if mouse is not over the object, but the flag is true (From previous frame) 257 | onRollOut(); // call onRollOut 258 | _isMouseOver = false; // update flag 259 | } 260 | if(isMousePressed(button)) { 261 | onDragOutside(x, y, button); 262 | } 263 | _isMousePressed[button] = false; 264 | } 265 | 266 | _stateChangeTimestampMillis = ofGetElapsedTimeMillis(); 267 | 268 | mouseDragged(x, y, button); 269 | } 270 | 271 | //-------------------------------------------------------------- 272 | void ofxMSAInteractiveObject::_mouseReleased(ofMouseEventArgs &e) { 273 | int x = e.x; 274 | int y = e.y; 275 | int button = e.button; 276 | 277 | if(verbose) printf("ofxMSAInteractiveObject::_mouseReleased(x: %i, y: %i, button: %i)\n", x, y, button); 278 | if(!enabled) { 279 | _isMousePressed[button] = false; 280 | return; 281 | } 282 | 283 | if(hitTest(x, y)) { 284 | onRelease(x, y, button); 285 | } else { 286 | if(isMousePressed(button)) onReleaseOutside(x, y, button); 287 | } 288 | _isMousePressed[button] = false; 289 | 290 | _stateChangeTimestampMillis = ofGetElapsedTimeMillis(); 291 | 292 | mouseReleased(x, y, button); 293 | } 294 | 295 | 296 | //-------------------------------------------------------------- 297 | void ofxMSAInteractiveObject::_keyPressed(ofKeyEventArgs &e) { 298 | int key = e.key; 299 | if(verbose) printf("ofxMSAInteractiveObject::_keyPressed(key: %i)\n", key); 300 | if(!enabled) return; 301 | if(isMouseOver()) onKeyPress(key); 302 | keyPressed(key); 303 | } 304 | 305 | 306 | //-------------------------------------------------------------- 307 | void ofxMSAInteractiveObject::_keyReleased(ofKeyEventArgs &e) { 308 | int key = e.key; 309 | if(verbose) printf("ofxMSAInteractiveObject::_keyReleased(key: %i)\n", key); 310 | if(!enabled) return; 311 | if(isMouseOver()) onKeyRelease(key); 312 | keyReleased(key); 313 | } 314 | -------------------------------------------------------------------------------- /src/ofxMSAInteractiveObject.h: -------------------------------------------------------------------------------- 1 | // __ 2 | // ____ ___ ___ ____ ___ ____ / /__ __ 3 | // / __ `__ \/ _ \/ __ `__ \/ __ \ / __/ | / / 4 | // / / / / / / __/ / / / / / /_/ // /_ | |/ / 5 | // /_/ /_/ /_/\___/_/ /_/ /_/\____(_)__/ |___/ 6 | // 7 | // 8 | // Created by Memo Akten, www.memo.tv 9 | // 10 | // 11 | 12 | #pragma once 13 | 14 | #include "ofMain.h" 15 | 16 | 17 | class ofxMSAInteractiveObject : public ofRectangle { 18 | public: 19 | bool enabled; // set this to false to temporarily disable all events 20 | bool verbose; 21 | 22 | ofxMSAInteractiveObject(); // constructor 23 | virtual ~ofxMSAInteractiveObject(); // destructor 24 | 25 | void enableAllEvents(); // enable all event callbacks 26 | void disableAllEvents(); // disable all event callbacks 27 | 28 | void enableMouseEvents(); // call this if object should receive mouse events 29 | void disableMouseEvents(); // call this if object doesn't need to receive mouse events (default) 30 | 31 | void enableKeyEvents(); // call this if object should receive key events 32 | void disableKeyEvents(); // call this if object doesn't need to receive key events (default) 33 | 34 | void enableAppEvents(); // call this if object should update/draw automatically (default) 35 | void disableAppEvents(); // call this if object doesn't need to update/draw automatically 36 | 37 | 38 | // void setPosition(float _x, float _y); // replaced with ofRectangle::setPosition 39 | void setSize(float _w, float _h); // set size of object 40 | // void setPosAndSize(float _x, float _y, float _w, float _h); // replaced with ofRectangle::set 41 | 42 | 43 | bool isMouseOver() const; // returns true if mouse is over object (based on position and size) 44 | bool isMousePressed(int mouseButton=0) const; // returns true if mouse button is down and was pressed over object (based on position and size) 45 | 46 | 47 | int getMouseX() const; // returns mouse X (in screen coordinates) 48 | int getMouseY() const; // returns mouse Y (in screen coordinates) 49 | 50 | unsigned long getStateChangeMillis() const; // returns milliseconds since last state change 51 | 52 | virtual bool hitTest(int tx, int ty) const; // returns true if given (x, y) coordinates (in screen space) are over the object (based on position and size) 53 | 54 | // extend ofxMSAInteractiveObject and override all or any of the following methods 55 | virtual void setup() {} // called when app starts 56 | virtual void update() {} // called every frame to update object 57 | virtual void draw() {} // called every frame to draw object 58 | virtual void exit() {} // called when app quites 59 | 60 | // these behave very similar to those in flash 61 | virtual void onRollOver(int x, int y) {} // called when mouse enters object x, y, width, height 62 | virtual void onRollOut() {} // called when mouse leaves object x, y, width, height 63 | virtual void onMouseMove(int x, int y) {} // called when mouse moves while over object x, y, width, height 64 | virtual void onDragOver(int x, int y, int button) {} // called when mouse moves while over object and button is down 65 | virtual void onDragOutside(int x, int y, int button) {} // called when mouse moves while outside the object after being clicked on it 66 | virtual void onPress(int x, int y, int button) {} // called when mouse presses while over object 67 | virtual void onPressOutside(int x, int y, int button) {} // called when mouse presses while outside object 68 | virtual void onRelease(int x, int y, int button) {} // called when mouse releases while over object 69 | virtual void onReleaseOutside(int x, int y, int button) {} // called when mouse releases outside of object after being pressed on object 70 | virtual void onKeyPress(int key) {} // called when keypressed while mouse over the object 71 | virtual void onKeyRelease(int key) {} // called when keyreleased while mouse over the object 72 | 73 | 74 | // these are called when the relevant event occurs without caring where it actually happened 75 | // i.e. its the raw event 76 | virtual void mouseMoved(int x, int y) {} // called when mouse moves anywhere 77 | virtual void mousePressed(int x, int y, int button) {} // called when mouse pressed anywhere 78 | virtual void mouseDragged(int x, int y, int button) {} // called when mouse dragged anywhere 79 | virtual void mouseReleased(int x, int y, int button) {} // called when mouse released anywhere 80 | 81 | virtual void keyPressed(int key) {} // called when keypressed anywhere 82 | virtual void keyReleased(int key) {} // called when keyreleased anywhere 83 | 84 | 85 | // you shouldn't need access to any of these unless you know what you are doing 86 | // (i.e. disable auto updates and call these manually) 87 | void _setup(ofEventArgs &e); 88 | void _update(ofEventArgs &e); 89 | void _draw(ofEventArgs &e); 90 | void _exit(ofEventArgs &e); 91 | 92 | void _mouseMoved(ofMouseEventArgs &e); 93 | void _mousePressed(ofMouseEventArgs &e); 94 | void _mouseDragged(ofMouseEventArgs &e); 95 | void _mouseReleased(ofMouseEventArgs &e); 96 | 97 | void _keyPressed(ofKeyEventArgs &e); 98 | void _keyReleased(ofKeyEventArgs &e); 99 | 100 | private: 101 | bool _isMouseOver; // is mouse over the rect 102 | std::map _isMousePressed; // is mouse down over the rect (for any given mouse button) 103 | unsigned long _stateChangeTimestampMillis; 104 | ofRectangle oldRect; 105 | }; 106 | 107 | --------------------------------------------------------------------------------