├── .gitignore ├── 00_Rectangles ├── 00_Rectangles_Step1 │ ├── 00_Rectangles.sln │ ├── 00_Rectangles.vcxproj │ ├── 00_Rectangles.vcxproj.filters │ ├── 00_Rectangles.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── 00_Rectangles Debug.xcscheme │ │ │ └── 00_Rectangles Release.xcscheme │ ├── Makefile │ ├── Project.xcconfig │ ├── addons.make │ ├── config.make │ ├── icon.rc │ ├── openFrameworks-Info.plist │ └── src │ │ ├── main.cpp │ │ ├── ofApp.cpp │ │ └── ofApp.h ├── 00_Rectangles_Step2 │ ├── 00_Rectangles.sln │ ├── 00_Rectangles.vcxproj │ ├── 00_Rectangles.vcxproj.filters │ ├── 00_Rectangles.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── 00_Rectangles Debug.xcscheme │ │ │ └── 00_Rectangles Release.xcscheme │ ├── Makefile │ ├── Project.xcconfig │ ├── addons.make │ ├── config.make │ ├── icon.rc │ ├── openFrameworks-Info.plist │ └── src │ │ ├── Shapes │ │ ├── Rectangle.cpp │ │ └── Rectangle.h │ │ ├── main.cpp │ │ ├── ofApp.cpp │ │ └── ofApp.h ├── 00_Rectangles_Step3 │ ├── 00_Rectangles.sln │ ├── 00_Rectangles.vcxproj │ ├── 00_Rectangles.vcxproj.filters │ ├── 00_Rectangles.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── 00_Rectangles Debug.xcscheme │ │ │ └── 00_Rectangles Release.xcscheme │ ├── Makefile │ ├── Project.xcconfig │ ├── addons.make │ ├── config.make │ ├── icon.rc │ ├── openFrameworks-Info.plist │ └── src │ │ ├── Shapes │ │ ├── Rectangle.cpp │ │ └── Rectangle.h │ │ ├── main.cpp │ │ ├── ofApp.cpp │ │ └── ofApp.h ├── 00_Rectangles_Step4 │ ├── 00_Rectangles.sln │ ├── 00_Rectangles.vcxproj │ ├── 00_Rectangles.vcxproj.filters │ ├── 00_Rectangles.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── 00_Rectangles Debug.xcscheme │ │ │ └── 00_Rectangles Release.xcscheme │ ├── Makefile │ ├── Project.xcconfig │ ├── addons.make │ ├── config.make │ ├── icon.rc │ ├── openFrameworks-Info.plist │ └── src │ │ ├── Shapes │ │ ├── Rectangle.cpp │ │ └── Rectangle.h │ │ ├── main.cpp │ │ ├── ofApp.cpp │ │ └── ofApp.h └── readme.md ├── 01_Elements ├── 01_Elements_Step1 │ ├── 01_Elements.sln │ ├── 01_Elements.vcxproj │ ├── 01_Elements.vcxproj.filters │ ├── 01_Elements.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── 01_Elements Debug.xcscheme │ │ │ └── 01_Elements Release.xcscheme │ ├── Makefile │ ├── Project.xcconfig │ ├── addons.make │ ├── config.make │ ├── icon.rc │ ├── openFrameworks-Info.plist │ └── src │ │ ├── Elements │ │ ├── Base.cpp │ │ └── Base.h │ │ ├── main.cpp │ │ ├── ofApp.cpp │ │ └── ofApp.h ├── 01_Elements_Step2 │ ├── 01_Elements.sln │ ├── 01_Elements.vcxproj │ ├── 01_Elements.vcxproj.filters │ ├── 01_Elements.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── 01_Elements Debug.xcscheme │ │ │ └── 01_Elements Release.xcscheme │ ├── Makefile │ ├── Project.xcconfig │ ├── addons.make │ ├── config.make │ ├── icon.rc │ ├── openFrameworks-Info.plist │ └── src │ │ ├── Elements │ │ ├── Base.cpp │ │ ├── Base.h │ │ ├── Button.cpp │ │ ├── Button.h │ │ ├── Text.cpp │ │ └── Text.h │ │ ├── main.cpp │ │ ├── ofApp.cpp │ │ └── ofApp.h ├── 01_Elements_Step3 │ ├── 01_Elements.sln │ ├── 01_Elements.vcxproj │ ├── 01_Elements.vcxproj.filters │ ├── 01_Elements.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── 01_Elements Debug.xcscheme │ │ │ └── 01_Elements Release.xcscheme │ ├── Makefile │ ├── Project.xcconfig │ ├── addons.make │ ├── config.make │ ├── icon.rc │ ├── openFrameworks-Info.plist │ └── src │ │ ├── Elements │ │ ├── Base.cpp │ │ ├── Base.h │ │ ├── Button.cpp │ │ ├── Button.h │ │ ├── Text.cpp │ │ └── Text.h │ │ ├── main.cpp │ │ ├── ofApp.cpp │ │ └── ofApp.h ├── 01_Elements_Step4 │ ├── 01_Elements.sln │ ├── 01_Elements.vcxproj │ ├── 01_Elements.vcxproj.filters │ ├── 01_Elements.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── 01_Elements Debug.xcscheme │ │ │ └── 01_Elements Release.xcscheme │ ├── Makefile │ ├── Project.xcconfig │ ├── addons.make │ ├── config.make │ ├── icon.rc │ ├── openFrameworks-Info.plist │ └── src │ │ ├── Elements │ │ ├── Base.cpp │ │ ├── Base.h │ │ ├── Button.cpp │ │ ├── Button.h │ │ ├── Text.cpp │ │ └── Text.h │ │ ├── main.cpp │ │ ├── ofApp.cpp │ │ └── ofApp.h ├── 01_Elements_Step5 │ ├── 01_Elements.sln │ ├── 01_Elements.vcxproj │ ├── 01_Elements.vcxproj.filters │ ├── 01_Elements.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── 01_Elements Debug.xcscheme │ │ │ └── 01_Elements Release.xcscheme │ ├── Makefile │ ├── Project.xcconfig │ ├── addons.make │ ├── config.make │ ├── icon.rc │ ├── openFrameworks-Info.plist │ └── src │ │ ├── Elements │ │ ├── Base.cpp │ │ ├── Base.h │ │ ├── Button.cpp │ │ ├── Button.h │ │ ├── Text.cpp │ │ └── Text.h │ │ ├── main.cpp │ │ ├── ofApp.cpp │ │ └── ofApp.h └── readme.md ├── 02_ofxCvGui ├── 02_ofxCvGui_Step1 │ ├── 02_ofxCvGui.sln │ ├── 02_ofxCvGui.vcxproj │ ├── 02_ofxCvGui.vcxproj.filters │ ├── 02_ofxCvGui.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── 02_ofxCvGui Debug.xcscheme │ │ │ └── 02_ofxCvGui Release.xcscheme │ ├── Makefile │ ├── Project.xcconfig │ ├── addons.make │ ├── config.make │ ├── icon.rc │ ├── openFrameworks-Info.plist │ └── src │ │ ├── main.cpp │ │ ├── ofApp.cpp │ │ └── ofApp.h ├── 02_ofxCvGui_Step2 │ ├── 02_ofxCvGui.sln │ ├── 02_ofxCvGui.vcxproj │ ├── 02_ofxCvGui.vcxproj.filters │ ├── 02_ofxCvGui.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── 02_ofxCvGui Debug.xcscheme │ │ │ └── 02_ofxCvGui Release.xcscheme │ ├── Makefile │ ├── Project.xcconfig │ ├── addons.make │ ├── config.make │ ├── icon.rc │ ├── openFrameworks-Info.plist │ └── src │ │ ├── main.cpp │ │ ├── ofApp.cpp │ │ └── ofApp.h ├── 02_ofxCvGui_Step3 │ ├── 02_ofxCvGui.sln │ ├── 02_ofxCvGui.vcxproj │ ├── 02_ofxCvGui.vcxproj.filters │ ├── 02_ofxCvGui.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── 02_ofxCvGui Debug.xcscheme │ │ │ └── 02_ofxCvGui Release.xcscheme │ ├── Makefile │ ├── Project.xcconfig │ ├── addons.make │ ├── config.make │ ├── icon.rc │ ├── openFrameworks-Info.plist │ └── src │ │ ├── main.cpp │ │ ├── ofApp.cpp │ │ └── ofApp.h ├── 02_ofxCvGui_Step4 │ ├── 02_ofxCvGui.sln │ ├── 02_ofxCvGui.vcxproj │ ├── 02_ofxCvGui.vcxproj.filters │ ├── 02_ofxCvGui.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── 02_ofxCvGui Debug.xcscheme │ │ │ └── 02_ofxCvGui Release.xcscheme │ ├── Makefile │ ├── Project.xcconfig │ ├── addons.make │ ├── bin │ │ └── data │ │ │ └── instructions.txt │ ├── config.make │ ├── icon.rc │ ├── openFrameworks-Info.plist │ └── src │ │ ├── main.cpp │ │ ├── ofApp.cpp │ │ └── ofApp.h └── readme.md └── 03_ofxCvGuiAdvanced ├── 03_ofxCvGuiAdvanced_Step0 ├── 03_ofxCvGuiAdvanced.sln ├── 03_ofxCvGuiAdvanced.vcxproj ├── 03_ofxCvGuiAdvanced.vcxproj.filters ├── 03_ofxCvGuiAdvanced.xcodeproj │ ├── project.pbxproj │ └── xcshareddata │ │ └── xcschemes │ │ ├── 03_ofxCvGuiAdvanced Debug.xcscheme │ │ └── 03_ofxCvGuiAdvanced Release.xcscheme ├── Makefile ├── Project.xcconfig ├── addons.make ├── config.make ├── icon.rc ├── openFrameworks-Info.plist └── src │ ├── main.cpp │ ├── ofApp.cpp │ └── ofApp.h ├── 03_ofxCvGuiAdvanced_Step1 ├── 03_ofxCvGuiAdvanced.sln ├── 03_ofxCvGuiAdvanced.vcxproj ├── 03_ofxCvGuiAdvanced.vcxproj.filters ├── 03_ofxCvGuiAdvanced.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── 03_ofxCvGuiAdvanced.xcscmblueprint │ └── xcshareddata │ │ └── xcschemes │ │ ├── 03_ofxCvGuiAdvanced Debug.xcscheme │ │ └── 03_ofxCvGuiAdvanced Release.xcscheme ├── Makefile ├── Project.xcconfig ├── addons.make ├── config.make ├── icon.rc ├── openFrameworks-Info.plist └── src │ ├── main.cpp │ ├── ofApp.cpp │ └── ofApp.h ├── 03_ofxCvGuiAdvanced_Step2 ├── 03_ofxCvGuiAdvanced.sln ├── 03_ofxCvGuiAdvanced.vcxproj ├── 03_ofxCvGuiAdvanced.vcxproj.filters ├── 03_ofxCvGuiAdvanced.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── 03_ofxCvGuiAdvanced.xcscmblueprint │ └── xcshareddata │ │ └── xcschemes │ │ ├── 03_ofxCvGuiAdvanced Debug.xcscheme │ │ └── 03_ofxCvGuiAdvanced Release.xcscheme ├── Makefile ├── Project.xcconfig ├── addons.make ├── config.make ├── icon.rc ├── openFrameworks-Info.plist └── src │ ├── main.cpp │ ├── ofApp.cpp │ └── ofApp.h ├── 03_ofxCvGuiAdvanced_Step3 ├── 03_ofxCvGuiAdvanced.sln ├── 03_ofxCvGuiAdvanced.vcxproj ├── 03_ofxCvGuiAdvanced.vcxproj.filters ├── 03_ofxCvGuiAdvanced.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── 03_ofxCvGuiAdvanced.xcscmblueprint │ └── xcshareddata │ │ └── xcschemes │ │ ├── 03_ofxCvGuiAdvanced Debug.xcscheme │ │ └── 03_ofxCvGuiAdvanced Release.xcscheme ├── Makefile ├── Project.xcconfig ├── addons.make ├── config.make ├── icon.rc ├── openFrameworks-Info.plist └── src │ ├── main.cpp │ ├── ofApp.cpp │ └── ofApp.h ├── 03_ofxCvGuiAdvanced_Step4 ├── 03_ofxCvGuiAdvanced.sln ├── 03_ofxCvGuiAdvanced.vcxproj ├── 03_ofxCvGuiAdvanced.vcxproj.filters ├── 03_ofxCvGuiAdvanced.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── 03_ofxCvGuiAdvanced.xcscmblueprint │ └── xcshareddata │ │ └── xcschemes │ │ ├── 03_ofxCvGuiAdvanced Debug.xcscheme │ │ └── 03_ofxCvGuiAdvanced Release.xcscheme ├── Makefile ├── Project.xcconfig ├── addons.make ├── config.make ├── icon.rc ├── openFrameworks-Info.plist └── src │ ├── main.cpp │ ├── ofApp.cpp │ └── ofApp.h └── readme.md /.gitignore: -------------------------------------------------------------------------------- 1 | libs/ 2 | docs/ 3 | 4 | *.depend 5 | *.layout 6 | *.mode*v3 7 | *.pbxuser 8 | *.app* 9 | *.DS_* 10 | ._*.* 11 | 12 | .svn/ 13 | obj/ 14 | bin/ 15 | build/ 16 | !data/ 17 | xcuserdata/ 18 | 19 | ipch/ 20 | *.suo 21 | *.opensdf 22 | *.vcxproj.user 23 | 24 | *.obj 25 | *.tlog 26 | *.sdf 27 | *.pdb 28 | *.idb 29 | *.pch 30 | Debug/ 31 | Release/ 32 | 33 | 34 | *~.xml 35 | 36 | Sketch*/ -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step1/00_Rectangles.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 14 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "00_Rectangles", "00_Rectangles.vcxproj", "{7FD42DF7-442E-479A-BA76-D0022F99702A}" 4 | EndProject 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openframeworksLib", "..\..\..\..\of_v0.9.0_vs_release\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 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step1/00_Rectangles.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | src 6 | 7 | 8 | src 9 | 10 | 11 | src 12 | 13 | 14 | src 15 | 16 | 17 | 18 | 19 | {d8376475-7454-4a24-b08a-aac121d3ad6f} 20 | 21 | 22 | 23 | 24 | src 25 | 26 | 27 | src 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step1/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 ../../../../of_v0.9.0_vs_release) 10 | endif 11 | 12 | # call the project makefile! 13 | include $(OF_ROOT)/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk 14 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step1/Project.xcconfig: -------------------------------------------------------------------------------- 1 | //THE PATH TO THE ROOT OF OUR OF PATH RELATIVE TO THIS PROJECT. 2 | //THIS NEEDS TO BE DEFINED BEFORE CoreOF.xcconfig IS INCLUDED 3 | OF_PATH = ../../../../of_v0.9.0_vs_release 4 | 5 | //THIS HAS ALL THE HEADER AND LIBS FOR OF CORE 6 | #include "../../../../of_v0.9.0_vs_release/libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig" 7 | 8 | //ICONS - NEW IN 0072 9 | ICON_NAME_DEBUG = icon-debug.icns 10 | ICON_NAME_RELEASE = icon.icns 11 | ICON_FILE_PATH = $(OF_PATH)/libs/openFrameworksCompiled/project/osx/ 12 | 13 | //IF YOU WANT AN APP TO HAVE A CUSTOM ICON - PUT THEM IN YOUR DATA FOLDER AND CHANGE ICON_FILE_PATH to: 14 | //ICON_FILE_PATH = bin/data/ 15 | 16 | OTHER_LDFLAGS = $(OF_CORE_LIBS) $(OF_CORE_FRAMEWORKS) 17 | HEADER_SEARCH_PATHS = $(OF_CORE_HEADERS) 18 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step1/addons.make: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elliotwoods/Workshops.ofxRulr.Advanced/3c0b122e381c326df32b8ae988ebdc1671f99b8f/00_Rectangles/00_Rectangles_Step1/addons.make -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step1/icon.rc: -------------------------------------------------------------------------------- 1 | // Icon Resource Definition 2 | #define MAIN_ICON 102 3 | 4 | #if defined(_DEBUG) 5 | MAIN_ICON ICON "icon_debug.ico" 6 | #else 7 | MAIN_ICON ICON "icon.ico" 8 | #endif 9 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step1/openFrameworks-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | cc.openFrameworks.ofapp 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | APPL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | CFBundleIconFile 20 | ${ICON} 21 | 22 | 23 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step1/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ofMain.h" 2 | #include "ofApp.h" 3 | 4 | //======================================================================== 5 | int main( ){ 6 | ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context 7 | 8 | // this kicks off the running of my app 9 | // can be OF_WINDOW or OF_FULLSCREEN 10 | // pass in width and height too: 11 | ofRunApp(new ofApp()); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step1/src/ofApp.cpp: -------------------------------------------------------------------------------- 1 | #include "ofApp.h" 2 | 3 | //-------------------------------------------------------------- 4 | void ofApp::setup(){ 5 | ofBackground(255); 6 | } 7 | 8 | //-------------------------------------------------------------- 9 | void ofApp::update(){ 10 | 11 | } 12 | 13 | //-------------------------------------------------------------- 14 | void ofApp::draw(){ 15 | ofSetColor(0); 16 | ofDrawRectangle(200, 200, 200, 200); 17 | } 18 | 19 | //-------------------------------------------------------------- 20 | void ofApp::keyPressed(int key){ 21 | 22 | } 23 | 24 | //-------------------------------------------------------------- 25 | void ofApp::keyReleased(int key){ 26 | 27 | } 28 | 29 | //-------------------------------------------------------------- 30 | void ofApp::mouseMoved(int x, int y ){ 31 | 32 | } 33 | 34 | //-------------------------------------------------------------- 35 | void ofApp::mouseDragged(int x, int y, int button){ 36 | 37 | } 38 | 39 | //-------------------------------------------------------------- 40 | void ofApp::mousePressed(int x, int y, int button){ 41 | 42 | } 43 | 44 | //-------------------------------------------------------------- 45 | void ofApp::mouseReleased(int x, int y, int button){ 46 | 47 | } 48 | 49 | //-------------------------------------------------------------- 50 | void ofApp::mouseEntered(int x, int y){ 51 | 52 | } 53 | 54 | //-------------------------------------------------------------- 55 | void ofApp::mouseExited(int x, int y){ 56 | 57 | } 58 | 59 | //-------------------------------------------------------------- 60 | void ofApp::windowResized(int w, int h){ 61 | 62 | } 63 | 64 | //-------------------------------------------------------------- 65 | void ofApp::gotMessage(ofMessage msg){ 66 | 67 | } 68 | 69 | //-------------------------------------------------------------- 70 | void ofApp::dragEvent(ofDragInfo dragInfo){ 71 | 72 | } 73 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step1/src/ofApp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofMain.h" 4 | 5 | class ofApp : public ofBaseApp{ 6 | 7 | public: 8 | void setup(); 9 | void update(); 10 | void draw(); 11 | 12 | void keyPressed(int key); 13 | void keyReleased(int key); 14 | void mouseMoved(int x, int y ); 15 | void mouseDragged(int x, int y, int button); 16 | void mousePressed(int x, int y, int button); 17 | void mouseReleased(int x, int y, int button); 18 | void mouseEntered(int x, int y); 19 | void mouseExited(int x, int y); 20 | void windowResized(int w, int h); 21 | void dragEvent(ofDragInfo dragInfo); 22 | void gotMessage(ofMessage msg); 23 | }; 24 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step2/00_Rectangles.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 14 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "00_Rectangles", "00_Rectangles.vcxproj", "{7FD42DF7-442E-479A-BA76-D0022F99702A}" 4 | EndProject 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openframeworksLib", "..\..\..\..\of_v0.9.0_vs_release\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 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step2/00_Rectangles.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | src 6 | 7 | 8 | src 9 | 10 | 11 | src 12 | 13 | 14 | src 15 | 16 | 17 | src\Shapes 18 | 19 | 20 | 21 | 22 | {d8376475-7454-4a24-b08a-aac121d3ad6f} 23 | 24 | 25 | {f17fc8f5-404b-49b3-9dbd-3ff05b697d8d} 26 | 27 | 28 | 29 | 30 | src 31 | 32 | 33 | src 34 | 35 | 36 | src\Shapes 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step2/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 ../../../../of_v0.9.0_vs_release) 10 | endif 11 | 12 | # call the project makefile! 13 | include $(OF_ROOT)/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk 14 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step2/Project.xcconfig: -------------------------------------------------------------------------------- 1 | //THE PATH TO THE ROOT OF OUR OF PATH RELATIVE TO THIS PROJECT. 2 | //THIS NEEDS TO BE DEFINED BEFORE CoreOF.xcconfig IS INCLUDED 3 | OF_PATH = ../../../../of_v0.9.0_vs_release 4 | 5 | //THIS HAS ALL THE HEADER AND LIBS FOR OF CORE 6 | #include "../../../../of_v0.9.0_vs_release/libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig" 7 | 8 | //ICONS - NEW IN 0072 9 | ICON_NAME_DEBUG = icon-debug.icns 10 | ICON_NAME_RELEASE = icon.icns 11 | ICON_FILE_PATH = $(OF_PATH)/libs/openFrameworksCompiled/project/osx/ 12 | 13 | //IF YOU WANT AN APP TO HAVE A CUSTOM ICON - PUT THEM IN YOUR DATA FOLDER AND CHANGE ICON_FILE_PATH to: 14 | //ICON_FILE_PATH = bin/data/ 15 | 16 | OTHER_LDFLAGS = $(OF_CORE_LIBS) $(OF_CORE_FRAMEWORKS) 17 | HEADER_SEARCH_PATHS = $(OF_CORE_HEADERS) 18 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step2/addons.make: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elliotwoods/Workshops.ofxRulr.Advanced/3c0b122e381c326df32b8ae988ebdc1671f99b8f/00_Rectangles/00_Rectangles_Step2/addons.make -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step2/icon.rc: -------------------------------------------------------------------------------- 1 | // Icon Resource Definition 2 | #define MAIN_ICON 102 3 | 4 | #if defined(_DEBUG) 5 | MAIN_ICON ICON "icon_debug.ico" 6 | #else 7 | MAIN_ICON ICON "icon.ico" 8 | #endif 9 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step2/openFrameworks-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | cc.openFrameworks.ofapp 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | APPL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | CFBundleIconFile 20 | ${ICON} 21 | 22 | 23 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step2/src/Shapes/Rectangle.cpp: -------------------------------------------------------------------------------- 1 | #include "Rectangle.h" 2 | 3 | #include "ofMain.h" 4 | 5 | namespace Shapes { 6 | //---------- 7 | void Rectangle::draw() const { 8 | ofPushStyle(); 9 | { 10 | ofSetColor(color); 11 | ofDrawRectangle(bounds); 12 | } 13 | ofPopStyle(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step2/src/Shapes/Rectangle.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofRectangle.h" 4 | #include "ofColor.h" 5 | 6 | namespace Shapes { 7 | struct Rectangle { 8 | void draw() const; 9 | 10 | ofRectangle bounds; 11 | ofColor color; 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step2/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ofMain.h" 2 | #include "ofApp.h" 3 | 4 | //======================================================================== 5 | int main( ){ 6 | ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context 7 | 8 | // this kicks off the running of my app 9 | // can be OF_WINDOW or OF_FULLSCREEN 10 | // pass in width and height too: 11 | ofRunApp(new ofApp()); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step2/src/ofApp.cpp: -------------------------------------------------------------------------------- 1 | #include "ofApp.h" 2 | 3 | //-------------------------------------------------------------- 4 | void ofApp::setup(){ 5 | ofBackground(255); 6 | 7 | this->rectangle = { 8 | ofRectangle(200, 200, 200, 200), 9 | ofColor(0) 10 | }; 11 | } 12 | 13 | //-------------------------------------------------------------- 14 | void ofApp::update(){ 15 | 16 | } 17 | 18 | //-------------------------------------------------------------- 19 | void ofApp::draw(){ 20 | this->rectangle.draw(); 21 | } 22 | 23 | //-------------------------------------------------------------- 24 | void ofApp::keyPressed(int key){ 25 | 26 | } 27 | 28 | //-------------------------------------------------------------- 29 | void ofApp::keyReleased(int key){ 30 | 31 | } 32 | 33 | //-------------------------------------------------------------- 34 | void ofApp::mouseMoved(int x, int y ){ 35 | 36 | } 37 | 38 | //-------------------------------------------------------------- 39 | void ofApp::mouseDragged(int x, int y, int button){ 40 | 41 | } 42 | 43 | //-------------------------------------------------------------- 44 | void ofApp::mousePressed(int x, int y, int button){ 45 | 46 | } 47 | 48 | //-------------------------------------------------------------- 49 | void ofApp::mouseReleased(int x, int y, int button){ 50 | 51 | } 52 | 53 | //-------------------------------------------------------------- 54 | void ofApp::mouseEntered(int x, int y){ 55 | 56 | } 57 | 58 | //-------------------------------------------------------------- 59 | void ofApp::mouseExited(int x, int y){ 60 | 61 | } 62 | 63 | //-------------------------------------------------------------- 64 | void ofApp::windowResized(int w, int h){ 65 | 66 | } 67 | 68 | //-------------------------------------------------------------- 69 | void ofApp::gotMessage(ofMessage msg){ 70 | 71 | } 72 | 73 | //-------------------------------------------------------------- 74 | void ofApp::dragEvent(ofDragInfo dragInfo){ 75 | 76 | } 77 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step2/src/ofApp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofMain.h" 4 | #include "Shapes/Rectangle.h" 5 | 6 | class ofApp : public ofBaseApp{ 7 | 8 | public: 9 | void setup(); 10 | void update(); 11 | void draw(); 12 | 13 | void keyPressed(int key); 14 | void keyReleased(int key); 15 | void mouseMoved(int x, int y ); 16 | void mouseDragged(int x, int y, int button); 17 | void mousePressed(int x, int y, int button); 18 | void mouseReleased(int x, int y, int button); 19 | void mouseEntered(int x, int y); 20 | void mouseExited(int x, int y); 21 | void windowResized(int w, int h); 22 | void dragEvent(ofDragInfo dragInfo); 23 | void gotMessage(ofMessage msg); 24 | 25 | Shapes::Rectangle rectangle; 26 | }; 27 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step3/00_Rectangles.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 14 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "00_Rectangles", "00_Rectangles.vcxproj", "{7FD42DF7-442E-479A-BA76-D0022F99702A}" 4 | EndProject 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openframeworksLib", "..\..\..\..\of_v0.9.0_vs_release\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 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step3/00_Rectangles.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | src 6 | 7 | 8 | src 9 | 10 | 11 | src 12 | 13 | 14 | src 15 | 16 | 17 | src\Shapes 18 | 19 | 20 | 21 | 22 | {d8376475-7454-4a24-b08a-aac121d3ad6f} 23 | 24 | 25 | {f17fc8f5-404b-49b3-9dbd-3ff05b697d8d} 26 | 27 | 28 | 29 | 30 | src 31 | 32 | 33 | src 34 | 35 | 36 | src\Shapes 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step3/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 ../../../../of_v0.9.0_vs_release) 10 | endif 11 | 12 | # call the project makefile! 13 | include $(OF_ROOT)/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk 14 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step3/Project.xcconfig: -------------------------------------------------------------------------------- 1 | //THE PATH TO THE ROOT OF OUR OF PATH RELATIVE TO THIS PROJECT. 2 | //THIS NEEDS TO BE DEFINED BEFORE CoreOF.xcconfig IS INCLUDED 3 | OF_PATH = ../../../../of_v0.9.0_vs_release 4 | 5 | //THIS HAS ALL THE HEADER AND LIBS FOR OF CORE 6 | #include "../../../../of_v0.9.0_vs_release/libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig" 7 | 8 | //ICONS - NEW IN 0072 9 | ICON_NAME_DEBUG = icon-debug.icns 10 | ICON_NAME_RELEASE = icon.icns 11 | ICON_FILE_PATH = $(OF_PATH)/libs/openFrameworksCompiled/project/osx/ 12 | 13 | //IF YOU WANT AN APP TO HAVE A CUSTOM ICON - PUT THEM IN YOUR DATA FOLDER AND CHANGE ICON_FILE_PATH to: 14 | //ICON_FILE_PATH = bin/data/ 15 | 16 | OTHER_LDFLAGS = $(OF_CORE_LIBS) $(OF_CORE_FRAMEWORKS) 17 | HEADER_SEARCH_PATHS = $(OF_CORE_HEADERS) 18 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step3/addons.make: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elliotwoods/Workshops.ofxRulr.Advanced/3c0b122e381c326df32b8ae988ebdc1671f99b8f/00_Rectangles/00_Rectangles_Step3/addons.make -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step3/icon.rc: -------------------------------------------------------------------------------- 1 | // Icon Resource Definition 2 | #define MAIN_ICON 102 3 | 4 | #if defined(_DEBUG) 5 | MAIN_ICON ICON "icon_debug.ico" 6 | #else 7 | MAIN_ICON ICON "icon.ico" 8 | #endif 9 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step3/openFrameworks-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | cc.openFrameworks.ofapp 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | APPL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | CFBundleIconFile 20 | ${ICON} 21 | 22 | 23 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step3/src/Shapes/Rectangle.cpp: -------------------------------------------------------------------------------- 1 | #include "Rectangle.h" 2 | 3 | #include "ofMain.h" 4 | 5 | namespace Shapes { 6 | //---------- 7 | void Rectangle::draw() const { 8 | ofPushStyle(); 9 | { 10 | ofSetColor(color); 11 | ofDrawRectangle(bounds); 12 | } 13 | ofPopStyle(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step3/src/Shapes/Rectangle.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofRectangle.h" 4 | #include "ofColor.h" 5 | 6 | namespace Shapes { 7 | struct Rectangle { 8 | void draw() const; 9 | 10 | ofRectangle bounds; 11 | ofColor color; 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step3/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ofMain.h" 2 | #include "ofApp.h" 3 | 4 | //======================================================================== 5 | int main( ){ 6 | ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context 7 | 8 | // this kicks off the running of my app 9 | // can be OF_WINDOW or OF_FULLSCREEN 10 | // pass in width and height too: 11 | ofRunApp(new ofApp()); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step3/src/ofApp.cpp: -------------------------------------------------------------------------------- 1 | #include "ofApp.h" 2 | 3 | //-------------------------------------------------------------- 4 | void ofApp::setup(){ 5 | ofBackground(255); 6 | } 7 | 8 | //-------------------------------------------------------------- 9 | void ofApp::update(){ 10 | 11 | } 12 | 13 | //-------------------------------------------------------------- 14 | void ofApp::draw(){ 15 | for (auto & rectangle : rectangles) { 16 | rectangle->draw(); 17 | } 18 | if (this->newRectangle) { 19 | newRectangle->draw(); 20 | } 21 | } 22 | 23 | //-------------------------------------------------------------- 24 | void ofApp::keyPressed(int key){ 25 | 26 | } 27 | 28 | //-------------------------------------------------------------- 29 | void ofApp::keyReleased(int key){ 30 | 31 | } 32 | 33 | //-------------------------------------------------------------- 34 | void ofApp::mouseMoved(int x, int y ){ 35 | 36 | } 37 | 38 | //-------------------------------------------------------------- 39 | void ofApp::mouseDragged(int x, int y, int button){ 40 | if (this->newRectangle) { 41 | auto & bounds = newRectangle->bounds; 42 | bounds.width = x - bounds.x; 43 | bounds.height = y - bounds.y; 44 | } 45 | } 46 | 47 | //-------------------------------------------------------------- 48 | void ofApp::mousePressed(int x, int y, int button){ 49 | ofColor newColor(200, 100, 100); 50 | newColor.setHue(fmod(ofGetElapsedTimef() * 30.0f, 360.0f)); 51 | 52 | this->newRectangle = make_shared(); 53 | this->newRectangle->color = newColor; 54 | this->newRectangle->bounds = ofRectangle(x, y, 0, 0); 55 | } 56 | 57 | //-------------------------------------------------------------- 58 | void ofApp::mouseReleased(int x, int y, int button){ 59 | if (this->newRectangle) { 60 | auto & bounds = newRectangle->bounds; 61 | bounds.width = x - bounds.x; 62 | bounds.height = y - bounds.y; 63 | 64 | this->rectangles.push_back(newRectangle); 65 | newRectangle.reset(); 66 | } 67 | } 68 | 69 | //-------------------------------------------------------------- 70 | void ofApp::mouseEntered(int x, int y){ 71 | 72 | } 73 | 74 | //-------------------------------------------------------------- 75 | void ofApp::mouseExited(int x, int y){ 76 | 77 | } 78 | 79 | //-------------------------------------------------------------- 80 | void ofApp::windowResized(int w, int h){ 81 | 82 | } 83 | 84 | //-------------------------------------------------------------- 85 | void ofApp::gotMessage(ofMessage msg){ 86 | 87 | } 88 | 89 | //-------------------------------------------------------------- 90 | void ofApp::dragEvent(ofDragInfo dragInfo){ 91 | 92 | } 93 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step3/src/ofApp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofMain.h" 4 | #include "Shapes/Rectangle.h" 5 | 6 | class ofApp : public ofBaseApp{ 7 | 8 | public: 9 | void setup(); 10 | void update(); 11 | void draw(); 12 | 13 | void keyPressed(int key); 14 | void keyReleased(int key); 15 | void mouseMoved(int x, int y ); 16 | void mouseDragged(int x, int y, int button); 17 | void mousePressed(int x, int y, int button); 18 | void mouseReleased(int x, int y, int button); 19 | void mouseEntered(int x, int y); 20 | void mouseExited(int x, int y); 21 | void windowResized(int w, int h); 22 | void dragEvent(ofDragInfo dragInfo); 23 | void gotMessage(ofMessage msg); 24 | 25 | vector> rectangles; 26 | 27 | shared_ptr newRectangle; 28 | }; 29 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step4/00_Rectangles.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 14 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "00_Rectangles", "00_Rectangles.vcxproj", "{7FD42DF7-442E-479A-BA76-D0022F99702A}" 4 | EndProject 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openframeworksLib", "..\..\..\..\of_v0.9.0_vs_release\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 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step4/00_Rectangles.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | src 6 | 7 | 8 | src 9 | 10 | 11 | src 12 | 13 | 14 | src 15 | 16 | 17 | src\Shapes 18 | 19 | 20 | 21 | 22 | {d8376475-7454-4a24-b08a-aac121d3ad6f} 23 | 24 | 25 | {f17fc8f5-404b-49b3-9dbd-3ff05b697d8d} 26 | 27 | 28 | 29 | 30 | src 31 | 32 | 33 | src 34 | 35 | 36 | src\Shapes 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step4/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 ../../../../of_v0.9.0_vs_release) 10 | endif 11 | 12 | # call the project makefile! 13 | include $(OF_ROOT)/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk 14 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step4/Project.xcconfig: -------------------------------------------------------------------------------- 1 | //THE PATH TO THE ROOT OF OUR OF PATH RELATIVE TO THIS PROJECT. 2 | //THIS NEEDS TO BE DEFINED BEFORE CoreOF.xcconfig IS INCLUDED 3 | OF_PATH = ../../../../of_v0.9.0_vs_release 4 | 5 | //THIS HAS ALL THE HEADER AND LIBS FOR OF CORE 6 | #include "../../../../of_v0.9.0_vs_release/libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig" 7 | 8 | //ICONS - NEW IN 0072 9 | ICON_NAME_DEBUG = icon-debug.icns 10 | ICON_NAME_RELEASE = icon.icns 11 | ICON_FILE_PATH = $(OF_PATH)/libs/openFrameworksCompiled/project/osx/ 12 | 13 | //IF YOU WANT AN APP TO HAVE A CUSTOM ICON - PUT THEM IN YOUR DATA FOLDER AND CHANGE ICON_FILE_PATH to: 14 | //ICON_FILE_PATH = bin/data/ 15 | 16 | OTHER_LDFLAGS = $(OF_CORE_LIBS) $(OF_CORE_FRAMEWORKS) 17 | HEADER_SEARCH_PATHS = $(OF_CORE_HEADERS) 18 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step4/addons.make: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elliotwoods/Workshops.ofxRulr.Advanced/3c0b122e381c326df32b8ae988ebdc1671f99b8f/00_Rectangles/00_Rectangles_Step4/addons.make -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step4/icon.rc: -------------------------------------------------------------------------------- 1 | // Icon Resource Definition 2 | #define MAIN_ICON 102 3 | 4 | #if defined(_DEBUG) 5 | MAIN_ICON ICON "icon_debug.ico" 6 | #else 7 | MAIN_ICON ICON "icon.ico" 8 | #endif 9 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step4/openFrameworks-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | cc.openFrameworks.ofapp 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | APPL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | CFBundleIconFile 20 | ${ICON} 21 | 22 | 23 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step4/src/Shapes/Rectangle.cpp: -------------------------------------------------------------------------------- 1 | #include "Rectangle.h" 2 | 3 | #include "ofMain.h" 4 | 5 | namespace Shapes { 6 | //---------- 7 | void Rectangle::draw() const { 8 | ofPushStyle(); 9 | { 10 | ofSetColor(color); 11 | ofDrawRectangle(bounds); 12 | } 13 | ofPopStyle(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step4/src/Shapes/Rectangle.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofRectangle.h" 4 | #include "ofColor.h" 5 | 6 | namespace Shapes { 7 | struct Rectangle { 8 | void draw() const; 9 | 10 | ofRectangle bounds; 11 | ofColor color; 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step4/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ofMain.h" 2 | #include "ofApp.h" 3 | 4 | //======================================================================== 5 | int main( ){ 6 | ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context 7 | 8 | // this kicks off the running of my app 9 | // can be OF_WINDOW or OF_FULLSCREEN 10 | // pass in width and height too: 11 | ofRunApp(new ofApp()); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /00_Rectangles/00_Rectangles_Step4/src/ofApp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofMain.h" 4 | #include "Shapes/Rectangle.h" 5 | 6 | class ofApp : public ofBaseApp{ 7 | 8 | public: 9 | void setup(); 10 | void update(); 11 | void draw(); 12 | 13 | void keyPressed(int key); 14 | void keyReleased(int key); 15 | void mouseMoved(int x, int y ); 16 | void mouseDragged(int x, int y, int button); 17 | void mousePressed(int x, int y, int button); 18 | void mouseReleased(int x, int y, int button); 19 | void mouseEntered(int x, int y); 20 | void mouseExited(int x, int y); 21 | void windowResized(int w, int h); 22 | void dragEvent(ofDragInfo dragInfo); 23 | void gotMessage(ofMessage msg); 24 | 25 | vector> rectangles; 26 | 27 | shared_ptr newRectangle; 28 | weak_ptr selection; 29 | }; 30 | -------------------------------------------------------------------------------- /00_Rectangles/readme.md: -------------------------------------------------------------------------------- 1 | # 00_Rectangles 2 | 3 | ## Introducing 4 | 5 | * `namespace` 6 | * C++11's `shared_ptr` and `weak_ptr` 7 | * C++11's `auto` 8 | 9 | ## Steps 10 | 11 | ### 1. Draw a rectangle 12 | 13 | * Set the backgound colour to white 14 | * Draw a black rectangle to the screen (x=200,y=200,width=200,height=200) 15 | 16 | ### 2. `Rectangle` struct within a namespace `Shapes` 17 | 18 | * Add properties `bounds` and `color` to `Rectangle` 19 | * Add method `draw` to `Rectangle` 20 | 21 | ### 3. `vector` of `shared_ptr` 22 | 23 | * Create a new rectangle every time the user drags 24 | 25 | ### 4. Select rectangle by hovering 26 | 27 | * Use a `weak_ptr` to represent the rectangle underneath the mouse cursor 28 | * Delete selected rectangle on `OF_KEY_BACKSPACE` 29 | 30 | ## Style notes 31 | 32 | ### Classes, namespaces 33 | 34 | * Each class has its own cpp / h file pair 35 | * Each namespace has a folder 36 | * Class definitions start with capital letter (e.g. `Rectangle`). Instances use lower case `rectangle`. 37 | * Minimise includes in header files. Be more generous with includes in cpp files (header files may be included by many cpp's, so including a lot there means many cpp's are affected). 38 | 39 | ### Functions 40 | 41 | * We use `const` for functions where it makes sense now, and remove later if we need to, 42 | * Each function definition (cpp) has `//` and 10 `-`s above it (e.g. `//----------`) 43 | 44 | ### `shared_ptr` 45 | 46 | * Use `make_shared(...Constructor arguments...)` as a shorthand to make a new instance as a shared pointer. 47 | ### Other 48 | * Create a scope `{` ... `}` between `ofPushStyle()` / `ofPopStyle()`, etc. -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step1/01_Elements.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 14 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "01_Elements", "01_Elements.vcxproj", "{7FD42DF7-442E-479A-BA76-D0022F99702A}" 4 | EndProject 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openframeworksLib", "..\..\..\..\of_v0.9.0_vs_release\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 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step1/01_Elements.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | src 6 | 7 | 8 | src 9 | 10 | 11 | src 12 | 13 | 14 | src 15 | 16 | 17 | src\Elements 18 | 19 | 20 | 21 | 22 | {d8376475-7454-4a24-b08a-aac121d3ad6f} 23 | 24 | 25 | {f71197b0-3fa0-4a71-93df-b1146ad9134b} 26 | 27 | 28 | 29 | 30 | src 31 | 32 | 33 | src 34 | 35 | 36 | src\Elements 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step1/01_Elements.xcodeproj/xcshareddata/xcschemes/01_Elements Debug.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 51 | 52 | 58 | 59 | 60 | 61 | 62 | 63 | 69 | 70 | 76 | 77 | 78 | 79 | 81 | 82 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step1/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 ../../../../of_v0.9.0_vs_release) 10 | endif 11 | 12 | # call the project makefile! 13 | include $(OF_ROOT)/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk 14 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step1/Project.xcconfig: -------------------------------------------------------------------------------- 1 | //THE PATH TO THE ROOT OF OUR OF PATH RELATIVE TO THIS PROJECT. 2 | //THIS NEEDS TO BE DEFINED BEFORE CoreOF.xcconfig IS INCLUDED 3 | OF_PATH = ../../../../of_v0.9.0_vs_release 4 | 5 | //THIS HAS ALL THE HEADER AND LIBS FOR OF CORE 6 | #include "../../../../of_v0.9.0_vs_release/libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig" 7 | 8 | //ICONS - NEW IN 0072 9 | ICON_NAME_DEBUG = icon-debug.icns 10 | ICON_NAME_RELEASE = icon.icns 11 | ICON_FILE_PATH = $(OF_PATH)/libs/openFrameworksCompiled/project/osx/ 12 | 13 | //IF YOU WANT AN APP TO HAVE A CUSTOM ICON - PUT THEM IN YOUR DATA FOLDER AND CHANGE ICON_FILE_PATH to: 14 | //ICON_FILE_PATH = bin/data/ 15 | 16 | OTHER_LDFLAGS = $(OF_CORE_LIBS) $(OF_CORE_FRAMEWORKS) 17 | HEADER_SEARCH_PATHS = $(OF_CORE_HEADERS) 18 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step1/addons.make: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elliotwoods/Workshops.ofxRulr.Advanced/3c0b122e381c326df32b8ae988ebdc1671f99b8f/01_Elements/01_Elements_Step1/addons.make -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step1/icon.rc: -------------------------------------------------------------------------------- 1 | // Icon Resource Definition 2 | #define MAIN_ICON 102 3 | 4 | #if defined(_DEBUG) 5 | MAIN_ICON ICON "icon_debug.ico" 6 | #else 7 | MAIN_ICON ICON "icon.ico" 8 | #endif 9 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step1/openFrameworks-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | cc.openFrameworks.ofapp 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | APPL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | CFBundleIconFile 20 | ${ICON} 21 | 22 | 23 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step1/src/Elements/Base.cpp: -------------------------------------------------------------------------------- 1 | #include "Base.h" 2 | 3 | #include "ofMain.h" 4 | 5 | namespace Elements { 6 | //---------- 7 | void Base::draw() { 8 | //translate to local coordinates 9 | ofPushMatrix(); 10 | { 11 | ofTranslate(this->bounds.getTopLeft()); 12 | 13 | //then call the custom draw function 14 | this->customDraw(); 15 | } 16 | ofPopMatrix(); 17 | } 18 | 19 | //---------- 20 | void Base::mousePressed(float x, float y) { 21 | //if mouse landed inside our bounds 22 | if (this->bounds.inside(ofVec2f(x, y))) { 23 | //then call our custom mouse pressed function 24 | this->customMousePressed(); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step1/src/Elements/Base.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofRectangle.h" 4 | 5 | namespace Elements { 6 | class Base { 7 | public: 8 | void draw(); 9 | void mousePressed(float x, float y); 10 | 11 | ofRectangle bounds; 12 | protected: 13 | virtual void customDraw() { } 14 | virtual void customMousePressed() { } 15 | }; 16 | } -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step1/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ofMain.h" 2 | #include "ofApp.h" 3 | 4 | //======================================================================== 5 | int main( ){ 6 | ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context 7 | 8 | // this kicks off the running of my app 9 | // can be OF_WINDOW or OF_FULLSCREEN 10 | // pass in width and height too: 11 | ofRunApp(new ofApp()); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step1/src/ofApp.cpp: -------------------------------------------------------------------------------- 1 | #include "ofApp.h" 2 | 3 | //-------------------------------------------------------------- 4 | void ofApp::setup(){ 5 | 6 | } 7 | 8 | //-------------------------------------------------------------- 9 | void ofApp::update(){ 10 | 11 | } 12 | 13 | //-------------------------------------------------------------- 14 | void ofApp::draw(){ 15 | for (auto element : this->elements) { 16 | element->draw(); 17 | } 18 | } 19 | 20 | //-------------------------------------------------------------- 21 | void ofApp::keyPressed(int key){ 22 | 23 | } 24 | 25 | //-------------------------------------------------------------- 26 | void ofApp::keyReleased(int key){ 27 | 28 | } 29 | 30 | //-------------------------------------------------------------- 31 | void ofApp::mouseMoved(int x, int y ){ 32 | 33 | } 34 | 35 | //-------------------------------------------------------------- 36 | void ofApp::mouseDragged(int x, int y, int button){ 37 | 38 | } 39 | 40 | //-------------------------------------------------------------- 41 | void ofApp::mousePressed(int x, int y, int button){ 42 | for (auto element : this->elements) { 43 | element->mousePressed(x, y); 44 | } 45 | } 46 | 47 | //-------------------------------------------------------------- 48 | void ofApp::mouseReleased(int x, int y, int button){ 49 | 50 | } 51 | 52 | //-------------------------------------------------------------- 53 | void ofApp::mouseEntered(int x, int y){ 54 | 55 | } 56 | 57 | //-------------------------------------------------------------- 58 | void ofApp::mouseExited(int x, int y){ 59 | 60 | } 61 | 62 | //-------------------------------------------------------------- 63 | void ofApp::windowResized(int w, int h){ 64 | 65 | } 66 | 67 | //-------------------------------------------------------------- 68 | void ofApp::gotMessage(ofMessage msg){ 69 | 70 | } 71 | 72 | //-------------------------------------------------------------- 73 | void ofApp::dragEvent(ofDragInfo dragInfo){ 74 | 75 | } 76 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step1/src/ofApp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofMain.h" 4 | #include "Elements/Base.h" 5 | 6 | class ofApp : public ofBaseApp{ 7 | 8 | public: 9 | void setup(); 10 | void update(); 11 | void draw(); 12 | 13 | void keyPressed(int key); 14 | void keyReleased(int key); 15 | void mouseMoved(int x, int y ); 16 | void mouseDragged(int x, int y, int button); 17 | void mousePressed(int x, int y, int button); 18 | void mouseReleased(int x, int y, int button); 19 | void mouseEntered(int x, int y); 20 | void mouseExited(int x, int y); 21 | void windowResized(int w, int h); 22 | void dragEvent(ofDragInfo dragInfo); 23 | void gotMessage(ofMessage msg); 24 | 25 | vector> elements; 26 | }; 27 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step2/01_Elements.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 14 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "01_Elements", "01_Elements.vcxproj", "{7FD42DF7-442E-479A-BA76-D0022F99702A}" 4 | EndProject 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openframeworksLib", "..\..\..\..\of_v0.9.0_vs_release\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 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step2/01_Elements.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | src 6 | 7 | 8 | src 9 | 10 | 11 | src 12 | 13 | 14 | src 15 | 16 | 17 | src\Elements 18 | 19 | 20 | src\Elements 21 | 22 | 23 | src\Elements 24 | 25 | 26 | 27 | 28 | {d8376475-7454-4a24-b08a-aac121d3ad6f} 29 | 30 | 31 | {f71197b0-3fa0-4a71-93df-b1146ad9134b} 32 | 33 | 34 | 35 | 36 | src 37 | 38 | 39 | src 40 | 41 | 42 | src\Elements 43 | 44 | 45 | src\Elements 46 | 47 | 48 | src\Elements 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step2/01_Elements.xcodeproj/xcshareddata/xcschemes/01_Elements Debug.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 51 | 52 | 58 | 59 | 60 | 61 | 62 | 63 | 69 | 70 | 76 | 77 | 78 | 79 | 81 | 82 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step2/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 ../../../../of_v0.9.0_vs_release) 10 | endif 11 | 12 | # call the project makefile! 13 | include $(OF_ROOT)/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk 14 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step2/Project.xcconfig: -------------------------------------------------------------------------------- 1 | //THE PATH TO THE ROOT OF OUR OF PATH RELATIVE TO THIS PROJECT. 2 | //THIS NEEDS TO BE DEFINED BEFORE CoreOF.xcconfig IS INCLUDED 3 | OF_PATH = ../../../../of_v0.9.0_vs_release 4 | 5 | //THIS HAS ALL THE HEADER AND LIBS FOR OF CORE 6 | #include "../../../../of_v0.9.0_vs_release/libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig" 7 | 8 | //ICONS - NEW IN 0072 9 | ICON_NAME_DEBUG = icon-debug.icns 10 | ICON_NAME_RELEASE = icon.icns 11 | ICON_FILE_PATH = $(OF_PATH)/libs/openFrameworksCompiled/project/osx/ 12 | 13 | //IF YOU WANT AN APP TO HAVE A CUSTOM ICON - PUT THEM IN YOUR DATA FOLDER AND CHANGE ICON_FILE_PATH to: 14 | //ICON_FILE_PATH = bin/data/ 15 | 16 | OTHER_LDFLAGS = $(OF_CORE_LIBS) $(OF_CORE_FRAMEWORKS) 17 | HEADER_SEARCH_PATHS = $(OF_CORE_HEADERS) 18 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step2/addons.make: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elliotwoods/Workshops.ofxRulr.Advanced/3c0b122e381c326df32b8ae988ebdc1671f99b8f/01_Elements/01_Elements_Step2/addons.make -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step2/icon.rc: -------------------------------------------------------------------------------- 1 | // Icon Resource Definition 2 | #define MAIN_ICON 102 3 | 4 | #if defined(_DEBUG) 5 | MAIN_ICON ICON "icon_debug.ico" 6 | #else 7 | MAIN_ICON ICON "icon.ico" 8 | #endif 9 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step2/openFrameworks-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | cc.openFrameworks.ofapp 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | APPL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | CFBundleIconFile 20 | ${ICON} 21 | 22 | 23 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step2/src/Elements/Base.cpp: -------------------------------------------------------------------------------- 1 | #include "Base.h" 2 | 3 | #include "ofMain.h" 4 | 5 | namespace Elements { 6 | //---------- 7 | void Base::draw() { 8 | //translate to local coordinates 9 | ofPushMatrix(); 10 | { 11 | ofTranslate(this->bounds.getTopLeft()); 12 | 13 | //then call the custom draw function 14 | this->customDraw(); 15 | } 16 | ofPopMatrix(); 17 | } 18 | 19 | //---------- 20 | void Base::mousePressed(float x, float y) { 21 | //if mouse landed inside our bounds 22 | if (this->bounds.inside(ofVec2f(x, y))) { 23 | //then call our custom mouse pressed function 24 | this->customMousePressed(); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step2/src/Elements/Base.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofRectangle.h" 4 | 5 | namespace Elements { 6 | class Base { 7 | public: 8 | void draw(); 9 | void mousePressed(float x, float y); 10 | 11 | ofRectangle bounds; 12 | protected: 13 | virtual void customDraw() { } 14 | virtual void customMousePressed() { } 15 | }; 16 | } -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step2/src/Elements/Button.cpp: -------------------------------------------------------------------------------- 1 | #include "Button.h" 2 | #include "ofMain.h" 3 | 4 | namespace Elements { 5 | //---------- 6 | void Button::customDraw() { 7 | ofPushStyle(); 8 | { 9 | //find the bounds in coordinates local to this element 10 | auto localBounds = this->bounds; 11 | localBounds.x = 0.0f; 12 | localBounds.y = 0.0f; 13 | 14 | //draw the background fill 15 | ofFill(); 16 | ofSetColor(200); 17 | ofDrawRectRounded(localBounds, 5); 18 | 19 | //draw an outline 20 | ofNoFill(); 21 | ofSetColor(0); 22 | ofSetLineWidth(1.0f); 23 | ofDrawRectRounded(localBounds, 5); 24 | 25 | //draw the text 26 | ofDrawBitmapString(this->text, 15, 15); 27 | } 28 | ofPopStyle(); 29 | 30 | ofDrawBitmapString(this->text, 15, 15); 31 | } 32 | 33 | //---------- 34 | void Button::customMousePressed() { 35 | ofSystemAlertDialog(this->text); 36 | } 37 | } -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step2/src/Elements/Button.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Base.h" 4 | 5 | namespace Elements { 6 | class Button : public Base { 7 | public: 8 | string text; 9 | protected: 10 | void customDraw() override; 11 | void customMousePressed() override; 12 | }; 13 | } -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step2/src/Elements/Text.cpp: -------------------------------------------------------------------------------- 1 | #include "Text.h" 2 | #include "ofMain.h" 3 | 4 | namespace Elements { 5 | //---------- 6 | void Text::customDraw() { 7 | ofPushStyle(); 8 | { 9 | //find the bounds in coordinates local to this element 10 | auto localBounds = this->bounds; 11 | localBounds.x = 0.0f; 12 | localBounds.y = 0.0f; 13 | 14 | //draw the background fill 15 | ofFill(); 16 | ofSetColor(255); 17 | ofDrawRectangle(localBounds); 18 | 19 | //draw an outline 20 | ofNoFill(); 21 | ofSetColor(0); 22 | ofSetLineWidth(1.0f); 23 | ofDrawRectangle(localBounds); 24 | 25 | //draw the text 26 | ofDrawBitmapString(this->text, 10, 10); 27 | } 28 | ofPopStyle(); 29 | 30 | ofDrawBitmapString(this->text, 10, 10); 31 | } 32 | } -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step2/src/Elements/Text.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Base.h" 4 | 5 | namespace Elements { 6 | class Text : public Base { 7 | public: 8 | string text; 9 | protected: 10 | void customDraw() override; 11 | }; 12 | } -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step2/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ofMain.h" 2 | #include "ofApp.h" 3 | 4 | //======================================================================== 5 | int main( ){ 6 | ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context 7 | 8 | // this kicks off the running of my app 9 | // can be OF_WINDOW or OF_FULLSCREEN 10 | // pass in width and height too: 11 | ofRunApp(new ofApp()); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step2/src/ofApp.cpp: -------------------------------------------------------------------------------- 1 | #include "ofApp.h" 2 | 3 | //-------------------------------------------------------------- 4 | void ofApp::setup(){ 5 | ofBackground(255); 6 | 7 | auto text = make_shared(); 8 | text->text = "Text"; 9 | text->bounds = ofRectangle(100, 100, 100, 20); 10 | this->elements.push_back(text); 11 | 12 | auto button = make_shared(); 13 | button->text = "Button"; 14 | button->bounds = ofRectangle(300, 100, 100, 20); 15 | this->elements.push_back(button); 16 | 17 | } 18 | 19 | //-------------------------------------------------------------- 20 | void ofApp::update(){ 21 | 22 | } 23 | 24 | //-------------------------------------------------------------- 25 | void ofApp::draw(){ 26 | for (auto element : this->elements) { 27 | element->draw(); 28 | } 29 | } 30 | 31 | //-------------------------------------------------------------- 32 | void ofApp::keyPressed(int key){ 33 | 34 | } 35 | 36 | //-------------------------------------------------------------- 37 | void ofApp::keyReleased(int key){ 38 | 39 | } 40 | 41 | //-------------------------------------------------------------- 42 | void ofApp::mouseMoved(int x, int y ){ 43 | 44 | } 45 | 46 | //-------------------------------------------------------------- 47 | void ofApp::mouseDragged(int x, int y, int button){ 48 | 49 | } 50 | 51 | //-------------------------------------------------------------- 52 | void ofApp::mousePressed(int x, int y, int button){ 53 | for (auto element : this->elements) { 54 | element->mousePressed(x, y); 55 | } 56 | } 57 | 58 | //-------------------------------------------------------------- 59 | void ofApp::mouseReleased(int x, int y, int button){ 60 | 61 | } 62 | 63 | //-------------------------------------------------------------- 64 | void ofApp::mouseEntered(int x, int y){ 65 | 66 | } 67 | 68 | //-------------------------------------------------------------- 69 | void ofApp::mouseExited(int x, int y){ 70 | 71 | } 72 | 73 | //-------------------------------------------------------------- 74 | void ofApp::windowResized(int w, int h){ 75 | 76 | } 77 | 78 | //-------------------------------------------------------------- 79 | void ofApp::gotMessage(ofMessage msg){ 80 | 81 | } 82 | 83 | //-------------------------------------------------------------- 84 | void ofApp::dragEvent(ofDragInfo dragInfo){ 85 | 86 | } 87 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step2/src/ofApp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofMain.h" 4 | 5 | #include "Elements/Base.h" 6 | #include "Elements/Button.h" 7 | #include "Elements/Text.h" 8 | 9 | class ofApp : public ofBaseApp{ 10 | 11 | public: 12 | void setup(); 13 | void update(); 14 | void draw(); 15 | 16 | void keyPressed(int key); 17 | void keyReleased(int key); 18 | void mouseMoved(int x, int y ); 19 | void mouseDragged(int x, int y, int button); 20 | void mousePressed(int x, int y, int button); 21 | void mouseReleased(int x, int y, int button); 22 | void mouseEntered(int x, int y); 23 | void mouseExited(int x, int y); 24 | void windowResized(int w, int h); 25 | void dragEvent(ofDragInfo dragInfo); 26 | void gotMessage(ofMessage msg); 27 | 28 | vector> elements; 29 | }; 30 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step3/01_Elements.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 14 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "01_Elements", "01_Elements.vcxproj", "{7FD42DF7-442E-479A-BA76-D0022F99702A}" 4 | EndProject 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openframeworksLib", "..\..\..\..\of_v0.9.0_vs_release\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 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step3/01_Elements.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | src 6 | 7 | 8 | src 9 | 10 | 11 | src 12 | 13 | 14 | src 15 | 16 | 17 | src\Elements 18 | 19 | 20 | src\Elements 21 | 22 | 23 | src\Elements 24 | 25 | 26 | 27 | 28 | {d8376475-7454-4a24-b08a-aac121d3ad6f} 29 | 30 | 31 | {f71197b0-3fa0-4a71-93df-b1146ad9134b} 32 | 33 | 34 | 35 | 36 | src 37 | 38 | 39 | src 40 | 41 | 42 | src\Elements 43 | 44 | 45 | src\Elements 46 | 47 | 48 | src\Elements 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step3/01_Elements.xcodeproj/xcshareddata/xcschemes/01_Elements Debug.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 51 | 52 | 58 | 59 | 60 | 61 | 62 | 63 | 69 | 70 | 76 | 77 | 78 | 79 | 81 | 82 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step3/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 ../../../../of_v0.9.0_vs_release) 10 | endif 11 | 12 | # call the project makefile! 13 | include $(OF_ROOT)/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk 14 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step3/Project.xcconfig: -------------------------------------------------------------------------------- 1 | //THE PATH TO THE ROOT OF OUR OF PATH RELATIVE TO THIS PROJECT. 2 | //THIS NEEDS TO BE DEFINED BEFORE CoreOF.xcconfig IS INCLUDED 3 | OF_PATH = ../../../../of_v0.9.0_vs_release 4 | 5 | //THIS HAS ALL THE HEADER AND LIBS FOR OF CORE 6 | #include "../../../../of_v0.9.0_vs_release/libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig" 7 | 8 | //ICONS - NEW IN 0072 9 | ICON_NAME_DEBUG = icon-debug.icns 10 | ICON_NAME_RELEASE = icon.icns 11 | ICON_FILE_PATH = $(OF_PATH)/libs/openFrameworksCompiled/project/osx/ 12 | 13 | //IF YOU WANT AN APP TO HAVE A CUSTOM ICON - PUT THEM IN YOUR DATA FOLDER AND CHANGE ICON_FILE_PATH to: 14 | //ICON_FILE_PATH = bin/data/ 15 | 16 | OTHER_LDFLAGS = $(OF_CORE_LIBS) $(OF_CORE_FRAMEWORKS) 17 | HEADER_SEARCH_PATHS = $(OF_CORE_HEADERS) 18 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step3/addons.make: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elliotwoods/Workshops.ofxRulr.Advanced/3c0b122e381c326df32b8ae988ebdc1671f99b8f/01_Elements/01_Elements_Step3/addons.make -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step3/icon.rc: -------------------------------------------------------------------------------- 1 | // Icon Resource Definition 2 | #define MAIN_ICON 102 3 | 4 | #if defined(_DEBUG) 5 | MAIN_ICON ICON "icon_debug.ico" 6 | #else 7 | MAIN_ICON ICON "icon.ico" 8 | #endif 9 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step3/openFrameworks-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | cc.openFrameworks.ofapp 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | APPL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | CFBundleIconFile 20 | ${ICON} 21 | 22 | 23 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step3/src/Elements/Base.cpp: -------------------------------------------------------------------------------- 1 | #include "Base.h" 2 | 3 | #include "ofMain.h" 4 | 5 | namespace Elements { 6 | //---------- 7 | void Base::draw() { 8 | //translate to local coordinates 9 | ofPushMatrix(); 10 | { 11 | ofTranslate(this->bounds.getTopLeft()); 12 | 13 | //check if we have a draw function 14 | if (this->onDraw) { 15 | //calculate the bounds within coordinates local to this element 16 | auto localBounds = this->bounds; 17 | localBounds.x = 0.0f; 18 | localBounds.y = 0.0f; 19 | 20 | //call the draw function 21 | this->onDraw(localBounds); 22 | } 23 | } 24 | ofPopMatrix(); 25 | } 26 | 27 | //---------- 28 | void Base::mousePressed(float x, float y) { 29 | //if mouse landed inside our bounds 30 | if (this->bounds.inside(ofVec2f(x, y))) { 31 | //check if we have a function setup for when mouse is pressed 32 | if (this->onMousePressed) { 33 | //call the function 34 | this->onMousePressed(); 35 | } 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step3/src/Elements/Base.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofRectangle.h" 4 | #include 5 | 6 | namespace Elements { 7 | class Base { 8 | public: 9 | void draw(); 10 | void mousePressed(float x, float y); 11 | 12 | function onDraw; 13 | function onMousePressed; 14 | 15 | ofRectangle bounds; 16 | protected: 17 | }; 18 | } -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step3/src/Elements/Button.cpp: -------------------------------------------------------------------------------- 1 | #include "Button.h" 2 | #include "ofMain.h" 3 | 4 | namespace Elements { 5 | //---------- 6 | Button::Button() { 7 | this->onDraw = [this](ofRectangle localBounds) { 8 | ofPushStyle(); 9 | { 10 | //draw the background fill 11 | ofFill(); 12 | ofSetColor(200); 13 | ofDrawRectRounded(localBounds, 5); 14 | 15 | //draw an outline 16 | ofNoFill(); 17 | ofSetColor(0); 18 | ofSetLineWidth(1.0f); 19 | ofDrawRectRounded(localBounds, 5); 20 | 21 | //draw the text 22 | ofDrawBitmapString(this->text, 15, 15); 23 | } 24 | ofPopStyle(); 25 | 26 | ofDrawBitmapString(this->text, 15, 15); 27 | }; 28 | 29 | this->onMousePressed = [this]() { 30 | ofSystemAlertDialog(this->text); 31 | }; 32 | } 33 | } -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step3/src/Elements/Button.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Base.h" 4 | 5 | namespace Elements { 6 | class Button : public Base { 7 | public: 8 | Button(); 9 | 10 | string text; 11 | }; 12 | } -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step3/src/Elements/Text.cpp: -------------------------------------------------------------------------------- 1 | #include "Text.h" 2 | #include "ofMain.h" 3 | 4 | namespace Elements { 5 | //---------- 6 | Text::Text() { 7 | this->onDraw = [this](ofRectangle localBounds) { 8 | ofPushStyle(); 9 | { 10 | //draw the background fill 11 | ofFill(); 12 | ofSetColor(255); 13 | ofDrawRectangle(localBounds); 14 | 15 | //draw an outline 16 | ofNoFill(); 17 | ofSetColor(0); 18 | ofSetLineWidth(1.0f); 19 | ofDrawRectangle(localBounds); 20 | 21 | //draw the text 22 | ofDrawBitmapString(this->text, 10, 10); 23 | } 24 | ofPopStyle(); 25 | 26 | ofDrawBitmapString(this->text, 10, 10); 27 | }; 28 | } 29 | } -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step3/src/Elements/Text.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Base.h" 4 | 5 | namespace Elements { 6 | class Text : public Base { 7 | public: 8 | Text::Text(); 9 | string text; 10 | }; 11 | } -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step3/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ofMain.h" 2 | #include "ofApp.h" 3 | 4 | //======================================================================== 5 | int main( ){ 6 | ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context 7 | 8 | // this kicks off the running of my app 9 | // can be OF_WINDOW or OF_FULLSCREEN 10 | // pass in width and height too: 11 | ofRunApp(new ofApp()); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step3/src/ofApp.cpp: -------------------------------------------------------------------------------- 1 | #include "ofApp.h" 2 | 3 | //-------------------------------------------------------------- 4 | void ofApp::setup(){ 5 | ofBackground(255); 6 | 7 | auto text = make_shared(); 8 | text->text = "Text"; 9 | text->bounds = ofRectangle(100, 100, 100, 20); 10 | this->elements.push_back(text); 11 | 12 | auto button = make_shared(); 13 | button->text = "Button"; 14 | button->bounds = ofRectangle(300, 100, 100, 20); 15 | this->elements.push_back(button); 16 | } 17 | 18 | //-------------------------------------------------------------- 19 | void ofApp::update(){ 20 | 21 | } 22 | 23 | //-------------------------------------------------------------- 24 | void ofApp::draw(){ 25 | for (auto element : this->elements) { 26 | element->draw(); 27 | } 28 | } 29 | 30 | //-------------------------------------------------------------- 31 | void ofApp::keyPressed(int key){ 32 | 33 | } 34 | 35 | //-------------------------------------------------------------- 36 | void ofApp::keyReleased(int key){ 37 | 38 | } 39 | 40 | //-------------------------------------------------------------- 41 | void ofApp::mouseMoved(int x, int y ){ 42 | 43 | } 44 | 45 | //-------------------------------------------------------------- 46 | void ofApp::mouseDragged(int x, int y, int button){ 47 | 48 | } 49 | 50 | //-------------------------------------------------------------- 51 | void ofApp::mousePressed(int x, int y, int button){ 52 | for (auto element : this->elements) { 53 | element->mousePressed(x, y); 54 | } 55 | } 56 | 57 | //-------------------------------------------------------------- 58 | void ofApp::mouseReleased(int x, int y, int button){ 59 | 60 | } 61 | 62 | //-------------------------------------------------------------- 63 | void ofApp::mouseEntered(int x, int y){ 64 | 65 | } 66 | 67 | //-------------------------------------------------------------- 68 | void ofApp::mouseExited(int x, int y){ 69 | 70 | } 71 | 72 | //-------------------------------------------------------------- 73 | void ofApp::windowResized(int w, int h){ 74 | 75 | } 76 | 77 | //-------------------------------------------------------------- 78 | void ofApp::gotMessage(ofMessage msg){ 79 | 80 | } 81 | 82 | //-------------------------------------------------------------- 83 | void ofApp::dragEvent(ofDragInfo dragInfo){ 84 | 85 | } 86 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step3/src/ofApp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofMain.h" 4 | 5 | #include "Elements/Base.h" 6 | #include "Elements/Button.h" 7 | #include "Elements/Text.h" 8 | 9 | class ofApp : public ofBaseApp{ 10 | 11 | public: 12 | void setup(); 13 | void update(); 14 | void draw(); 15 | 16 | void keyPressed(int key); 17 | void keyReleased(int key); 18 | void mouseMoved(int x, int y ); 19 | void mouseDragged(int x, int y, int button); 20 | void mousePressed(int x, int y, int button); 21 | void mouseReleased(int x, int y, int button); 22 | void mouseEntered(int x, int y); 23 | void mouseExited(int x, int y); 24 | void windowResized(int w, int h); 25 | void dragEvent(ofDragInfo dragInfo); 26 | void gotMessage(ofMessage msg); 27 | 28 | vector> elements; 29 | }; 30 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step4/01_Elements.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 14 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "01_Elements", "01_Elements.vcxproj", "{7FD42DF7-442E-479A-BA76-D0022F99702A}" 4 | EndProject 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openframeworksLib", "..\..\..\..\of_v0.9.0_vs_release\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 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step4/01_Elements.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | src 6 | 7 | 8 | src 9 | 10 | 11 | src 12 | 13 | 14 | src 15 | 16 | 17 | src\Elements 18 | 19 | 20 | src\Elements 21 | 22 | 23 | src\Elements 24 | 25 | 26 | 27 | 28 | {d8376475-7454-4a24-b08a-aac121d3ad6f} 29 | 30 | 31 | {f71197b0-3fa0-4a71-93df-b1146ad9134b} 32 | 33 | 34 | 35 | 36 | src 37 | 38 | 39 | src 40 | 41 | 42 | src\Elements 43 | 44 | 45 | src\Elements 46 | 47 | 48 | src\Elements 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step4/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 ../../../../of_v0.9.0_vs_release) 10 | endif 11 | 12 | # call the project makefile! 13 | include $(OF_ROOT)/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk 14 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step4/Project.xcconfig: -------------------------------------------------------------------------------- 1 | //THE PATH TO THE ROOT OF OUR OF PATH RELATIVE TO THIS PROJECT. 2 | //THIS NEEDS TO BE DEFINED BEFORE CoreOF.xcconfig IS INCLUDED 3 | OF_PATH = ../../../../of_v0.9.0_vs_release 4 | 5 | //THIS HAS ALL THE HEADER AND LIBS FOR OF CORE 6 | #include "../../../../of_v0.9.0_vs_release/libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig" 7 | 8 | //ICONS - NEW IN 0072 9 | ICON_NAME_DEBUG = icon-debug.icns 10 | ICON_NAME_RELEASE = icon.icns 11 | ICON_FILE_PATH = $(OF_PATH)/libs/openFrameworksCompiled/project/osx/ 12 | 13 | //IF YOU WANT AN APP TO HAVE A CUSTOM ICON - PUT THEM IN YOUR DATA FOLDER AND CHANGE ICON_FILE_PATH to: 14 | //ICON_FILE_PATH = bin/data/ 15 | 16 | OTHER_LDFLAGS = $(OF_CORE_LIBS) $(OF_CORE_FRAMEWORKS) 17 | HEADER_SEARCH_PATHS = $(OF_CORE_HEADERS) 18 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step4/addons.make: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elliotwoods/Workshops.ofxRulr.Advanced/3c0b122e381c326df32b8ae988ebdc1671f99b8f/01_Elements/01_Elements_Step4/addons.make -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step4/icon.rc: -------------------------------------------------------------------------------- 1 | // Icon Resource Definition 2 | #define MAIN_ICON 102 3 | 4 | #if defined(_DEBUG) 5 | MAIN_ICON ICON "icon_debug.ico" 6 | #else 7 | MAIN_ICON ICON "icon.ico" 8 | #endif 9 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step4/openFrameworks-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | cc.openFrameworks.ofapp 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | APPL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | CFBundleIconFile 20 | ${ICON} 21 | 22 | 23 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step4/src/Elements/Base.cpp: -------------------------------------------------------------------------------- 1 | #include "Base.h" 2 | 3 | #include "ofMain.h" 4 | 5 | namespace Elements { 6 | //---------- 7 | void Base::draw() { 8 | //translate to local coordinates 9 | ofPushMatrix(); 10 | { 11 | ofTranslate(this->bounds.getTopLeft()); 12 | 13 | //check if we have a draw function 14 | if (this->onDraw) { 15 | //calculate the bounds within coordinates local to this element 16 | auto localBounds = this->bounds; 17 | localBounds.x = 0.0f; 18 | localBounds.y = 0.0f; 19 | 20 | //call the draw function 21 | this->onDraw(localBounds); 22 | } 23 | } 24 | ofPopMatrix(); 25 | } 26 | 27 | //---------- 28 | void Base::mousePressed(float x, float y) { 29 | //if mouse landed inside our bounds 30 | if (this->bounds.inside(ofVec2f(x, y))) { 31 | //check if we have a function setup for when mouse is pressed 32 | if (this->onMousePressed) { 33 | //call the function 34 | this->onMousePressed(); 35 | } 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step4/src/Elements/Base.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofRectangle.h" 4 | #include 5 | 6 | namespace Elements { 7 | class Base { 8 | public: 9 | void draw(); 10 | void mousePressed(float x, float y); 11 | 12 | function onDraw; 13 | function onMousePressed; 14 | 15 | ofRectangle bounds; 16 | protected: 17 | }; 18 | } -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step4/src/Elements/Button.cpp: -------------------------------------------------------------------------------- 1 | #include "Button.h" 2 | #include "ofMain.h" 3 | 4 | namespace Elements { 5 | //---------- 6 | Button::Button() { 7 | this->onDraw = [this](ofRectangle localBounds) { 8 | ofPushStyle(); 9 | { 10 | //draw the background fill 11 | ofFill(); 12 | ofSetColor(200); 13 | ofDrawRectRounded(localBounds, 5); 14 | 15 | //draw an outline 16 | ofNoFill(); 17 | ofSetColor(0); 18 | ofSetLineWidth(1.0f); 19 | ofDrawRectRounded(localBounds, 5); 20 | 21 | //draw the text 22 | ofDrawBitmapString(this->text, 15, 15); 23 | } 24 | ofPopStyle(); 25 | 26 | ofDrawBitmapString(this->text, 15, 15); 27 | }; 28 | 29 | this->onMousePressed = [this]() { 30 | ofSystemAlertDialog(this->text); 31 | }; 32 | } 33 | } -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step4/src/Elements/Button.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Base.h" 4 | 5 | namespace Elements { 6 | class Button : public Base { 7 | public: 8 | Button(); 9 | 10 | string text; 11 | }; 12 | } -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step4/src/Elements/Text.cpp: -------------------------------------------------------------------------------- 1 | #include "Text.h" 2 | #include "ofMain.h" 3 | 4 | namespace Elements { 5 | //---------- 6 | Text::Text() { 7 | this->onDraw = [this](ofRectangle localBounds) { 8 | ofPushStyle(); 9 | { 10 | //draw the background fill 11 | ofFill(); 12 | ofSetColor(255); 13 | ofDrawRectangle(localBounds); 14 | 15 | //draw an outline 16 | ofNoFill(); 17 | ofSetColor(0); 18 | ofSetLineWidth(1.0f); 19 | ofDrawRectangle(localBounds); 20 | 21 | //draw the text 22 | ofDrawBitmapString(this->text, 10, 10); 23 | } 24 | ofPopStyle(); 25 | 26 | ofDrawBitmapString(this->text, 10, 10); 27 | }; 28 | } 29 | } -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step4/src/Elements/Text.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Base.h" 4 | 5 | namespace Elements { 6 | class Text : public Base { 7 | public: 8 | Text::Text(); 9 | string text; 10 | }; 11 | } -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step4/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ofMain.h" 2 | #include "ofApp.h" 3 | 4 | //======================================================================== 5 | int main( ){ 6 | ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context 7 | 8 | // this kicks off the running of my app 9 | // can be OF_WINDOW or OF_FULLSCREEN 10 | // pass in width and height too: 11 | ofRunApp(new ofApp()); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step4/src/ofApp.cpp: -------------------------------------------------------------------------------- 1 | #include "ofApp.h" 2 | 3 | //-------------------------------------------------------------- 4 | void ofApp::setup(){ 5 | ofBackground(255); 6 | ofSetCircleResolution(100); 7 | 8 | auto text = make_shared(); 9 | text->text = "Text"; 10 | text->bounds = ofRectangle(100, 100, 100, 20); 11 | this->elements.push_back(text); 12 | 13 | auto button = make_shared(); 14 | button->text = "Button"; 15 | button->bounds = ofRectangle(300, 100, 100, 20); 16 | this->elements.push_back(button); 17 | 18 | auto ellipse = make_shared(); 19 | ellipse->onDraw = [ellipse](ofRectangle bounds) { //we shouldn't do this (pass the shared_ptr into itself). we should use weak_ptr here 20 | ofPushStyle(); 21 | { 22 | ofSetColor(100); 23 | ofEllipse(bounds.getCenter(), bounds.getWidth(), bounds.getHeight()); 24 | } 25 | ofPopStyle(); 26 | }; 27 | ellipse->bounds = ofRectangle(100, 200, 200, 100); 28 | this->elements.push_back(ellipse); 29 | } 30 | 31 | //-------------------------------------------------------------- 32 | void ofApp::update(){ 33 | 34 | } 35 | 36 | //-------------------------------------------------------------- 37 | void ofApp::draw(){ 38 | for (auto element : this->elements) { 39 | element->draw(); 40 | } 41 | } 42 | 43 | //-------------------------------------------------------------- 44 | void ofApp::keyPressed(int key){ 45 | 46 | } 47 | 48 | //-------------------------------------------------------------- 49 | void ofApp::keyReleased(int key){ 50 | 51 | } 52 | 53 | //-------------------------------------------------------------- 54 | void ofApp::mouseMoved(int x, int y ){ 55 | 56 | } 57 | 58 | //-------------------------------------------------------------- 59 | void ofApp::mouseDragged(int x, int y, int button){ 60 | 61 | } 62 | 63 | //-------------------------------------------------------------- 64 | void ofApp::mousePressed(int x, int y, int button){ 65 | for (auto element : this->elements) { 66 | element->mousePressed(x, y); 67 | } 68 | } 69 | 70 | //-------------------------------------------------------------- 71 | void ofApp::mouseReleased(int x, int y, int button){ 72 | 73 | } 74 | 75 | //-------------------------------------------------------------- 76 | void ofApp::mouseEntered(int x, int y){ 77 | 78 | } 79 | 80 | //-------------------------------------------------------------- 81 | void ofApp::mouseExited(int x, int y){ 82 | 83 | } 84 | 85 | //-------------------------------------------------------------- 86 | void ofApp::windowResized(int w, int h){ 87 | 88 | } 89 | 90 | //-------------------------------------------------------------- 91 | void ofApp::gotMessage(ofMessage msg){ 92 | 93 | } 94 | 95 | //-------------------------------------------------------------- 96 | void ofApp::dragEvent(ofDragInfo dragInfo){ 97 | 98 | } 99 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step4/src/ofApp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofMain.h" 4 | 5 | #include "Elements/Base.h" 6 | #include "Elements/Button.h" 7 | #include "Elements/Text.h" 8 | 9 | class ofApp : public ofBaseApp{ 10 | 11 | public: 12 | void setup(); 13 | void update(); 14 | void draw(); 15 | 16 | void keyPressed(int key); 17 | void keyReleased(int key); 18 | void mouseMoved(int x, int y ); 19 | void mouseDragged(int x, int y, int button); 20 | void mousePressed(int x, int y, int button); 21 | void mouseReleased(int x, int y, int button); 22 | void mouseEntered(int x, int y); 23 | void mouseExited(int x, int y); 24 | void windowResized(int w, int h); 25 | void dragEvent(ofDragInfo dragInfo); 26 | void gotMessage(ofMessage msg); 27 | 28 | vector> elements; 29 | }; 30 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step5/01_Elements.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 14 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "01_Elements", "01_Elements.vcxproj", "{7FD42DF7-442E-479A-BA76-D0022F99702A}" 4 | EndProject 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openframeworksLib", "..\..\..\..\of_v0.9.0_vs_release\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 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step5/01_Elements.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | src 6 | 7 | 8 | src 9 | 10 | 11 | src 12 | 13 | 14 | src 15 | 16 | 17 | src\Elements 18 | 19 | 20 | src\Elements 21 | 22 | 23 | src\Elements 24 | 25 | 26 | 27 | 28 | {d8376475-7454-4a24-b08a-aac121d3ad6f} 29 | 30 | 31 | {f71197b0-3fa0-4a71-93df-b1146ad9134b} 32 | 33 | 34 | {748647b4-5e14-4b0e-919f-e38af941c0b9} 35 | 36 | 37 | {96e0264f-5b33-4483-afaa-b99c2b089b48} 38 | 39 | 40 | {61456172-f2e5-4e9a-b0c3-8ee3ad3af234} 41 | 42 | 43 | 44 | 45 | src 46 | 47 | 48 | src 49 | 50 | 51 | src\Elements 52 | 53 | 54 | src\Elements 55 | 56 | 57 | src\Elements 58 | 59 | 60 | addons\ofxLiquidEvent\src 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step5/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 ../../../../of_v0.9.0_vs_release) 10 | endif 11 | 12 | # call the project makefile! 13 | include $(OF_ROOT)/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk 14 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step5/Project.xcconfig: -------------------------------------------------------------------------------- 1 | //THE PATH TO THE ROOT OF OUR OF PATH RELATIVE TO THIS PROJECT. 2 | //THIS NEEDS TO BE DEFINED BEFORE CoreOF.xcconfig IS INCLUDED 3 | OF_PATH = ../../../../of_v0.9.0_vs_release 4 | 5 | //THIS HAS ALL THE HEADER AND LIBS FOR OF CORE 6 | #include "../../../../of_v0.9.0_vs_release/libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig" 7 | 8 | //ICONS - NEW IN 0072 9 | ICON_NAME_DEBUG = icon-debug.icns 10 | ICON_NAME_RELEASE = icon.icns 11 | ICON_FILE_PATH = $(OF_PATH)/libs/openFrameworksCompiled/project/osx/ 12 | 13 | //IF YOU WANT AN APP TO HAVE A CUSTOM ICON - PUT THEM IN YOUR DATA FOLDER AND CHANGE ICON_FILE_PATH to: 14 | //ICON_FILE_PATH = bin/data/ 15 | 16 | OTHER_LDFLAGS = $(OF_CORE_LIBS) $(OF_CORE_FRAMEWORKS) 17 | HEADER_SEARCH_PATHS = $(OF_CORE_HEADERS) 18 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step5/addons.make: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elliotwoods/Workshops.ofxRulr.Advanced/3c0b122e381c326df32b8ae988ebdc1671f99b8f/01_Elements/01_Elements_Step5/addons.make -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step5/icon.rc: -------------------------------------------------------------------------------- 1 | // Icon Resource Definition 2 | #define MAIN_ICON 102 3 | 4 | #if defined(_DEBUG) 5 | MAIN_ICON ICON "icon_debug.ico" 6 | #else 7 | MAIN_ICON ICON "icon.ico" 8 | #endif 9 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step5/openFrameworks-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | cc.openFrameworks.ofapp 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | APPL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | CFBundleIconFile 20 | ${ICON} 21 | 22 | 23 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step5/src/Elements/Base.cpp: -------------------------------------------------------------------------------- 1 | #include "Base.h" 2 | 3 | #include "ofMain.h" 4 | 5 | namespace Elements { 6 | //---------- 7 | void Base::draw() { 8 | //translate to local coordinates 9 | ofPushMatrix(); 10 | { 11 | ofTranslate(this->bounds.getTopLeft()); 12 | 13 | //calculate the bounds within coordinates local to this element 14 | auto localBounds = this->bounds; 15 | localBounds.x = 0.0f; 16 | localBounds.y = 0.0f; 17 | 18 | //call all draw listeners 19 | this->onDraw.notifyListeners(localBounds); 20 | } 21 | ofPopMatrix(); 22 | } 23 | 24 | //---------- 25 | void Base::mousePressed(float x, float y) { 26 | //if mouse landed inside our bounds 27 | if (this->bounds.inside(ofVec2f(x, y))) { 28 | //call all listeners to mouse pressed event 29 | this->onMousePressed.notifyListeners(); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step5/src/Elements/Base.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofxLiquidEvent.h" 4 | #include "ofRectangle.h" 5 | 6 | namespace Elements { 7 | class Base { 8 | public: 9 | void draw(); 10 | void mousePressed(float x, float y); 11 | 12 | ofxLiquidEvent onDraw; 13 | ofxLiquidEvent onMousePressed; 14 | 15 | ofRectangle bounds; 16 | protected: 17 | }; 18 | } -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step5/src/Elements/Button.cpp: -------------------------------------------------------------------------------- 1 | #include "Button.h" 2 | #include "ofMain.h" 3 | 4 | namespace Elements { 5 | //---------- 6 | Button::Button() { 7 | this->onDraw += [this](ofRectangle localBounds) { 8 | ofPushStyle(); 9 | { 10 | //draw the background fill 11 | ofFill(); 12 | ofSetColor(200); 13 | ofDrawRectRounded(localBounds, 5); 14 | 15 | //draw an outline 16 | ofNoFill(); 17 | ofSetColor(0); 18 | ofSetLineWidth(1.0f); 19 | ofDrawRectRounded(localBounds, 5); 20 | 21 | //draw the text 22 | ofDrawBitmapString(this->text, 15, 15); 23 | } 24 | ofPopStyle(); 25 | 26 | ofDrawBitmapString(this->text, 15, 15); 27 | }; 28 | 29 | this->onMousePressed += [this]() { 30 | ofSystemAlertDialog(this->text); 31 | }; 32 | } 33 | } -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step5/src/Elements/Button.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Base.h" 4 | 5 | namespace Elements { 6 | class Button : public Base { 7 | public: 8 | Button(); 9 | 10 | string text; 11 | }; 12 | } -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step5/src/Elements/Text.cpp: -------------------------------------------------------------------------------- 1 | #include "Text.h" 2 | #include "ofMain.h" 3 | 4 | namespace Elements { 5 | //---------- 6 | Text::Text() { 7 | this->onDraw += [this](ofRectangle localBounds) { 8 | ofPushStyle(); 9 | { 10 | //draw the background fill 11 | ofFill(); 12 | ofSetColor(255); 13 | ofDrawRectangle(localBounds); 14 | 15 | //draw an outline 16 | ofNoFill(); 17 | ofSetColor(0); 18 | ofSetLineWidth(1.0f); 19 | ofDrawRectangle(localBounds); 20 | 21 | //draw the text 22 | ofDrawBitmapString(this->text, 10, 10); 23 | } 24 | ofPopStyle(); 25 | 26 | ofDrawBitmapString(this->text, 10, 10); 27 | }; 28 | } 29 | } -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step5/src/Elements/Text.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Base.h" 4 | 5 | namespace Elements { 6 | class Text : public Base { 7 | public: 8 | Text::Text(); 9 | string text; 10 | }; 11 | } -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step5/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ofMain.h" 2 | #include "ofApp.h" 3 | 4 | //======================================================================== 5 | int main( ){ 6 | ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context 7 | 8 | // this kicks off the running of my app 9 | // can be OF_WINDOW or OF_FULLSCREEN 10 | // pass in width and height too: 11 | ofRunApp(new ofApp()); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step5/src/ofApp.cpp: -------------------------------------------------------------------------------- 1 | #include "ofApp.h" 2 | 3 | //-------------------------------------------------------------- 4 | void ofApp::setup(){ 5 | ofBackground(255); 6 | ofSetCircleResolution(100); 7 | 8 | auto text = make_shared(); 9 | text->text = "Text"; 10 | text->bounds = ofRectangle(100, 100, 100, 20); 11 | this->elements.push_back(text); 12 | 13 | auto button = make_shared(); 14 | button->text = "Button"; 15 | button->bounds = ofRectangle(300, 100, 100, 20); 16 | button->onMousePressed += []() { 17 | ofBackground(ofGetElapsedTimeMillis() % 150 + 100); 18 | }; 19 | this->elements.push_back(button); 20 | 21 | auto ellipse = make_shared(); 22 | ellipse->onDraw += [ellipse](ofRectangle bounds) { //we shouldn't do this (pass the shared_ptr into itself). we should use weak_ptr here 23 | ofPushStyle(); 24 | { 25 | ofSetColor(100); 26 | ofEllipse(bounds.getCenter(), bounds.getWidth(), bounds.getHeight()); 27 | } 28 | ofPopStyle(); 29 | }; 30 | ellipse->bounds = ofRectangle(100, 200, 200, 100); 31 | this->elements.push_back(ellipse); 32 | } 33 | 34 | //-------------------------------------------------------------- 35 | void ofApp::update(){ 36 | 37 | } 38 | 39 | //-------------------------------------------------------------- 40 | void ofApp::draw(){ 41 | for (auto element : this->elements) { 42 | element->draw(); 43 | } 44 | } 45 | 46 | //-------------------------------------------------------------- 47 | void ofApp::keyPressed(int key){ 48 | 49 | } 50 | 51 | //-------------------------------------------------------------- 52 | void ofApp::keyReleased(int key){ 53 | 54 | } 55 | 56 | //-------------------------------------------------------------- 57 | void ofApp::mouseMoved(int x, int y ){ 58 | 59 | } 60 | 61 | //-------------------------------------------------------------- 62 | void ofApp::mouseDragged(int x, int y, int button){ 63 | 64 | } 65 | 66 | //-------------------------------------------------------------- 67 | void ofApp::mousePressed(int x, int y, int button){ 68 | for (auto element : this->elements) { 69 | element->mousePressed(x, y); 70 | } 71 | } 72 | 73 | //-------------------------------------------------------------- 74 | void ofApp::mouseReleased(int x, int y, int button){ 75 | 76 | } 77 | 78 | //-------------------------------------------------------------- 79 | void ofApp::mouseEntered(int x, int y){ 80 | 81 | } 82 | 83 | //-------------------------------------------------------------- 84 | void ofApp::mouseExited(int x, int y){ 85 | 86 | } 87 | 88 | //-------------------------------------------------------------- 89 | void ofApp::windowResized(int w, int h){ 90 | 91 | } 92 | 93 | //-------------------------------------------------------------- 94 | void ofApp::gotMessage(ofMessage msg){ 95 | 96 | } 97 | 98 | //-------------------------------------------------------------- 99 | void ofApp::dragEvent(ofDragInfo dragInfo){ 100 | 101 | } 102 | -------------------------------------------------------------------------------- /01_Elements/01_Elements_Step5/src/ofApp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofMain.h" 4 | 5 | #include "Elements/Base.h" 6 | #include "Elements/Button.h" 7 | #include "Elements/Text.h" 8 | 9 | class ofApp : public ofBaseApp{ 10 | 11 | public: 12 | void setup(); 13 | void update(); 14 | void draw(); 15 | 16 | void keyPressed(int key); 17 | void keyReleased(int key); 18 | void mouseMoved(int x, int y ); 19 | void mouseDragged(int x, int y, int button); 20 | void mousePressed(int x, int y, int button); 21 | void mouseReleased(int x, int y, int button); 22 | void mouseEntered(int x, int y); 23 | void mouseExited(int x, int y); 24 | void windowResized(int w, int h); 25 | void dragEvent(ofDragInfo dragInfo); 26 | void gotMessage(ofMessage msg); 27 | 28 | vector> elements; 29 | }; 30 | -------------------------------------------------------------------------------- /01_Elements/readme.md: -------------------------------------------------------------------------------- 1 | # 01_Elements 2 | 3 | ## Introducing 4 | 5 | * Lambda functions 6 | * `std::function` 7 | * ofxLiquidEvent 8 | 9 | ## Steps 10 | 11 | ### 1. Create a `Base` class within the namespace `Elements` 12 | 13 | * Give it a property `ofRectangle bounds`. 14 | * Give it methods `customDraw()` and `customMousePressed()`. Make them empty, virtual, protected 15 | * Give it methods `draw()` and `mousePressed(float x, float y)`. Define them to call `customDraw` and `customMousePressed` appropriately 16 | * Create a `vector> elements` within ofApp 17 | * Implement `ofApp::draw` and `ofApp::mousePressed` to work with `elements`. 18 | 19 | 2. Create classes `Elements::Button` and `Elements::Text` 20 | 21 | * Both should inherit `Elements::Base` 22 | * Give both a property called `string text` 23 | * `Text` draws a white background, a black outline and the text string 24 | * `Button` draws a rounded rectangle with a light grey background, a black background and the text string 25 | * `Button` brings up a message box with the string when it is pressed using `ofSystemAlertDialog` 26 | * In `ofApp::setup`, add a `Text` and a `Button` to `ofApp::elements`. 27 | 28 | Note : I've noticed on some version of oF, it will ignore the colour when drawing the bitmap string 29 | 30 | 3. Replace `customMousePressed` / `customDraw` virtual methods with `onMousePressed` / `onDraw` functions in `Elements::Base` 31 | 32 | * Add `ofRectangle` as a parameter of `onDraw` to give the `localBounds`. 33 | 34 | 4. Define a new type of `Element` from within `ofApp::setup` 35 | 36 | * Add an ellipse which draws in dark grey. Set its bounds and add it to `ofApp::elements` 37 | 38 | 5. Replace `function` with `ofxLiquidEvent<...>` 39 | 40 | * Change the `Base::draw` and `Base::mousePressed` functions to use `notifyListeners(..)` 41 | * Cange the definitions of `Button` and `Text` to use `+=` notation to add a listener to the event 42 | * Add a listener to `button`'s `onMousePressed` to change the application background 43 | 44 | ## Style notes 45 | 46 | ### Inheritance 47 | 48 | * Use the `override` keyword in your header file to explicitly override function definitions 49 | * An instance should never store a `shared_ptr` of itself. Use `weak_ptr` in this case. 50 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step1/02_ofxCvGui.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 14 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "02_ofxCvGui", "02_ofxCvGui.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 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step1/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 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step1/Project.xcconfig: -------------------------------------------------------------------------------- 1 | //THE PATH TO THE ROOT OF OUR OF PATH RELATIVE TO THIS PROJECT. 2 | //THIS NEEDS TO BE DEFINED BEFORE CoreOF.xcconfig IS INCLUDED 3 | OF_PATH = ../../.. 4 | 5 | //THIS HAS ALL THE HEADER AND LIBS FOR OF CORE 6 | #include "../../../libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig" 7 | 8 | //ICONS - NEW IN 0072 9 | ICON_NAME_DEBUG = icon-debug.icns 10 | ICON_NAME_RELEASE = icon.icns 11 | ICON_FILE_PATH = $(OF_PATH)/libs/openFrameworksCompiled/project/osx/ 12 | 13 | //IF YOU WANT AN APP TO HAVE A CUSTOM ICON - PUT THEM IN YOUR DATA FOLDER AND CHANGE ICON_FILE_PATH to: 14 | //ICON_FILE_PATH = bin/data/ 15 | 16 | OTHER_LDFLAGS = $(OF_CORE_LIBS) $(OF_CORE_FRAMEWORKS) 17 | HEADER_SEARCH_PATHS = $(OF_CORE_HEADERS) 18 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step1/addons.make: -------------------------------------------------------------------------------- 1 | ofxAssets 2 | ofxCvGui 3 | ofxGrabCam 4 | ofxLiquidEvent 5 | ofxTextInputField 6 | ofxSingleton 7 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step1/icon.rc: -------------------------------------------------------------------------------- 1 | // Icon Resource Definition 2 | #define MAIN_ICON 102 3 | 4 | #if defined(_DEBUG) 5 | MAIN_ICON ICON "icon_debug.ico" 6 | #else 7 | MAIN_ICON ICON "icon.ico" 8 | #endif 9 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step1/openFrameworks-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | cc.openFrameworks.ofapp 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | APPL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | CFBundleIconFile 20 | ${ICON} 21 | 22 | 23 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step1/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ofMain.h" 2 | #include "ofApp.h" 3 | 4 | //======================================================================== 5 | int main( ){ 6 | ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context 7 | 8 | // this kicks off the running of my app 9 | // can be OF_WINDOW or OF_FULLSCREEN 10 | // pass in width and height too: 11 | ofRunApp(new ofApp()); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step1/src/ofApp.cpp: -------------------------------------------------------------------------------- 1 | #include "ofApp.h" 2 | 3 | //-------------------------------------------------------------- 4 | void ofApp::setup(){ 5 | 6 | } 7 | 8 | //-------------------------------------------------------------- 9 | void ofApp::update(){ 10 | 11 | } 12 | 13 | //-------------------------------------------------------------- 14 | void ofApp::draw(){ 15 | 16 | } 17 | 18 | //-------------------------------------------------------------- 19 | void ofApp::keyPressed(int key){ 20 | 21 | } 22 | 23 | //-------------------------------------------------------------- 24 | void ofApp::keyReleased(int key){ 25 | 26 | } 27 | 28 | //-------------------------------------------------------------- 29 | void ofApp::mouseMoved(int x, int y ){ 30 | 31 | } 32 | 33 | //-------------------------------------------------------------- 34 | void ofApp::mouseDragged(int x, int y, int button){ 35 | 36 | } 37 | 38 | //-------------------------------------------------------------- 39 | void ofApp::mousePressed(int x, int y, int button){ 40 | 41 | } 42 | 43 | //-------------------------------------------------------------- 44 | void ofApp::mouseReleased(int x, int y, int button){ 45 | 46 | } 47 | 48 | //-------------------------------------------------------------- 49 | void ofApp::mouseEntered(int x, int y){ 50 | 51 | } 52 | 53 | //-------------------------------------------------------------- 54 | void ofApp::mouseExited(int x, int y){ 55 | 56 | } 57 | 58 | //-------------------------------------------------------------- 59 | void ofApp::windowResized(int w, int h){ 60 | 61 | } 62 | 63 | //-------------------------------------------------------------- 64 | void ofApp::gotMessage(ofMessage msg){ 65 | 66 | } 67 | 68 | //-------------------------------------------------------------- 69 | void ofApp::dragEvent(ofDragInfo dragInfo){ 70 | 71 | } 72 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step1/src/ofApp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofMain.h" 4 | 5 | class ofApp : public ofBaseApp{ 6 | 7 | public: 8 | void setup(); 9 | void update(); 10 | void draw(); 11 | 12 | void keyPressed(int key); 13 | void keyReleased(int key); 14 | void mouseMoved(int x, int y ); 15 | void mouseDragged(int x, int y, int button); 16 | void mousePressed(int x, int y, int button); 17 | void mouseReleased(int x, int y, int button); 18 | void mouseEntered(int x, int y); 19 | void mouseExited(int x, int y); 20 | void windowResized(int w, int h); 21 | void dragEvent(ofDragInfo dragInfo); 22 | void gotMessage(ofMessage msg); 23 | }; 24 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step2/02_ofxCvGui.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 14 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "02_ofxCvGui", "02_ofxCvGui.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 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step2/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 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step2/Project.xcconfig: -------------------------------------------------------------------------------- 1 | //THE PATH TO THE ROOT OF OUR OF PATH RELATIVE TO THIS PROJECT. 2 | //THIS NEEDS TO BE DEFINED BEFORE CoreOF.xcconfig IS INCLUDED 3 | OF_PATH = ../../.. 4 | 5 | //THIS HAS ALL THE HEADER AND LIBS FOR OF CORE 6 | #include "../../../libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig" 7 | 8 | //ICONS - NEW IN 0072 9 | ICON_NAME_DEBUG = icon-debug.icns 10 | ICON_NAME_RELEASE = icon.icns 11 | ICON_FILE_PATH = $(OF_PATH)/libs/openFrameworksCompiled/project/osx/ 12 | 13 | //IF YOU WANT AN APP TO HAVE A CUSTOM ICON - PUT THEM IN YOUR DATA FOLDER AND CHANGE ICON_FILE_PATH to: 14 | //ICON_FILE_PATH = bin/data/ 15 | 16 | OTHER_LDFLAGS = $(OF_CORE_LIBS) $(OF_CORE_FRAMEWORKS) 17 | HEADER_SEARCH_PATHS = $(OF_CORE_HEADERS) 18 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step2/addons.make: -------------------------------------------------------------------------------- 1 | ofxAssets 2 | ofxCvGui 3 | ofxGrabCam 4 | ofxLiquidEvent 5 | ofxTextInputField 6 | ofxSingleton 7 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step2/icon.rc: -------------------------------------------------------------------------------- 1 | // Icon Resource Definition 2 | #define MAIN_ICON 102 3 | 4 | #if defined(_DEBUG) 5 | MAIN_ICON ICON "icon_debug.ico" 6 | #else 7 | MAIN_ICON ICON "icon.ico" 8 | #endif 9 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step2/openFrameworks-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | cc.openFrameworks.ofapp 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | APPL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | CFBundleIconFile 20 | ${ICON} 21 | 22 | 23 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step2/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ofMain.h" 2 | #include "ofApp.h" 3 | 4 | //======================================================================== 5 | int main( ){ 6 | ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context 7 | 8 | // this kicks off the running of my app 9 | // can be OF_WINDOW or OF_FULLSCREEN 10 | // pass in width and height too: 11 | ofRunApp(new ofApp()); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step2/src/ofApp.cpp: -------------------------------------------------------------------------------- 1 | #include "ofApp.h" 2 | 3 | //-------------------------------------------------------------- 4 | void ofApp::setup(){ 5 | this->video.initGrabber(1280, 720); 6 | 7 | this->gui.init(); 8 | this->gui.add(this->video, "Camera"); 9 | } 10 | 11 | //-------------------------------------------------------------- 12 | void ofApp::update(){ 13 | this->video.update(); 14 | } 15 | 16 | //-------------------------------------------------------------- 17 | void ofApp::draw(){ 18 | 19 | } 20 | 21 | //-------------------------------------------------------------- 22 | void ofApp::keyPressed(int key){ 23 | 24 | } 25 | 26 | //-------------------------------------------------------------- 27 | void ofApp::keyReleased(int key){ 28 | 29 | } 30 | 31 | //-------------------------------------------------------------- 32 | void ofApp::mouseMoved(int x, int y ){ 33 | 34 | } 35 | 36 | //-------------------------------------------------------------- 37 | void ofApp::mouseDragged(int x, int y, int button){ 38 | 39 | } 40 | 41 | //-------------------------------------------------------------- 42 | void ofApp::mousePressed(int x, int y, int button){ 43 | 44 | } 45 | 46 | //-------------------------------------------------------------- 47 | void ofApp::mouseReleased(int x, int y, int button){ 48 | 49 | } 50 | 51 | //-------------------------------------------------------------- 52 | void ofApp::mouseEntered(int x, int y){ 53 | 54 | } 55 | 56 | //-------------------------------------------------------------- 57 | void ofApp::mouseExited(int x, int y){ 58 | 59 | } 60 | 61 | //-------------------------------------------------------------- 62 | void ofApp::windowResized(int w, int h){ 63 | 64 | } 65 | 66 | //-------------------------------------------------------------- 67 | void ofApp::gotMessage(ofMessage msg){ 68 | 69 | } 70 | 71 | //-------------------------------------------------------------- 72 | void ofApp::dragEvent(ofDragInfo dragInfo){ 73 | 74 | } 75 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step2/src/ofApp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofxCvGui.h" 4 | 5 | #include "ofMain.h" 6 | 7 | class ofApp : public ofBaseApp{ 8 | 9 | public: 10 | void setup(); 11 | void update(); 12 | void draw(); 13 | 14 | void keyPressed(int key); 15 | void keyReleased(int key); 16 | void mouseMoved(int x, int y ); 17 | void mouseDragged(int x, int y, int button); 18 | void mousePressed(int x, int y, int button); 19 | void mouseReleased(int x, int y, int button); 20 | void mouseEntered(int x, int y); 21 | void mouseExited(int x, int y); 22 | void windowResized(int w, int h); 23 | void dragEvent(ofDragInfo dragInfo); 24 | void gotMessage(ofMessage msg); 25 | 26 | ofxCvGui::Builder gui; 27 | ofVideoGrabber video; 28 | }; 29 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step3/02_ofxCvGui.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 14 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "02_ofxCvGui", "02_ofxCvGui.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 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step3/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 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step3/Project.xcconfig: -------------------------------------------------------------------------------- 1 | //THE PATH TO THE ROOT OF OUR OF PATH RELATIVE TO THIS PROJECT. 2 | //THIS NEEDS TO BE DEFINED BEFORE CoreOF.xcconfig IS INCLUDED 3 | OF_PATH = ../../.. 4 | 5 | //THIS HAS ALL THE HEADER AND LIBS FOR OF CORE 6 | #include "../../../libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig" 7 | 8 | //ICONS - NEW IN 0072 9 | ICON_NAME_DEBUG = icon-debug.icns 10 | ICON_NAME_RELEASE = icon.icns 11 | ICON_FILE_PATH = $(OF_PATH)/libs/openFrameworksCompiled/project/osx/ 12 | 13 | //IF YOU WANT AN APP TO HAVE A CUSTOM ICON - PUT THEM IN YOUR DATA FOLDER AND CHANGE ICON_FILE_PATH to: 14 | //ICON_FILE_PATH = bin/data/ 15 | 16 | OTHER_LDFLAGS = $(OF_CORE_LIBS) $(OF_CORE_FRAMEWORKS) 17 | HEADER_SEARCH_PATHS = $(OF_CORE_HEADERS) 18 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step3/addons.make: -------------------------------------------------------------------------------- 1 | ofxAssets 2 | ofxCvGui 3 | ofxGrabCam 4 | ofxLiquidEvent 5 | ofxTextInputField 6 | ofxSingleton 7 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step3/icon.rc: -------------------------------------------------------------------------------- 1 | // Icon Resource Definition 2 | #define MAIN_ICON 102 3 | 4 | #if defined(_DEBUG) 5 | MAIN_ICON ICON "icon_debug.ico" 6 | #else 7 | MAIN_ICON ICON "icon.ico" 8 | #endif 9 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step3/openFrameworks-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | cc.openFrameworks.ofapp 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | APPL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | CFBundleIconFile 20 | ${ICON} 21 | 22 | 23 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step3/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ofMain.h" 2 | #include "ofApp.h" 3 | 4 | //======================================================================== 5 | int main( ){ 6 | ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context 7 | 8 | // this kicks off the running of my app 9 | // can be OF_WINDOW or OF_FULLSCREEN 10 | // pass in width and height too: 11 | ofRunApp(new ofApp()); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step3/src/ofApp.cpp: -------------------------------------------------------------------------------- 1 | #include "ofApp.h" 2 | 3 | //-------------------------------------------------------------- 4 | void ofApp::setup(){ 5 | this->video.initGrabber(1280, 720); 6 | 7 | this->gui.init(); 8 | this->gui.add(this->video, "Camera"); 9 | this->gui.add(this->inverted, "Inverted"); 10 | } 11 | 12 | //-------------------------------------------------------------- 13 | void ofApp::update(){ 14 | this->video.update(); 15 | 16 | //if we have a new video frame 17 | if (this->video.isFrameNew()) { 18 | //calculate the inverse 19 | this->inverted = this->video.getPixels(); 20 | for (auto & pixel : this->inverted.getPixels()) { 21 | pixel = 255 - pixel; 22 | } 23 | 24 | // push the texture to gpu 25 | this->inverted.update(); 26 | } 27 | } 28 | 29 | //-------------------------------------------------------------- 30 | void ofApp::draw(){ 31 | 32 | } 33 | 34 | //-------------------------------------------------------------- 35 | void ofApp::keyPressed(int key){ 36 | 37 | } 38 | 39 | //-------------------------------------------------------------- 40 | void ofApp::keyReleased(int key){ 41 | 42 | } 43 | 44 | //-------------------------------------------------------------- 45 | void ofApp::mouseMoved(int x, int y ){ 46 | 47 | } 48 | 49 | //-------------------------------------------------------------- 50 | void ofApp::mouseDragged(int x, int y, int button){ 51 | 52 | } 53 | 54 | //-------------------------------------------------------------- 55 | void ofApp::mousePressed(int x, int y, int button){ 56 | 57 | } 58 | 59 | //-------------------------------------------------------------- 60 | void ofApp::mouseReleased(int x, int y, int button){ 61 | 62 | } 63 | 64 | //-------------------------------------------------------------- 65 | void ofApp::mouseEntered(int x, int y){ 66 | 67 | } 68 | 69 | //-------------------------------------------------------------- 70 | void ofApp::mouseExited(int x, int y){ 71 | 72 | } 73 | 74 | //-------------------------------------------------------------- 75 | void ofApp::windowResized(int w, int h){ 76 | 77 | } 78 | 79 | //-------------------------------------------------------------- 80 | void ofApp::gotMessage(ofMessage msg){ 81 | 82 | } 83 | 84 | //-------------------------------------------------------------- 85 | void ofApp::dragEvent(ofDragInfo dragInfo){ 86 | 87 | } 88 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step3/src/ofApp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofxCvGui.h" 4 | 5 | #include "ofMain.h" 6 | 7 | class ofApp : public ofBaseApp{ 8 | 9 | public: 10 | void setup(); 11 | void update(); 12 | void draw(); 13 | 14 | void keyPressed(int key); 15 | void keyReleased(int key); 16 | void mouseMoved(int x, int y ); 17 | void mouseDragged(int x, int y, int button); 18 | void mousePressed(int x, int y, int button); 19 | void mouseReleased(int x, int y, int button); 20 | void mouseEntered(int x, int y); 21 | void mouseExited(int x, int y); 22 | void windowResized(int w, int h); 23 | void dragEvent(ofDragInfo dragInfo); 24 | void gotMessage(ofMessage msg); 25 | 26 | ofxCvGui::Builder gui; 27 | 28 | ofVideoGrabber video; 29 | ofImage inverted; 30 | }; 31 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step4/02_ofxCvGui.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 14 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "02_ofxCvGui", "02_ofxCvGui.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 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step4/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 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step4/Project.xcconfig: -------------------------------------------------------------------------------- 1 | //THE PATH TO THE ROOT OF OUR OF PATH RELATIVE TO THIS PROJECT. 2 | //THIS NEEDS TO BE DEFINED BEFORE CoreOF.xcconfig IS INCLUDED 3 | OF_PATH = ../../.. 4 | 5 | //THIS HAS ALL THE HEADER AND LIBS FOR OF CORE 6 | #include "../../../libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig" 7 | 8 | //ICONS - NEW IN 0072 9 | ICON_NAME_DEBUG = icon-debug.icns 10 | ICON_NAME_RELEASE = icon.icns 11 | ICON_FILE_PATH = $(OF_PATH)/libs/openFrameworksCompiled/project/osx/ 12 | 13 | //IF YOU WANT AN APP TO HAVE A CUSTOM ICON - PUT THEM IN YOUR DATA FOLDER AND CHANGE ICON_FILE_PATH to: 14 | //ICON_FILE_PATH = bin/data/ 15 | 16 | OTHER_LDFLAGS = $(OF_CORE_LIBS) $(OF_CORE_FRAMEWORKS) 17 | HEADER_SEARCH_PATHS = $(OF_CORE_HEADERS) 18 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step4/addons.make: -------------------------------------------------------------------------------- 1 | ofxAssets 2 | ofxCvGui 3 | ofxGrabCam 4 | ofxLiquidEvent 5 | ofxTextInputField 6 | ofxSingleton 7 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step4/bin/data/instructions.txt: -------------------------------------------------------------------------------- 1 | ofxCvGui simple panel example 2 | 3 | * Press 'm' whilst hovering over a panel to maximise it 4 | * Press 'f' to toggle fullscreen -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step4/icon.rc: -------------------------------------------------------------------------------- 1 | // Icon Resource Definition 2 | #define MAIN_ICON 102 3 | 4 | #if defined(_DEBUG) 5 | MAIN_ICON ICON "icon_debug.ico" 6 | #else 7 | MAIN_ICON ICON "icon.ico" 8 | #endif 9 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step4/openFrameworks-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | cc.openFrameworks.ofapp 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | APPL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | CFBundleIconFile 20 | ${ICON} 21 | 22 | 23 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step4/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ofMain.h" 2 | #include "ofApp.h" 3 | 4 | //======================================================================== 5 | int main( ){ 6 | ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context 7 | 8 | // this kicks off the running of my app 9 | // can be OF_WINDOW or OF_FULLSCREEN 10 | // pass in width and height too: 11 | ofRunApp(new ofApp()); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step4/src/ofApp.cpp: -------------------------------------------------------------------------------- 1 | #include "ofApp.h" 2 | 3 | //-------------------------------------------------------------- 4 | void ofApp::setup(){ 5 | this->video.initGrabber(1280, 720); 6 | 7 | this->gui.init(); 8 | this->gui.addInstructions(); 9 | this->gui.add(this->video, "Camera"); 10 | this->gui.add(this->inverted, "Inverted"); 11 | } 12 | 13 | //-------------------------------------------------------------- 14 | void ofApp::update(){ 15 | this->video.update(); 16 | 17 | //if we have a new video frame 18 | if (this->video.isFrameNew()) { 19 | //calculate the inverse 20 | this->inverted = this->video.getPixels(); 21 | for (auto & pixel : this->inverted.getPixels()) { 22 | pixel = 255 - pixel; 23 | } 24 | 25 | // push the texture to gpu 26 | this->inverted.update(); 27 | } 28 | } 29 | 30 | //-------------------------------------------------------------- 31 | void ofApp::draw(){ 32 | 33 | } 34 | 35 | //-------------------------------------------------------------- 36 | void ofApp::keyPressed(int key){ 37 | 38 | } 39 | 40 | //-------------------------------------------------------------- 41 | void ofApp::keyReleased(int key){ 42 | 43 | } 44 | 45 | //-------------------------------------------------------------- 46 | void ofApp::mouseMoved(int x, int y ){ 47 | 48 | } 49 | 50 | //-------------------------------------------------------------- 51 | void ofApp::mouseDragged(int x, int y, int button){ 52 | 53 | } 54 | 55 | //-------------------------------------------------------------- 56 | void ofApp::mousePressed(int x, int y, int button){ 57 | 58 | } 59 | 60 | //-------------------------------------------------------------- 61 | void ofApp::mouseReleased(int x, int y, int button){ 62 | 63 | } 64 | 65 | //-------------------------------------------------------------- 66 | void ofApp::mouseEntered(int x, int y){ 67 | 68 | } 69 | 70 | //-------------------------------------------------------------- 71 | void ofApp::mouseExited(int x, int y){ 72 | 73 | } 74 | 75 | //-------------------------------------------------------------- 76 | void ofApp::windowResized(int w, int h){ 77 | 78 | } 79 | 80 | //-------------------------------------------------------------- 81 | void ofApp::gotMessage(ofMessage msg){ 82 | 83 | } 84 | 85 | //-------------------------------------------------------------- 86 | void ofApp::dragEvent(ofDragInfo dragInfo){ 87 | 88 | } 89 | -------------------------------------------------------------------------------- /02_ofxCvGui/02_ofxCvGui_Step4/src/ofApp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofxCvGui.h" 4 | 5 | #include "ofMain.h" 6 | 7 | class ofApp : public ofBaseApp{ 8 | 9 | public: 10 | void setup(); 11 | void update(); 12 | void draw(); 13 | 14 | void keyPressed(int key); 15 | void keyReleased(int key); 16 | void mouseMoved(int x, int y ); 17 | void mouseDragged(int x, int y, int button); 18 | void mousePressed(int x, int y, int button); 19 | void mouseReleased(int x, int y, int button); 20 | void mouseEntered(int x, int y); 21 | void mouseExited(int x, int y); 22 | void windowResized(int w, int h); 23 | void dragEvent(ofDragInfo dragInfo); 24 | void gotMessage(ofMessage msg); 25 | 26 | ofxCvGui::Builder gui; 27 | 28 | ofVideoGrabber video; 29 | ofImage inverted; 30 | }; 31 | -------------------------------------------------------------------------------- /02_ofxCvGui/readme.md: -------------------------------------------------------------------------------- 1 | # 02_ofxCvGui 2 | 3 | ## Introducing 4 | 5 | * ofxCvGui 6 | 7 | ## Steps 8 | 9 | ### 1. Include all the necessary addons for ofxCvGui 10 | 11 | * ofxAssets 12 | * ofxCvGui 13 | * ofxGrabCam 14 | * ofxLiquidEvent 15 | * ofxSingleton 16 | * ofxTextInputField 17 | 18 | ### 2. Build a GUI with a single panel showing the current camera feed 19 | 20 | * Include "ofxCvGui.h" 21 | * In `ofApp` add `ofxCvGui::Builder gui` 22 | * In `ofApp` add `ofVideoGrabber video` 23 | * In `ofApp::setup()` call `this->video.initGrabber(1280, 720)` 24 | * In `ofApp::setup()` call `this->gui.init()` 25 | * In `ofApp::setup()` call `this->gui.add(this->video, "Camera")` to add a panel for the camera 26 | * In `ofApp::update()` call `this->video.update()` 27 | * Note the 1:1 and Stretch zoom functions and the navigator 28 | * Note 'f' to toggle fullscreen 29 | 30 | ### 3. Add a second panel with an inverse image 31 | 32 | * Add `ofImage inverted` to `ofApp` 33 | * Add `inverted` to the gui 34 | * Calculate the inverted image (tip : use `for(auto & pixel : this->video.getPixels()) {...}`) 35 | * Note 'm' to maximise a panel 36 | 37 | ### 4. Add an instuctions panel 38 | 39 | * Add `this->gui.addInstructions()` 40 | * Make an `instructions.txt` file in your `bin/data` folder and add some notes there 41 | 42 | ## Style notes 43 | 44 | ### Including addons 45 | 46 | * With Visual Studio we include the addons as projects rather than as bare files (this helps keep them up to date with any latest changes, and can improve build speeds). 47 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step0/03_ofxCvGuiAdvanced.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 14 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "03_ofxCvGuiAdvanced", "03_ofxCvGuiAdvanced.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 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step0/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 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step0/Project.xcconfig: -------------------------------------------------------------------------------- 1 | //THE PATH TO THE ROOT OF OUR OF PATH RELATIVE TO THIS PROJECT. 2 | //THIS NEEDS TO BE DEFINED BEFORE CoreOF.xcconfig IS INCLUDED 3 | OF_PATH = ../../.. 4 | 5 | //THIS HAS ALL THE HEADER AND LIBS FOR OF CORE 6 | #include "../../../libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig" 7 | 8 | //ICONS - NEW IN 0072 9 | ICON_NAME_DEBUG = icon-debug.icns 10 | ICON_NAME_RELEASE = icon.icns 11 | ICON_FILE_PATH = $(OF_PATH)/libs/openFrameworksCompiled/project/osx/ 12 | 13 | //IF YOU WANT AN APP TO HAVE A CUSTOM ICON - PUT THEM IN YOUR DATA FOLDER AND CHANGE ICON_FILE_PATH to: 14 | //ICON_FILE_PATH = bin/data/ 15 | 16 | OTHER_LDFLAGS = $(OF_CORE_LIBS) $(OF_CORE_FRAMEWORKS) 17 | HEADER_SEARCH_PATHS = $(OF_CORE_HEADERS) 18 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step0/addons.make: -------------------------------------------------------------------------------- 1 | ofxAssets 2 | ofxCvGui 3 | ofxGrabCam 4 | ofxLiquidEvent 5 | ofxSingleton 6 | ofxTextInputField 7 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step0/icon.rc: -------------------------------------------------------------------------------- 1 | // Icon Resource Definition 2 | #define MAIN_ICON 102 3 | 4 | #if defined(_DEBUG) 5 | MAIN_ICON ICON "icon_debug.ico" 6 | #else 7 | MAIN_ICON ICON "icon.ico" 8 | #endif 9 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step0/openFrameworks-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | cc.openFrameworks.ofapp 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | APPL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | CFBundleIconFile 20 | ${ICON} 21 | 22 | 23 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step0/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ofMain.h" 2 | #include "ofApp.h" 3 | 4 | //======================================================================== 5 | int main( ){ 6 | ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context 7 | 8 | // this kicks off the running of my app 9 | // can be OF_WINDOW or OF_FULLSCREEN 10 | // pass in width and height too: 11 | ofRunApp(new ofApp()); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step0/src/ofApp.cpp: -------------------------------------------------------------------------------- 1 | #include "ofApp.h" 2 | 3 | //-------------------------------------------------------------- 4 | void ofApp::setup(){ 5 | 6 | } 7 | 8 | //-------------------------------------------------------------- 9 | void ofApp::update(){ 10 | 11 | } 12 | 13 | //-------------------------------------------------------------- 14 | void ofApp::draw(){ 15 | 16 | } 17 | 18 | //-------------------------------------------------------------- 19 | void ofApp::keyPressed(int key){ 20 | 21 | } 22 | 23 | //-------------------------------------------------------------- 24 | void ofApp::keyReleased(int key){ 25 | 26 | } 27 | 28 | //-------------------------------------------------------------- 29 | void ofApp::mouseMoved(int x, int y ){ 30 | 31 | } 32 | 33 | //-------------------------------------------------------------- 34 | void ofApp::mouseDragged(int x, int y, int button){ 35 | 36 | } 37 | 38 | //-------------------------------------------------------------- 39 | void ofApp::mousePressed(int x, int y, int button){ 40 | 41 | } 42 | 43 | //-------------------------------------------------------------- 44 | void ofApp::mouseReleased(int x, int y, int button){ 45 | 46 | } 47 | 48 | //-------------------------------------------------------------- 49 | void ofApp::mouseEntered(int x, int y){ 50 | 51 | } 52 | 53 | //-------------------------------------------------------------- 54 | void ofApp::mouseExited(int x, int y){ 55 | 56 | } 57 | 58 | //-------------------------------------------------------------- 59 | void ofApp::windowResized(int w, int h){ 60 | 61 | } 62 | 63 | //-------------------------------------------------------------- 64 | void ofApp::gotMessage(ofMessage msg){ 65 | 66 | } 67 | 68 | //-------------------------------------------------------------- 69 | void ofApp::dragEvent(ofDragInfo dragInfo){ 70 | 71 | } 72 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step0/src/ofApp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofMain.h" 4 | 5 | class ofApp : public ofBaseApp{ 6 | 7 | public: 8 | void setup(); 9 | void update(); 10 | void draw(); 11 | 12 | void keyPressed(int key); 13 | void keyReleased(int key); 14 | void mouseMoved(int x, int y ); 15 | void mouseDragged(int x, int y, int button); 16 | void mousePressed(int x, int y, int button); 17 | void mouseReleased(int x, int y, int button); 18 | void mouseEntered(int x, int y); 19 | void mouseExited(int x, int y); 20 | void windowResized(int w, int h); 21 | void dragEvent(ofDragInfo dragInfo); 22 | void gotMessage(ofMessage msg); 23 | 24 | }; 25 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step1/03_ofxCvGuiAdvanced.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 14 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "03_ofxCvGuiAdvanced", "03_ofxCvGuiAdvanced.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 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step1/03_ofxCvGuiAdvanced.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step1/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 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step1/Project.xcconfig: -------------------------------------------------------------------------------- 1 | //THE PATH TO THE ROOT OF OUR OF PATH RELATIVE TO THIS PROJECT. 2 | //THIS NEEDS TO BE DEFINED BEFORE CoreOF.xcconfig IS INCLUDED 3 | OF_PATH = ../../.. 4 | 5 | //THIS HAS ALL THE HEADER AND LIBS FOR OF CORE 6 | #include "../../../libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig" 7 | 8 | //ICONS - NEW IN 0072 9 | ICON_NAME_DEBUG = icon-debug.icns 10 | ICON_NAME_RELEASE = icon.icns 11 | ICON_FILE_PATH = $(OF_PATH)/libs/openFrameworksCompiled/project/osx/ 12 | 13 | //IF YOU WANT AN APP TO HAVE A CUSTOM ICON - PUT THEM IN YOUR DATA FOLDER AND CHANGE ICON_FILE_PATH to: 14 | //ICON_FILE_PATH = bin/data/ 15 | 16 | OTHER_LDFLAGS = $(OF_CORE_LIBS) $(OF_CORE_FRAMEWORKS) 17 | HEADER_SEARCH_PATHS = $(OF_CORE_HEADERS) 18 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step1/addons.make: -------------------------------------------------------------------------------- 1 | ofxAssets 2 | ofxCvGui 3 | ofxGrabCam 4 | ofxLiquidEvent 5 | ofxSingleton 6 | ofxTextInputField 7 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step1/icon.rc: -------------------------------------------------------------------------------- 1 | // Icon Resource Definition 2 | #define MAIN_ICON 102 3 | 4 | #if defined(_DEBUG) 5 | MAIN_ICON ICON "icon_debug.ico" 6 | #else 7 | MAIN_ICON ICON "icon.ico" 8 | #endif 9 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step1/openFrameworks-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | cc.openFrameworks.ofapp 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | APPL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | CFBundleIconFile 20 | ${ICON} 21 | 22 | 23 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step1/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ofMain.h" 2 | #include "ofApp.h" 3 | 4 | //======================================================================== 5 | int main( ){ 6 | ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context 7 | 8 | // this kicks off the running of my app 9 | // can be OF_WINDOW or OF_FULLSCREEN 10 | // pass in width and height too: 11 | ofRunApp(new ofApp()); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step1/src/ofApp.cpp: -------------------------------------------------------------------------------- 1 | #include "ofApp.h" 2 | 3 | //-------------------------------------------------------------- 4 | void ofApp::setup(){ 5 | this->gui.init(); 6 | this->gui.addWorld("World"); 7 | this->gui.addScroll("Widgets"); 8 | } 9 | 10 | //-------------------------------------------------------------- 11 | void ofApp::update(){ 12 | 13 | } 14 | 15 | //-------------------------------------------------------------- 16 | void ofApp::draw(){ 17 | 18 | } 19 | 20 | //-------------------------------------------------------------- 21 | void ofApp::keyPressed(int key){ 22 | 23 | } 24 | 25 | //-------------------------------------------------------------- 26 | void ofApp::keyReleased(int key){ 27 | 28 | } 29 | 30 | //-------------------------------------------------------------- 31 | void ofApp::mouseMoved(int x, int y ){ 32 | 33 | } 34 | 35 | //-------------------------------------------------------------- 36 | void ofApp::mouseDragged(int x, int y, int button){ 37 | 38 | } 39 | 40 | //-------------------------------------------------------------- 41 | void ofApp::mousePressed(int x, int y, int button){ 42 | 43 | } 44 | 45 | //-------------------------------------------------------------- 46 | void ofApp::mouseReleased(int x, int y, int button){ 47 | 48 | } 49 | 50 | //-------------------------------------------------------------- 51 | void ofApp::mouseEntered(int x, int y){ 52 | 53 | } 54 | 55 | //-------------------------------------------------------------- 56 | void ofApp::mouseExited(int x, int y){ 57 | 58 | } 59 | 60 | //-------------------------------------------------------------- 61 | void ofApp::windowResized(int w, int h){ 62 | 63 | } 64 | 65 | //-------------------------------------------------------------- 66 | void ofApp::gotMessage(ofMessage msg){ 67 | 68 | } 69 | 70 | //-------------------------------------------------------------- 71 | void ofApp::dragEvent(ofDragInfo dragInfo){ 72 | 73 | } 74 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step1/src/ofApp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofMain.h" 4 | #include "ofxCvGui.h" 5 | 6 | class ofApp : public ofBaseApp{ 7 | 8 | public: 9 | void setup(); 10 | void update(); 11 | void draw(); 12 | 13 | void keyPressed(int key); 14 | void keyReleased(int key); 15 | void mouseMoved(int x, int y ); 16 | void mouseDragged(int x, int y, int button); 17 | void mousePressed(int x, int y, int button); 18 | void mouseReleased(int x, int y, int button); 19 | void mouseEntered(int x, int y); 20 | void mouseExited(int x, int y); 21 | void windowResized(int w, int h); 22 | void dragEvent(ofDragInfo dragInfo); 23 | void gotMessage(ofMessage msg); 24 | 25 | ofxCvGui::Builder gui; 26 | }; 27 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step2/03_ofxCvGuiAdvanced.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 14 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "03_ofxCvGuiAdvanced", "03_ofxCvGuiAdvanced.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 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step2/03_ofxCvGuiAdvanced.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step2/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 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step2/Project.xcconfig: -------------------------------------------------------------------------------- 1 | //THE PATH TO THE ROOT OF OUR OF PATH RELATIVE TO THIS PROJECT. 2 | //THIS NEEDS TO BE DEFINED BEFORE CoreOF.xcconfig IS INCLUDED 3 | OF_PATH = ../../.. 4 | 5 | //THIS HAS ALL THE HEADER AND LIBS FOR OF CORE 6 | #include "../../../libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig" 7 | 8 | //ICONS - NEW IN 0072 9 | ICON_NAME_DEBUG = icon-debug.icns 10 | ICON_NAME_RELEASE = icon.icns 11 | ICON_FILE_PATH = $(OF_PATH)/libs/openFrameworksCompiled/project/osx/ 12 | 13 | //IF YOU WANT AN APP TO HAVE A CUSTOM ICON - PUT THEM IN YOUR DATA FOLDER AND CHANGE ICON_FILE_PATH to: 14 | //ICON_FILE_PATH = bin/data/ 15 | 16 | OTHER_LDFLAGS = $(OF_CORE_LIBS) $(OF_CORE_FRAMEWORKS) 17 | HEADER_SEARCH_PATHS = $(OF_CORE_HEADERS) 18 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step2/addons.make: -------------------------------------------------------------------------------- 1 | ofxAssets 2 | ofxCvGui 3 | ofxGrabCam 4 | ofxLiquidEvent 5 | ofxSingleton 6 | ofxTextInputField 7 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step2/icon.rc: -------------------------------------------------------------------------------- 1 | // Icon Resource Definition 2 | #define MAIN_ICON 102 3 | 4 | #if defined(_DEBUG) 5 | MAIN_ICON ICON "icon_debug.ico" 6 | #else 7 | MAIN_ICON ICON "icon.ico" 8 | #endif 9 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step2/openFrameworks-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | cc.openFrameworks.ofapp 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | APPL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | CFBundleIconFile 20 | ${ICON} 21 | 22 | 23 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step2/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ofMain.h" 2 | #include "ofApp.h" 3 | 4 | //======================================================================== 5 | int main( ){ 6 | ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context 7 | 8 | // this kicks off the running of my app 9 | // can be OF_WINDOW or OF_FULLSCREEN 10 | // pass in width and height too: 11 | ofRunApp(new ofApp()); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step2/src/ofApp.cpp: -------------------------------------------------------------------------------- 1 | #include "ofApp.h" 2 | 3 | #pragma mark Sphere 4 | //------------------------------------------------------------- 5 | Sphere::Sphere() { 6 | this->xyz[0].set("X", ofRandom(-10.0f, 10.0f), -10, +10); 7 | this->xyz[1].set("Y", ofRandom(-10.0f, 10.0f), -10, +10); 8 | this->xyz[2].set("Z", ofRandom(-10.0f, 10.0f), -10, +10); 9 | this->radius.set("Radius", ofRandom(1.0f), 0.0f, 10.0f); 10 | this->hue.set("Hue", ofRandom(360.0f), 0.0f, 360.0f); 11 | } 12 | 13 | void Sphere::draw() { 14 | ofPushStyle(); 15 | { 16 | auto col = ofColor(200, 100, 100); 17 | col.setHue(this->hue); 18 | ofSetColor(col); 19 | ofDrawSphere(this->xyz[0], this->xyz[1], this->xyz[2], this->radius); 20 | } 21 | ofPopStyle(); 22 | } 23 | 24 | #pragma mark ofApp 25 | //-------------------------------------------------------------- 26 | void ofApp::setup(){ 27 | this->gui.init(); 28 | auto world = this->gui.addWorld("World"); 29 | this->gui.addScroll("Widgets"); 30 | 31 | 32 | this->spheres.resize(10); 33 | 34 | world->onDrawWorld += [this](ofCamera &) { 35 | for(auto & sphere : this->spheres) { 36 | sphere.draw(); 37 | } 38 | }; 39 | } 40 | 41 | //-------------------------------------------------------------- 42 | void ofApp::update(){ 43 | 44 | } 45 | 46 | //-------------------------------------------------------------- 47 | void ofApp::draw(){ 48 | 49 | } 50 | 51 | //-------------------------------------------------------------- 52 | void ofApp::keyPressed(int key){ 53 | 54 | } 55 | 56 | //-------------------------------------------------------------- 57 | void ofApp::keyReleased(int key){ 58 | 59 | } 60 | 61 | //-------------------------------------------------------------- 62 | void ofApp::mouseMoved(int x, int y ){ 63 | 64 | } 65 | 66 | //-------------------------------------------------------------- 67 | void ofApp::mouseDragged(int x, int y, int button){ 68 | 69 | } 70 | 71 | //-------------------------------------------------------------- 72 | void ofApp::mousePressed(int x, int y, int button){ 73 | 74 | } 75 | 76 | //-------------------------------------------------------------- 77 | void ofApp::mouseReleased(int x, int y, int button){ 78 | 79 | } 80 | 81 | //-------------------------------------------------------------- 82 | void ofApp::mouseEntered(int x, int y){ 83 | 84 | } 85 | 86 | //-------------------------------------------------------------- 87 | void ofApp::mouseExited(int x, int y){ 88 | 89 | } 90 | 91 | //-------------------------------------------------------------- 92 | void ofApp::windowResized(int w, int h){ 93 | 94 | } 95 | 96 | //-------------------------------------------------------------- 97 | void ofApp::gotMessage(ofMessage msg){ 98 | 99 | } 100 | 101 | //-------------------------------------------------------------- 102 | void ofApp::dragEvent(ofDragInfo dragInfo){ 103 | 104 | } 105 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step2/src/ofApp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofMain.h" 4 | #include "ofxCvGui.h" 5 | 6 | class Sphere { 7 | public: 8 | Sphere(); 9 | void draw(); 10 | ofParameter xyz[3]; 11 | ofParameter radius; 12 | ofParameter hue; 13 | }; 14 | 15 | class ofApp : public ofBaseApp{ 16 | 17 | public: 18 | void setup(); 19 | void update(); 20 | void draw(); 21 | 22 | void keyPressed(int key); 23 | void keyReleased(int key); 24 | void mouseMoved(int x, int y ); 25 | void mouseDragged(int x, int y, int button); 26 | void mousePressed(int x, int y, int button); 27 | void mouseReleased(int x, int y, int button); 28 | void mouseEntered(int x, int y); 29 | void mouseExited(int x, int y); 30 | void windowResized(int w, int h); 31 | void dragEvent(ofDragInfo dragInfo); 32 | void gotMessage(ofMessage msg); 33 | 34 | ofxCvGui::Builder gui; 35 | vector spheres; 36 | }; 37 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step3/03_ofxCvGuiAdvanced.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 14 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "03_ofxCvGuiAdvanced", "03_ofxCvGuiAdvanced.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 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step3/03_ofxCvGuiAdvanced.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step3/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 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step3/Project.xcconfig: -------------------------------------------------------------------------------- 1 | //THE PATH TO THE ROOT OF OUR OF PATH RELATIVE TO THIS PROJECT. 2 | //THIS NEEDS TO BE DEFINED BEFORE CoreOF.xcconfig IS INCLUDED 3 | OF_PATH = ../../.. 4 | 5 | //THIS HAS ALL THE HEADER AND LIBS FOR OF CORE 6 | #include "../../../libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig" 7 | 8 | //ICONS - NEW IN 0072 9 | ICON_NAME_DEBUG = icon-debug.icns 10 | ICON_NAME_RELEASE = icon.icns 11 | ICON_FILE_PATH = $(OF_PATH)/libs/openFrameworksCompiled/project/osx/ 12 | 13 | //IF YOU WANT AN APP TO HAVE A CUSTOM ICON - PUT THEM IN YOUR DATA FOLDER AND CHANGE ICON_FILE_PATH to: 14 | //ICON_FILE_PATH = bin/data/ 15 | 16 | OTHER_LDFLAGS = $(OF_CORE_LIBS) $(OF_CORE_FRAMEWORKS) 17 | HEADER_SEARCH_PATHS = $(OF_CORE_HEADERS) 18 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step3/addons.make: -------------------------------------------------------------------------------- 1 | ofxAssets 2 | ofxCvGui 3 | ofxGrabCam 4 | ofxLiquidEvent 5 | ofxSingleton 6 | ofxTextInputField 7 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step3/icon.rc: -------------------------------------------------------------------------------- 1 | // Icon Resource Definition 2 | #define MAIN_ICON 102 3 | 4 | #if defined(_DEBUG) 5 | MAIN_ICON ICON "icon_debug.ico" 6 | #else 7 | MAIN_ICON ICON "icon.ico" 8 | #endif 9 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step3/openFrameworks-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | cc.openFrameworks.ofapp 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | APPL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | CFBundleIconFile 20 | ${ICON} 21 | 22 | 23 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step3/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ofMain.h" 2 | #include "ofApp.h" 3 | 4 | //======================================================================== 5 | int main( ){ 6 | ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context 7 | 8 | // this kicks off the running of my app 9 | // can be OF_WINDOW or OF_FULLSCREEN 10 | // pass in width and height too: 11 | ofRunApp(new ofApp()); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step3/src/ofApp.cpp: -------------------------------------------------------------------------------- 1 | #include "ofApp.h" 2 | 3 | #pragma mark Sphere 4 | //------------------------------------------------------------- 5 | Sphere::Sphere() { 6 | this->xyz[0].set("X", ofRandom(-10.0f, 10.0f), -10, +10); 7 | this->xyz[1].set("Y", ofRandom(-10.0f, 10.0f), -10, +10); 8 | this->xyz[2].set("Z", ofRandom(-10.0f, 10.0f), -10, +10); 9 | this->radius.set("Radius", ofRandom(1.0f), 0.0f, 10.0f); 10 | this->hue.set("Hue", ofRandom(360.0f), 0.0f, 360.0f); 11 | } 12 | 13 | void Sphere::draw() { 14 | ofPushStyle(); 15 | { 16 | auto col = ofColor(200, 100, 100); 17 | col.setHue(this->hue); 18 | ofSetColor(col); 19 | ofDrawSphere(this->xyz[0], this->xyz[1], this->xyz[2], this->radius); 20 | } 21 | ofPopStyle(); 22 | } 23 | 24 | #pragma mark ofApp 25 | //-------------------------------------------------------------- 26 | void ofApp::setup(){ 27 | this->gui.init(); 28 | auto world = this->gui.addWorld("World"); 29 | auto widgets = this->gui.addScroll("Widgets"); 30 | 31 | 32 | this->spheres.resize(10); 33 | 34 | world->onDrawWorld += [this](ofCamera &) { 35 | for(auto & sphere : this->spheres) { 36 | sphere.draw(); 37 | } 38 | }; 39 | 40 | for(auto & sphere : this->spheres) { 41 | widgets->add(ofxCvGui::Widgets::Title::make("Sphere")); 42 | 43 | for(int i=0; i<3; i++) { 44 | widgets->add(ofxCvGui::Widgets::Slider::make(sphere.xyz[i])); 45 | } 46 | 47 | widgets->add(ofxCvGui::Widgets::Slider::make(sphere.radius)); 48 | widgets->add(ofxCvGui::Widgets::Slider::make(sphere.hue)); 49 | } 50 | } 51 | 52 | //-------------------------------------------------------------- 53 | void ofApp::update(){ 54 | 55 | } 56 | 57 | //-------------------------------------------------------------- 58 | void ofApp::draw(){ 59 | 60 | } 61 | 62 | //-------------------------------------------------------------- 63 | void ofApp::keyPressed(int key){ 64 | 65 | } 66 | 67 | //-------------------------------------------------------------- 68 | void ofApp::keyReleased(int key){ 69 | 70 | } 71 | 72 | //-------------------------------------------------------------- 73 | void ofApp::mouseMoved(int x, int y ){ 74 | 75 | } 76 | 77 | //-------------------------------------------------------------- 78 | void ofApp::mouseDragged(int x, int y, int button){ 79 | 80 | } 81 | 82 | //-------------------------------------------------------------- 83 | void ofApp::mousePressed(int x, int y, int button){ 84 | 85 | } 86 | 87 | //-------------------------------------------------------------- 88 | void ofApp::mouseReleased(int x, int y, int button){ 89 | 90 | } 91 | 92 | //-------------------------------------------------------------- 93 | void ofApp::mouseEntered(int x, int y){ 94 | 95 | } 96 | 97 | //-------------------------------------------------------------- 98 | void ofApp::mouseExited(int x, int y){ 99 | 100 | } 101 | 102 | //-------------------------------------------------------------- 103 | void ofApp::windowResized(int w, int h){ 104 | 105 | } 106 | 107 | //-------------------------------------------------------------- 108 | void ofApp::gotMessage(ofMessage msg){ 109 | 110 | } 111 | 112 | //-------------------------------------------------------------- 113 | void ofApp::dragEvent(ofDragInfo dragInfo){ 114 | 115 | } 116 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step3/src/ofApp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofMain.h" 4 | #include "ofxCvGui.h" 5 | 6 | class Sphere { 7 | public: 8 | Sphere(); 9 | void draw(); 10 | ofParameter xyz[3]; 11 | ofParameter radius; 12 | ofParameter hue; 13 | }; 14 | 15 | class ofApp : public ofBaseApp{ 16 | 17 | public: 18 | void setup(); 19 | void update(); 20 | void draw(); 21 | 22 | void keyPressed(int key); 23 | void keyReleased(int key); 24 | void mouseMoved(int x, int y ); 25 | void mouseDragged(int x, int y, int button); 26 | void mousePressed(int x, int y, int button); 27 | void mouseReleased(int x, int y, int button); 28 | void mouseEntered(int x, int y); 29 | void mouseExited(int x, int y); 30 | void windowResized(int w, int h); 31 | void dragEvent(ofDragInfo dragInfo); 32 | void gotMessage(ofMessage msg); 33 | 34 | ofxCvGui::Builder gui; 35 | vector spheres; 36 | }; 37 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step4/03_ofxCvGuiAdvanced.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 14 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "03_ofxCvGuiAdvanced", "03_ofxCvGuiAdvanced.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 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step4/03_ofxCvGuiAdvanced.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step4/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 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step4/Project.xcconfig: -------------------------------------------------------------------------------- 1 | //THE PATH TO THE ROOT OF OUR OF PATH RELATIVE TO THIS PROJECT. 2 | //THIS NEEDS TO BE DEFINED BEFORE CoreOF.xcconfig IS INCLUDED 3 | OF_PATH = ../../.. 4 | 5 | //THIS HAS ALL THE HEADER AND LIBS FOR OF CORE 6 | #include "../../../libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig" 7 | 8 | //ICONS - NEW IN 0072 9 | ICON_NAME_DEBUG = icon-debug.icns 10 | ICON_NAME_RELEASE = icon.icns 11 | ICON_FILE_PATH = $(OF_PATH)/libs/openFrameworksCompiled/project/osx/ 12 | 13 | //IF YOU WANT AN APP TO HAVE A CUSTOM ICON - PUT THEM IN YOUR DATA FOLDER AND CHANGE ICON_FILE_PATH to: 14 | //ICON_FILE_PATH = bin/data/ 15 | 16 | OTHER_LDFLAGS = $(OF_CORE_LIBS) $(OF_CORE_FRAMEWORKS) 17 | HEADER_SEARCH_PATHS = $(OF_CORE_HEADERS) 18 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step4/addons.make: -------------------------------------------------------------------------------- 1 | ofxAssets 2 | ofxCvGui 3 | ofxGrabCam 4 | ofxLiquidEvent 5 | ofxSingleton 6 | ofxTextInputField 7 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step4/icon.rc: -------------------------------------------------------------------------------- 1 | // Icon Resource Definition 2 | #define MAIN_ICON 102 3 | 4 | #if defined(_DEBUG) 5 | MAIN_ICON ICON "icon_debug.ico" 6 | #else 7 | MAIN_ICON ICON "icon.ico" 8 | #endif 9 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step4/openFrameworks-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | cc.openFrameworks.ofapp 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | APPL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | CFBundleIconFile 20 | ${ICON} 21 | 22 | 23 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step4/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ofMain.h" 2 | #include "ofApp.h" 3 | 4 | //======================================================================== 5 | int main( ){ 6 | ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context 7 | 8 | // this kicks off the running of my app 9 | // can be OF_WINDOW or OF_FULLSCREEN 10 | // pass in width and height too: 11 | ofRunApp(new ofApp()); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step4/src/ofApp.cpp: -------------------------------------------------------------------------------- 1 | #include "ofApp.h" 2 | 3 | #pragma mark Sphere 4 | //------------------------------------------------------------- 5 | Sphere::Sphere() { 6 | this->xyz[0].set("X", ofRandom(-10.0f, 10.0f), -10, +10); 7 | this->xyz[1].set("Y", ofRandom(-10.0f, 10.0f), -10, +10); 8 | this->xyz[2].set("Z", ofRandom(-10.0f, 10.0f), -10, +10); 9 | this->radius.set("Radius", ofRandom(1.0f), 0.0f, 10.0f); 10 | this->hue.set("Hue", ofRandom(360.0f), 0.0f, 360.0f); 11 | } 12 | 13 | void Sphere::draw() { 14 | ofPushStyle(); 15 | { 16 | auto col = ofColor(200, 100, 100); 17 | col.setHue(this->hue); 18 | ofSetColor(col); 19 | ofDrawSphere(this->xyz[0], this->xyz[1], this->xyz[2], this->radius); 20 | } 21 | ofPopStyle(); 22 | } 23 | 24 | #pragma mark ofApp 25 | //-------------------------------------------------------------- 26 | void ofApp::setup(){ 27 | this->gui.init(); 28 | auto world = this->gui.addWorld("World"); 29 | auto widgets = this->gui.addScroll("Widgets"); 30 | 31 | 32 | this->spheres.resize(10); 33 | 34 | world->onDrawWorld += [this](ofCamera &) { 35 | for(auto & sphere : this->spheres) { 36 | sphere.draw(); 37 | } 38 | }; 39 | 40 | for(auto & sphere : this->spheres) { 41 | widgets->add(ofxCvGui::Widgets::Title::make("Sphere")); 42 | 43 | for(int i=0; i<3; i++) { 44 | widgets->add(ofxCvGui::Widgets::Slider::make(sphere.xyz[i])); 45 | } 46 | 47 | widgets->add(ofxCvGui::Widgets::Slider::make(sphere.radius)); 48 | widgets->add(ofxCvGui::Widgets::Slider::make(sphere.hue)); 49 | } 50 | } 51 | 52 | //-------------------------------------------------------------- 53 | void ofApp::update(){ 54 | 55 | } 56 | 57 | //-------------------------------------------------------------- 58 | void ofApp::draw(){ 59 | 60 | } 61 | 62 | //-------------------------------------------------------------- 63 | void ofApp::keyPressed(int key){ 64 | 65 | } 66 | 67 | //-------------------------------------------------------------- 68 | void ofApp::keyReleased(int key){ 69 | 70 | } 71 | 72 | //-------------------------------------------------------------- 73 | void ofApp::mouseMoved(int x, int y ){ 74 | 75 | } 76 | 77 | //-------------------------------------------------------------- 78 | void ofApp::mouseDragged(int x, int y, int button){ 79 | 80 | } 81 | 82 | //-------------------------------------------------------------- 83 | void ofApp::mousePressed(int x, int y, int button){ 84 | 85 | } 86 | 87 | //-------------------------------------------------------------- 88 | void ofApp::mouseReleased(int x, int y, int button){ 89 | 90 | } 91 | 92 | //-------------------------------------------------------------- 93 | void ofApp::mouseEntered(int x, int y){ 94 | 95 | } 96 | 97 | //-------------------------------------------------------------- 98 | void ofApp::mouseExited(int x, int y){ 99 | 100 | } 101 | 102 | //-------------------------------------------------------------- 103 | void ofApp::windowResized(int w, int h){ 104 | 105 | } 106 | 107 | //-------------------------------------------------------------- 108 | void ofApp::gotMessage(ofMessage msg){ 109 | 110 | } 111 | 112 | //-------------------------------------------------------------- 113 | void ofApp::dragEvent(ofDragInfo dragInfo){ 114 | 115 | } 116 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/03_ofxCvGuiAdvanced_Step4/src/ofApp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofMain.h" 4 | #include "ofxCvGui.h" 5 | 6 | class Sphere { 7 | public: 8 | Sphere(); 9 | void draw(); 10 | ofParameter xyz[3]; 11 | ofParameter radius; 12 | ofParameter hue; 13 | }; 14 | 15 | class ofApp : public ofBaseApp{ 16 | 17 | public: 18 | void setup(); 19 | void update(); 20 | void draw(); 21 | 22 | void keyPressed(int key); 23 | void keyReleased(int key); 24 | void mouseMoved(int x, int y ); 25 | void mouseDragged(int x, int y, int button); 26 | void mousePressed(int x, int y, int button); 27 | void mouseReleased(int x, int y, int button); 28 | void mouseEntered(int x, int y); 29 | void mouseExited(int x, int y); 30 | void windowResized(int w, int h); 31 | void dragEvent(ofDragInfo dragInfo); 32 | void gotMessage(ofMessage msg); 33 | 34 | ofxCvGui::Builder gui; 35 | vector spheres; 36 | }; 37 | -------------------------------------------------------------------------------- /03_ofxCvGuiAdvanced/readme.md: -------------------------------------------------------------------------------- 1 | # 02_ofxCvGuiAdvanced 2 | 3 | ## Introducing 4 | 5 | * Widgets 6 | * Adding `Element`s to `Panel`s 7 | * 3D panels 8 | 9 | 10 | ## Steps 11 | 12 | ### 0. Include all the necessary addons for ofxCvGui 13 | 14 | * ofxAssets 15 | * ofxCvGui 16 | * ofxGrabCam 17 | * ofxLiquidEvent 18 | * ofxSingleton 19 | * ofxTextInputField 20 | 21 | ### 1. Add a `World ` and a `Scroll` panel 22 | 23 | * Add a `gui` instance to `ofApp` 24 | * In `ofApp::setup` call `gui->init()` 25 | * In `ofApp::setup` call `gui->addWorld()` 26 | * In `ofApp::setup` call `gui->addScroll()` 27 | * Give them both captions 28 | 29 | ### 2. Draw a sphere and make some controls for it 30 | 31 | * Make a class Sphere 32 | * Add an array of float parameters `ofParameter xyz[3]` 33 | * Add parameters for radius and hue 34 | * Add a constructor which sets up the parameters 35 | * Add a `vector spheres` to `ofApp` 36 | * Write a draw function for `Sphere` 37 | * In `ofApp::setup` make 10 spheres 38 | * In `ofApp::setup` add a lister to draw the spheres on the `World` panel 39 | 40 | ### 3. Add widgets for all the spheres 41 | 42 | * In `ofApp::setup` get a pointer to the new scroll panel we're creating 43 | * For each sphere add a title to the widgets panel ` widgets->add(ofxCvGui::Widgets::Title::make("Sphere"));` 44 | * Use similar syntax to add the parameters of the spheres to the widgets panel 45 | * Play with the result 46 | 47 | ### 4. Define HAS_OFXGRABCAM 48 | 49 | These instructions are for mac. For Windows this will happen automatically if you use the `ofxCvGuiLib` project and property sheets. 50 | 51 | * : go to project Build Settings 52 | * Go to 'All' not 'Basic' 53 | * Add `HAS_OFXGRABCAM` to `Preprocessor Macros` 54 | 55 | 56 | ### Including addons 57 | --------------------------------------------------------------------------------