├── .gitignore ├── README.md ├── Session1 ├── 01-Data-Pointers-Classes │ ├── 01 - BasicPointers │ │ ├── BasicPointers.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ ├── xcshareddata │ │ │ │ │ ├── BasicPointers.xccheckout │ │ │ │ │ └── BasicPointers.xcscmblueprint │ │ │ │ └── xcuserdata │ │ │ │ │ ├── Craig.xcuserdatad │ │ │ │ │ └── UserInterfaceState.xcuserstate │ │ │ │ │ ├── destructor.xcuserdatad │ │ │ │ │ └── UserInterfaceState.xcuserstate │ │ │ │ │ └── ryanbartley.xcuserdatad │ │ │ │ │ └── UserInterfaceState.xcuserstate │ │ │ └── xcuserdata │ │ │ │ ├── Craig.xcuserdatad │ │ │ │ └── xcschemes │ │ │ │ │ ├── BasicPointers.xcscheme │ │ │ │ │ └── xcschememanagement.plist │ │ │ │ ├── destructor.xcuserdatad │ │ │ │ └── xcschemes │ │ │ │ │ ├── BasicPointers.xcscheme │ │ │ │ │ └── xcschememanagement.plist │ │ │ │ └── ryanbartley.xcuserdatad │ │ │ │ └── xcschemes │ │ │ │ ├── BasicPointers.xcscheme │ │ │ │ └── xcschememanagement.plist │ │ └── BasicPointers │ │ │ ├── BasicPointers.1 │ │ │ └── main.cpp │ ├── 02 - NewDelete │ │ ├── newDelete.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ ├── xcshareddata │ │ │ │ │ ├── newDelete.xccheckout │ │ │ │ │ └── newDelete.xcscmblueprint │ │ │ │ └── xcuserdata │ │ │ │ │ ├── Craig.xcuserdatad │ │ │ │ │ └── UserInterfaceState.xcuserstate │ │ │ │ │ ├── destructor.xcuserdatad │ │ │ │ │ └── UserInterfaceState.xcuserstate │ │ │ │ │ └── ryanbartley.xcuserdatad │ │ │ │ │ └── UserInterfaceState.xcuserstate │ │ │ └── xcuserdata │ │ │ │ ├── Craig.xcuserdatad │ │ │ │ └── xcschemes │ │ │ │ │ ├── newDelete.xcscheme │ │ │ │ │ └── xcschememanagement.plist │ │ │ │ ├── destructor.xcuserdatad │ │ │ │ └── xcschemes │ │ │ │ │ ├── newDelete.xcscheme │ │ │ │ │ └── xcschememanagement.plist │ │ │ │ └── ryanbartley.xcuserdatad │ │ │ │ └── xcschemes │ │ │ │ ├── newDelete.xcscheme │ │ │ │ └── xcschememanagement.plist │ │ └── newDelete │ │ │ ├── main.cpp │ │ │ └── newDelete.1 │ ├── 03 - PointerArray │ │ ├── pointerArray.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ ├── xcshareddata │ │ │ │ │ └── pointerArray.xccheckout │ │ │ │ └── xcuserdata │ │ │ │ │ ├── Craig.xcuserdatad │ │ │ │ │ └── UserInterfaceState.xcuserstate │ │ │ │ │ ├── destructor.xcuserdatad │ │ │ │ │ └── UserInterfaceState.xcuserstate │ │ │ │ │ └── ryanbartley.xcuserdatad │ │ │ │ │ └── UserInterfaceState.xcuserstate │ │ │ └── xcuserdata │ │ │ │ ├── Craig.xcuserdatad │ │ │ │ └── xcschemes │ │ │ │ │ ├── pointerArray.xcscheme │ │ │ │ │ └── xcschememanagement.plist │ │ │ │ ├── destructor.xcuserdatad │ │ │ │ └── xcschemes │ │ │ │ │ ├── pointerArray.xcscheme │ │ │ │ │ └── xcschememanagement.plist │ │ │ │ └── ryanbartley.xcuserdatad │ │ │ │ └── xcschemes │ │ │ │ ├── pointerArray.xcscheme │ │ │ │ └── xcschememanagement.plist │ │ └── pointerArray │ │ │ ├── main.cpp │ │ │ └── pointerArray.1 │ ├── 04 - StdVector │ │ ├── stdVector.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ ├── xcshareddata │ │ │ │ │ └── stdVector.xccheckout │ │ │ │ └── xcuserdata │ │ │ │ │ ├── destructor.xcuserdatad │ │ │ │ │ └── UserInterfaceState.xcuserstate │ │ │ │ │ └── ryanbartley.xcuserdatad │ │ │ │ │ └── UserInterfaceState.xcuserstate │ │ │ └── xcuserdata │ │ │ │ ├── destructor.xcuserdatad │ │ │ │ └── xcschemes │ │ │ │ │ ├── stdVector.xcscheme │ │ │ │ │ └── xcschememanagement.plist │ │ │ │ └── ryanbartley.xcuserdatad │ │ │ │ └── xcschemes │ │ │ │ ├── stdVector.xcscheme │ │ │ │ └── xcschememanagement.plist │ │ └── stdVector │ │ │ ├── main.cpp │ │ │ └── stdVector.1 │ ├── 05 - PointersAndReferences │ │ ├── 05 - PointersAndReferences.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ ├── xcshareddata │ │ │ │ │ └── 05 - PointersAndReferences.xccheckout │ │ │ │ └── xcuserdata │ │ │ │ │ └── ryanbartley.xcuserdatad │ │ │ │ │ └── UserInterfaceState.xcuserstate │ │ │ └── xcuserdata │ │ │ │ └── ryanbartley.xcuserdatad │ │ │ │ └── xcschemes │ │ │ │ ├── 05 - PointersAndReferences.xcscheme │ │ │ │ └── xcschememanagement.plist │ │ └── 05 - PointersAndReferences │ │ │ └── main.cpp │ └── 06 - Circles │ │ ├── include │ │ ├── Circle.h │ │ └── Resources.h │ │ ├── resources │ │ ├── CinderApp.icns │ │ ├── CinderApp_ios.png │ │ └── cinder_app_icon.ico │ │ ├── src │ │ ├── Circle.cpp │ │ └── CirclesApp.cpp │ │ ├── vc2013 │ │ ├── Circles.sln │ │ ├── Circles.vcxproj │ │ ├── Circles.vcxproj.filters │ │ └── Resources.rc │ │ ├── xcode │ │ ├── Circles.xcodeproj │ │ │ └── project.pbxproj │ │ ├── Circles_Prefix.pch │ │ └── Info.plist │ │ └── xcode_ios │ │ ├── Circles.xcodeproj │ │ └── project.pbxproj │ │ ├── Circles_Prefix.pch │ │ ├── Default-568h@2x.png │ │ └── Info.plist └── README.md ├── Session2 ├── 02-Inheritance-Abstraction │ ├── 01 - Sizeof │ │ ├── Sizeof.xcodeproj │ │ │ └── project.pbxproj │ │ └── Sizeof │ │ │ ├── Sizeof.1 │ │ │ └── main.cpp │ ├── 02 - C-StyleCasting │ │ ├── C-StyleCasting.xcodeproj │ │ │ └── project.pbxproj │ │ └── C-StyleCasting │ │ │ ├── C_StyleCasting.1 │ │ │ └── main.cpp │ ├── 03 - BasicInheritance │ │ ├── BasicInheritance.xcodeproj │ │ │ └── project.pbxproj │ │ └── BasicInheritance │ │ │ └── main.cpp │ ├── 04 - Cpp11AndTypes │ │ ├── Cpp11AndTypes.xcodeproj │ │ │ └── project.pbxproj │ │ └── Cpp11AndTypes │ │ │ └── main.cpp │ └── 05 - DrawableShapes │ │ ├── include │ │ ├── Circle.h │ │ ├── DrawableShape.h │ │ ├── Resources.h │ │ └── Square.h │ │ ├── resources │ │ ├── CinderApp.icns │ │ ├── CinderApp_ios.png │ │ └── cinder_app_icon.ico │ │ ├── src │ │ ├── Circle.cpp │ │ ├── DrawableShape.cpp │ │ ├── DrawableShapesApp.cpp │ │ └── Square.cpp │ │ ├── vc2013 │ │ ├── DrawableShapes.sln │ │ ├── DrawableShapes.vcxproj │ │ ├── DrawableShapes.vcxproj.filters │ │ └── Resources.rc │ │ ├── xcode │ │ ├── DrawableShapes.xcodeproj │ │ │ └── project.pbxproj │ │ ├── DrawableShapes_Prefix.pch │ │ └── Info.plist │ │ └── xcode_ios │ │ ├── Default-568h@2x.png │ │ ├── DrawableShapes.xcodeproj │ │ └── project.pbxproj │ │ ├── DrawableShapes_Prefix.pch │ │ └── Info.plist └── README.md ├── Session3 ├── 03-Functional │ ├── 01 - Functions │ │ ├── 01 - Functions.xcodeproj │ │ │ └── project.pbxproj │ │ └── 01 - Functions │ │ │ └── main.cpp │ ├── 02 - Functor │ │ ├── 02 - Functor.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcuserdata │ │ │ │ │ └── Craig.xcuserdatad │ │ │ │ │ └── UserInterfaceState.xcuserstate │ │ │ └── xcuserdata │ │ │ │ └── Craig.xcuserdatad │ │ │ │ └── xcschemes │ │ │ │ ├── 02 - Functor.xcscheme │ │ │ │ └── xcschememanagement.plist │ │ └── 02 - Functor │ │ │ └── main.cpp │ ├── 03 - StdFuncBind │ │ ├── 03 - StdFuncBind.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcuserdata │ │ │ │ │ └── Craig.xcuserdatad │ │ │ │ │ └── UserInterfaceState.xcuserstate │ │ │ └── xcuserdata │ │ │ │ └── Craig.xcuserdatad │ │ │ │ └── xcschemes │ │ │ │ ├── 03 - StdFuncBind.xcscheme │ │ │ │ └── xcschememanagement.plist │ │ └── 03 - StdFuncBind │ │ │ └── main.cpp │ ├── 04 - Lambda │ │ ├── 04 - Lambda.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcuserdata │ │ │ │ │ └── Craig.xcuserdatad │ │ │ │ │ └── UserInterfaceState.xcuserstate │ │ │ └── xcuserdata │ │ │ │ └── Craig.xcuserdatad │ │ │ │ └── xcschemes │ │ │ │ ├── 04 - Lambda.xcscheme │ │ │ │ └── xcschememanagement.plist │ │ └── 04 - Lambda │ │ │ └── main.cpp │ ├── 05 - Signals │ │ ├── include │ │ │ └── Resources.h │ │ ├── resources │ │ │ ├── CinderApp.icns │ │ │ └── cinder_app_icon.ico │ │ ├── src │ │ │ └── SignalsApp.cpp │ │ ├── vc2013 │ │ │ ├── Resources.rc │ │ │ ├── Signals.sln │ │ │ ├── Signals.vcxproj │ │ │ └── Signals.vcxproj.filters │ │ └── xcode │ │ │ ├── Info.plist │ │ │ ├── Signals.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcuserdata │ │ │ │ │ └── Craig.xcuserdatad │ │ │ │ │ ├── UserInterfaceState.xcuserstate │ │ │ │ │ └── WorkspaceSettings.xcsettings │ │ │ └── xcuserdata │ │ │ │ └── Craig.xcuserdatad │ │ │ │ └── xcschemes │ │ │ │ ├── Signals.xcscheme │ │ │ │ └── xcschememanagement.plist │ │ │ ├── Signals_Prefix.pch │ │ │ └── build │ │ │ └── Signals.build │ │ │ └── Debug │ │ │ └── Signals.build │ │ │ ├── Objects-normal │ │ │ └── x86_64 │ │ │ │ └── Signals.LinkFileList │ │ │ ├── Signals-all-non-framework-target-headers.hmap │ │ │ ├── Signals-all-target-headers.hmap │ │ │ ├── Signals-generated-files.hmap │ │ │ ├── Signals-own-target-headers.hmap │ │ │ ├── Signals-project-headers.hmap │ │ │ ├── Signals.hmap │ │ │ ├── dgph │ │ │ └── dgph~ │ └── 06 - CollidableShapes │ │ ├── include │ │ ├── Circle.h │ │ ├── CollisionSystem.h │ │ ├── DrawableShape.h │ │ ├── InteractableShape.h │ │ ├── Resources.h │ │ └── Square.h │ │ ├── resources │ │ ├── CinderApp.icns │ │ ├── CinderApp_ios.png │ │ └── cinder_app_icon.ico │ │ ├── src │ │ ├── Circle.cpp │ │ ├── CollidableShapesApp.cpp │ │ ├── CollisionSystem.cpp │ │ ├── DrawableShape.cpp │ │ └── Square.cpp │ │ ├── vc2013 │ │ ├── CollidableShapes.sln │ │ ├── CollidableShapes.vcxproj │ │ ├── CollidableShapes.vcxproj.filters │ │ └── Resources.rc │ │ ├── xcode │ │ ├── CollidableShapes.xcodeproj │ │ │ └── project.pbxproj │ │ ├── CollidableShapes_Prefix.pch │ │ └── Info.plist │ │ └── xcode_ios │ │ ├── CollidableShapes.xcodeproj │ │ └── project.pbxproj │ │ ├── CollidableShapes_Prefix.pch │ │ ├── Default-568h@2x.png │ │ └── Info.plist └── README.md ├── Session4 ├── 04-Algorithms │ └── PixelSorting │ │ ├── include │ │ └── Resources.h │ │ ├── resources │ │ └── CinderApp.icns │ │ ├── src │ │ └── PixelSortingApp.cpp │ │ └── xcode │ │ ├── Info.plist │ │ ├── PixelSorting.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcuserdata │ │ │ │ └── Craig.xcuserdatad │ │ │ │ ├── UserInterfaceState.xcuserstate │ │ │ │ └── WorkspaceSettings.xcsettings │ │ └── xcuserdata │ │ │ └── Craig.xcuserdatad │ │ │ └── xcschemes │ │ │ ├── PixelSorting.xcscheme │ │ │ └── xcschememanagement.plist │ │ ├── PixelSorting_Prefix.pch │ │ └── build │ │ └── PixelSorting.build │ │ └── Debug │ │ └── PixelSorting.build │ │ ├── Objects-normal │ │ └── x86_64 │ │ │ └── PixelSorting.LinkFileList │ │ ├── PixelSorting-all-non-framework-target-headers.hmap │ │ ├── PixelSorting-all-target-headers.hmap │ │ ├── PixelSorting-generated-files.hmap │ │ ├── PixelSorting-own-target-headers.hmap │ │ ├── PixelSorting-project-headers.hmap │ │ ├── PixelSorting.hmap │ │ ├── dgph │ │ └── dgph~ └── README.md └── pixelmirror └── PixelMirrorApp.cpp /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/01 - BasicPointers/BasicPointers.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/01 - BasicPointers/BasicPointers.xcodeproj/project.xcworkspace/xcshareddata/BasicPointers.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 12F8BFBB-5C9F-40F1-8619-A2071D7BDDDA 9 | IDESourceControlProjectName 10 | BasicPointers 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 153058CBCCB1CBDDCC34DDF0218B1860A931D0D5 14 | https://github.com/itpresidents/CreativeCoding.git 15 | AD4B458D0D225ED63FAE0155615993B7D3ECE020 16 | https://github.com/cinder/Cinder.git 17 | 18 | IDESourceControlProjectPath 19 | 01-Data-Pointers-Classes/01 - BasicPointers/BasicPointers.xcodeproj 20 | IDESourceControlProjectRelativeInstallPathDictionary 21 | 22 | 153058CBCCB1CBDDCC34DDF0218B1860A931D0D5 23 | ../../../.. 24 | AD4B458D0D225ED63FAE0155615993B7D3ECE020 25 | ../../../../../.. 26 | 27 | IDESourceControlProjectURL 28 | https://github.com/itpresidents/CreativeCoding.git 29 | IDESourceControlProjectVersion 30 | 111 31 | IDESourceControlProjectWCCIdentifier 32 | 153058CBCCB1CBDDCC34DDF0218B1860A931D0D5 33 | IDESourceControlProjectWCConfigurations 34 | 35 | 36 | IDESourceControlRepositoryExtensionIdentifierKey 37 | public.vcs.git 38 | IDESourceControlWCCIdentifierKey 39 | AD4B458D0D225ED63FAE0155615993B7D3ECE020 40 | IDESourceControlWCCName 41 | .. 42 | 43 | 44 | IDESourceControlRepositoryExtensionIdentifierKey 45 | public.vcs.git 46 | IDESourceControlWCCIdentifierKey 47 | 153058CBCCB1CBDDCC34DDF0218B1860A931D0D5 48 | IDESourceControlWCCName 49 | CreativeCoding 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/01 - BasicPointers/BasicPointers.xcodeproj/project.xcworkspace/xcshareddata/BasicPointers.xcscmblueprint: -------------------------------------------------------------------------------- 1 | { 2 | "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "153058CBCCB1CBDDCC34DDF0218B1860A931D0D5", 3 | "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : { 4 | 5 | }, 6 | "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : { 7 | "153058CBCCB1CBDDCC34DDF0218B1860A931D0D5" : 0, 8 | "AD4B458D0D225ED63FAE0155615993B7D3ECE020" : 0 9 | }, 10 | "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "12F8BFBB-5C9F-40F1-8619-A2071D7BDDDA", 11 | "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : { 12 | "153058CBCCB1CBDDCC34DDF0218B1860A931D0D5" : "CreativeCoding", 13 | "AD4B458D0D225ED63FAE0155615993B7D3ECE020" : "" 14 | }, 15 | "DVTSourceControlWorkspaceBlueprintNameKey" : "BasicPointers", 16 | "DVTSourceControlWorkspaceBlueprintVersion" : 204, 17 | "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "01-Data-Pointers-Classes\/01 - BasicPointers\/BasicPointers.xcodeproj", 18 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [ 19 | { 20 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/itpresidents\/CreativeCoding.git", 21 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 22 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "153058CBCCB1CBDDCC34DDF0218B1860A931D0D5" 23 | }, 24 | { 25 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/cinder\/Cinder.git", 26 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 27 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "AD4B458D0D225ED63FAE0155615993B7D3ECE020" 28 | } 29 | ] 30 | } -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/01 - BasicPointers/BasicPointers.xcodeproj/project.xcworkspace/xcuserdata/Craig.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session1/01-Data-Pointers-Classes/01 - BasicPointers/BasicPointers.xcodeproj/project.xcworkspace/xcuserdata/Craig.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/01 - BasicPointers/BasicPointers.xcodeproj/project.xcworkspace/xcuserdata/destructor.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session1/01-Data-Pointers-Classes/01 - BasicPointers/BasicPointers.xcodeproj/project.xcworkspace/xcuserdata/destructor.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/01 - BasicPointers/BasicPointers.xcodeproj/project.xcworkspace/xcuserdata/ryanbartley.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session1/01-Data-Pointers-Classes/01 - BasicPointers/BasicPointers.xcodeproj/project.xcworkspace/xcuserdata/ryanbartley.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/01 - BasicPointers/BasicPointers.xcodeproj/xcuserdata/Craig.xcuserdatad/xcschemes/BasicPointers.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/01 - BasicPointers/BasicPointers.xcodeproj/xcuserdata/Craig.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | BasicPointers.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 4FA764CE19C5DEF0008AAA53 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/01 - BasicPointers/BasicPointers.xcodeproj/xcuserdata/destructor.xcuserdatad/xcschemes/BasicPointers.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 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/01 - BasicPointers/BasicPointers.xcodeproj/xcuserdata/destructor.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | BasicPointers.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 4FA764CE19C5DEF0008AAA53 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/01 - BasicPointers/BasicPointers.xcodeproj/xcuserdata/ryanbartley.xcuserdatad/xcschemes/BasicPointers.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 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/01 - BasicPointers/BasicPointers.xcodeproj/xcuserdata/ryanbartley.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | BasicPointers.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 4FA764CE19C5DEF0008AAA53 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/01 - BasicPointers/BasicPointers/BasicPointers.1: -------------------------------------------------------------------------------- 1 | .\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. 2 | .\"See Also: 3 | .\"man mdoc.samples for a complete listing of options 4 | .\"man mdoc for the short list of editing options 5 | .\"/usr/share/misc/mdoc.template 6 | .Dd 9/14/14 \" DATE 7 | .Dt BasicPointers 1 \" Program name and manual section number 8 | .Os Darwin 9 | .Sh NAME \" Section Header - required - don't modify 10 | .Nm BasicPointers, 11 | .\" The following lines are read in generating the apropos(man -k) database. Use only key 12 | .\" words here as the database is built based on the words here and in the .ND line. 13 | .Nm Other_name_for_same_program(), 14 | .Nm Yet another name for the same program. 15 | .\" Use .Nm macro to designate other names for the documented program. 16 | .Nd This line parsed for whatis database. 17 | .Sh SYNOPSIS \" Section Header - required - don't modify 18 | .Nm 19 | .Op Fl abcd \" [-abcd] 20 | .Op Fl a Ar path \" [-a path] 21 | .Op Ar file \" [file] 22 | .Op Ar \" [file ...] 23 | .Ar arg0 \" Underlined argument - use .Ar anywhere to underline 24 | arg2 ... \" Arguments 25 | .Sh DESCRIPTION \" Section Header - required - don't modify 26 | Use the .Nm macro to refer to your program throughout the man page like such: 27 | .Nm 28 | Underlining is accomplished with the .Ar macro like this: 29 | .Ar underlined text . 30 | .Pp \" Inserts a space 31 | A list of items with descriptions: 32 | .Bl -tag -width -indent \" Begins a tagged list 33 | .It item a \" Each item preceded by .It macro 34 | Description of item a 35 | .It item b 36 | Description of item b 37 | .El \" Ends the list 38 | .Pp 39 | A list of flags and their descriptions: 40 | .Bl -tag -width -indent \" Differs from above in tag removed 41 | .It Fl a \"-a flag as a list item 42 | Description of -a flag 43 | .It Fl b 44 | Description of -b flag 45 | .El \" Ends the list 46 | .Pp 47 | .\" .Sh ENVIRONMENT \" May not be needed 48 | .\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 49 | .\" .It Ev ENV_VAR_1 50 | .\" Description of ENV_VAR_1 51 | .\" .It Ev ENV_VAR_2 52 | .\" Description of ENV_VAR_2 53 | .\" .El 54 | .Sh FILES \" File used or created by the topic of the man page 55 | .Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact 56 | .It Pa /usr/share/file_name 57 | FILE_1 description 58 | .It Pa /Users/joeuser/Library/really_long_file_name 59 | FILE_2 description 60 | .El \" Ends the list 61 | .\" .Sh DIAGNOSTICS \" May not be needed 62 | .\" .Bl -diag 63 | .\" .It Diagnostic Tag 64 | .\" Diagnostic informtion here. 65 | .\" .It Diagnostic Tag 66 | .\" Diagnostic informtion here. 67 | .\" .El 68 | .Sh SEE ALSO 69 | .\" List links in ascending order by section, alphabetically within a section. 70 | .\" Please do not reference files that do not exist without filing a bug report 71 | .Xr a 1 , 72 | .Xr b 1 , 73 | .Xr c 1 , 74 | .Xr a 2 , 75 | .Xr b 2 , 76 | .Xr a 3 , 77 | .Xr b 3 78 | .\" .Sh BUGS \" Document known, unremedied bugs 79 | .\" .Sh HISTORY \" Document history if command behaves in a unique manner -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/01 - BasicPointers/BasicPointers/main.cpp: -------------------------------------------------------------------------------- 1 | 2 | // This includes the functionality associated with cout (console out) and endl (end line) 3 | #include 4 | 5 | // int is the return value, main is the name of the function and inside the parentheses 6 | // are the arguments to the function argc -> Argument Count, argv -> string array of 7 | // arguments, for instance if I were to type... git commit -m "Initial Commit" 8 | // ... on the command line argc would be 3 and argv would be ["commit", "-m", "\"Initial Commit\""] 9 | int main(int argc, const char * argv[]) 10 | { 11 | 12 | // create a real value in memory on the stack - the stack is local to the scope 13 | // of the function, in this case main() 14 | int myInt = 200; 15 | 16 | // create a null pointer ( null means empty ), the * means pointer and the int is 17 | // the type of data this pointer can point at 18 | int* myIntPtr = nullptr; 19 | 20 | // use the cout object and the stream operator (<<) to log what is contained in each 21 | // variable 22 | std::cout<< "myInt lvalue: " << myInt << std::endl; 23 | // Using the address-of operator '&' in front of an lvalue (something that has an address 24 | // in memory) returns the address associcated with that variable, essentially the value a 25 | // pointer would store -- something like 0xffac20cd 26 | std::cout<< "myInt ptr address: " << &myInt << std::endl; 27 | // This should be zero because we initialized it with nullptr. 28 | std::cout<< "myInt address: " << myIntPtr << std::endl; 29 | 30 | // Now that we see that using the & operator gives us the address of an lvalue we can use it 31 | // to store the address inside the pointer, thus making the pointer point to the memory 32 | // associated with myInt. 33 | myIntPtr = &myInt; 34 | 35 | // This will make a space between the above and below console out statements. 36 | std::cout<< std::endl; 37 | 38 | // look again, now myIntPtr points to the same value that myInt references. 39 | std::cout<< "myInt ptr address: " << &myInt << std::endl; 40 | std::cout<< "myIntPtr address: " << myIntPtr << std::endl; 41 | 42 | // use the '*' operator in front of a pointer to dereference the pointer and return the real value 43 | // associated with that address. 44 | std::cout<< "Dereferenced myIntPtr: " << *myIntPtr << std::endl; 45 | 46 | // This returns zero from Main meaning that the program exited successfully. 47 | return 0; 48 | } 49 | 50 | // for more info on lvaues and rvalues and the '&' operator see : http://eli.thegreenplace.net/2011/12/15/understanding-lvalues-and-rvalues-in-c-and-c/ 51 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/02 - NewDelete/newDelete.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/02 - NewDelete/newDelete.xcodeproj/project.xcworkspace/xcshareddata/newDelete.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 923A78D9-7C6C-40E2-A442-FF461E88EB78 9 | IDESourceControlProjectName 10 | newDelete 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 153058CBCCB1CBDDCC34DDF0218B1860A931D0D5 14 | https://github.com/itpresidents/CreativeCoding.git 15 | AD4B458D0D225ED63FAE0155615993B7D3ECE020 16 | https://github.com/cinder/Cinder.git 17 | 18 | IDESourceControlProjectPath 19 | 01-Data-Pointers-Classes/02 - NewDelete/newDelete.xcodeproj 20 | IDESourceControlProjectRelativeInstallPathDictionary 21 | 22 | 153058CBCCB1CBDDCC34DDF0218B1860A931D0D5 23 | ../../../.. 24 | AD4B458D0D225ED63FAE0155615993B7D3ECE020 25 | ../../../../../.. 26 | 27 | IDESourceControlProjectURL 28 | https://github.com/itpresidents/CreativeCoding.git 29 | IDESourceControlProjectVersion 30 | 111 31 | IDESourceControlProjectWCCIdentifier 32 | 153058CBCCB1CBDDCC34DDF0218B1860A931D0D5 33 | IDESourceControlProjectWCConfigurations 34 | 35 | 36 | IDESourceControlRepositoryExtensionIdentifierKey 37 | public.vcs.git 38 | IDESourceControlWCCIdentifierKey 39 | AD4B458D0D225ED63FAE0155615993B7D3ECE020 40 | IDESourceControlWCCName 41 | .. 42 | 43 | 44 | IDESourceControlRepositoryExtensionIdentifierKey 45 | public.vcs.git 46 | IDESourceControlWCCIdentifierKey 47 | 153058CBCCB1CBDDCC34DDF0218B1860A931D0D5 48 | IDESourceControlWCCName 49 | CreativeCoding 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/02 - NewDelete/newDelete.xcodeproj/project.xcworkspace/xcshareddata/newDelete.xcscmblueprint: -------------------------------------------------------------------------------- 1 | { 2 | "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "153058CBCCB1CBDDCC34DDF0218B1860A931D0D5", 3 | "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : { 4 | 5 | }, 6 | "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : { 7 | "153058CBCCB1CBDDCC34DDF0218B1860A931D0D5" : 0, 8 | "AD4B458D0D225ED63FAE0155615993B7D3ECE020" : 0 9 | }, 10 | "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "923A78D9-7C6C-40E2-A442-FF461E88EB78", 11 | "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : { 12 | "153058CBCCB1CBDDCC34DDF0218B1860A931D0D5" : "CreativeCoding", 13 | "AD4B458D0D225ED63FAE0155615993B7D3ECE020" : "" 14 | }, 15 | "DVTSourceControlWorkspaceBlueprintNameKey" : "newDelete", 16 | "DVTSourceControlWorkspaceBlueprintVersion" : 204, 17 | "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "01-Data-Pointers-Classes\/02 - NewDelete\/newDelete.xcodeproj", 18 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [ 19 | { 20 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/itpresidents\/CreativeCoding.git", 21 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 22 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "153058CBCCB1CBDDCC34DDF0218B1860A931D0D5" 23 | }, 24 | { 25 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/cinder\/Cinder.git", 26 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 27 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "AD4B458D0D225ED63FAE0155615993B7D3ECE020" 28 | } 29 | ] 30 | } -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/02 - NewDelete/newDelete.xcodeproj/project.xcworkspace/xcuserdata/Craig.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session1/01-Data-Pointers-Classes/02 - NewDelete/newDelete.xcodeproj/project.xcworkspace/xcuserdata/Craig.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/02 - NewDelete/newDelete.xcodeproj/project.xcworkspace/xcuserdata/destructor.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session1/01-Data-Pointers-Classes/02 - NewDelete/newDelete.xcodeproj/project.xcworkspace/xcuserdata/destructor.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/02 - NewDelete/newDelete.xcodeproj/project.xcworkspace/xcuserdata/ryanbartley.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session1/01-Data-Pointers-Classes/02 - NewDelete/newDelete.xcodeproj/project.xcworkspace/xcuserdata/ryanbartley.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/02 - NewDelete/newDelete.xcodeproj/xcuserdata/Craig.xcuserdatad/xcschemes/newDelete.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/02 - NewDelete/newDelete.xcodeproj/xcuserdata/Craig.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | newDelete.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 4F7B0CE019C499E2004D8605 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/02 - NewDelete/newDelete.xcodeproj/xcuserdata/destructor.xcuserdatad/xcschemes/newDelete.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 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/02 - NewDelete/newDelete.xcodeproj/xcuserdata/destructor.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | newDelete.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 4F7B0CE019C499E2004D8605 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/02 - NewDelete/newDelete.xcodeproj/xcuserdata/ryanbartley.xcuserdatad/xcschemes/newDelete.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 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/02 - NewDelete/newDelete.xcodeproj/xcuserdata/ryanbartley.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | newDelete.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 4F7B0CE019C499E2004D8605 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/02 - NewDelete/newDelete/main.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | // See Basic Pointers for explanation of these. 5 | int main(int argc, const char * argv[]) 6 | { 7 | // create a null int pointer (nullptr is a value used to initialize pointers 8 | // to 0x0, meaning it doesn't point to anything) this variable (myIntPtr) lives 9 | // on the stack of main, it will get destoryed when the variable goes out of scope 10 | // basically when main returns at the bottom 11 | int * myIntPtr = nullptr; 12 | 13 | // Check to see the address stored in myIntPtr, it should be something like 0x0 14 | std::cout << myIntPtr << std::endl; 15 | 16 | // To create dynamic memory (on the Heap), you use the 'new' operator. 'new' asks the 17 | // operating system if it has memory it can afford to give, in this case 4 bytes for the 18 | // int that we'd like to initialize to 200. 'new' will then return an address to the 19 | // initialized memory that the operating system found which we'll store in myIntPtr. 20 | myIntPtr = new int(200); 21 | 22 | // Print out the 'new' address stored inside myIntPtr, as you'll see the value stored in 23 | // this pointer will no longer be 0x0, it'll be the address that 'new' returned 24 | std::cout << myIntPtr << std::endl; 25 | // Print out the value stored at that address by dereferencing myIntPtr with the '*' 26 | std::cout << *myIntPtr << std::endl; 27 | 28 | // This is the most important aspect of using Heap memory, after the operating system 29 | // gives you the address it forgets that it even had a conversation with your program. 30 | // It is your responsibility to give back the memory associated with myIntPtr. The way 31 | // to do this is by calling 'delete'. 'delete' is an operator like 'new' that tells the 32 | // operating system that you're done with the memory, otherwise the operating system 33 | // believes that you are still using that memory. That is called a memory leak. If 34 | // myIntPtr, a variable created on the stack, goes out of scope and therefore is destroyed 35 | // you will not be able to find that memory address and thus it gets leaked. 36 | delete myIntPtr; 37 | 38 | return 0; 39 | } 40 | 41 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/02 - NewDelete/newDelete/newDelete.1: -------------------------------------------------------------------------------- 1 | .\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. 2 | .\"See Also: 3 | .\"man mdoc.samples for a complete listing of options 4 | .\"man mdoc for the short list of editing options 5 | .\"/usr/share/misc/mdoc.template 6 | .Dd 9/13/14 \" DATE 7 | .Dt newDelete 1 \" Program name and manual section number 8 | .Os Darwin 9 | .Sh NAME \" Section Header - required - don't modify 10 | .Nm newDelete, 11 | .\" The following lines are read in generating the apropos(man -k) database. Use only key 12 | .\" words here as the database is built based on the words here and in the .ND line. 13 | .Nm Other_name_for_same_program(), 14 | .Nm Yet another name for the same program. 15 | .\" Use .Nm macro to designate other names for the documented program. 16 | .Nd This line parsed for whatis database. 17 | .Sh SYNOPSIS \" Section Header - required - don't modify 18 | .Nm 19 | .Op Fl abcd \" [-abcd] 20 | .Op Fl a Ar path \" [-a path] 21 | .Op Ar file \" [file] 22 | .Op Ar \" [file ...] 23 | .Ar arg0 \" Underlined argument - use .Ar anywhere to underline 24 | arg2 ... \" Arguments 25 | .Sh DESCRIPTION \" Section Header - required - don't modify 26 | Use the .Nm macro to refer to your program throughout the man page like such: 27 | .Nm 28 | Underlining is accomplished with the .Ar macro like this: 29 | .Ar underlined text . 30 | .Pp \" Inserts a space 31 | A list of items with descriptions: 32 | .Bl -tag -width -indent \" Begins a tagged list 33 | .It item a \" Each item preceded by .It macro 34 | Description of item a 35 | .It item b 36 | Description of item b 37 | .El \" Ends the list 38 | .Pp 39 | A list of flags and their descriptions: 40 | .Bl -tag -width -indent \" Differs from above in tag removed 41 | .It Fl a \"-a flag as a list item 42 | Description of -a flag 43 | .It Fl b 44 | Description of -b flag 45 | .El \" Ends the list 46 | .Pp 47 | .\" .Sh ENVIRONMENT \" May not be needed 48 | .\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 49 | .\" .It Ev ENV_VAR_1 50 | .\" Description of ENV_VAR_1 51 | .\" .It Ev ENV_VAR_2 52 | .\" Description of ENV_VAR_2 53 | .\" .El 54 | .Sh FILES \" File used or created by the topic of the man page 55 | .Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact 56 | .It Pa /usr/share/file_name 57 | FILE_1 description 58 | .It Pa /Users/joeuser/Library/really_long_file_name 59 | FILE_2 description 60 | .El \" Ends the list 61 | .\" .Sh DIAGNOSTICS \" May not be needed 62 | .\" .Bl -diag 63 | .\" .It Diagnostic Tag 64 | .\" Diagnostic informtion here. 65 | .\" .It Diagnostic Tag 66 | .\" Diagnostic informtion here. 67 | .\" .El 68 | .Sh SEE ALSO 69 | .\" List links in ascending order by section, alphabetically within a section. 70 | .\" Please do not reference files that do not exist without filing a bug report 71 | .Xr a 1 , 72 | .Xr b 1 , 73 | .Xr c 1 , 74 | .Xr a 2 , 75 | .Xr b 2 , 76 | .Xr a 3 , 77 | .Xr b 3 78 | .\" .Sh BUGS \" Document known, unremedied bugs 79 | .\" .Sh HISTORY \" Document history if command behaves in a unique manner -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/03 - PointerArray/pointerArray.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/03 - PointerArray/pointerArray.xcodeproj/project.xcworkspace/xcshareddata/pointerArray.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 0A29CB04-B20A-4713-A4D5-7B693131C2CB 9 | IDESourceControlProjectName 10 | pointerArray 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 153058CBCCB1CBDDCC34DDF0218B1860A931D0D5 14 | https://github.com/itpresidents/CreativeCoding.git 15 | AD4B458D0D225ED63FAE0155615993B7D3ECE020 16 | https://github.com/cinder/Cinder.git 17 | 18 | IDESourceControlProjectPath 19 | 01-Data-Pointers-Classes/03 - PointerArray/pointerArray.xcodeproj 20 | IDESourceControlProjectRelativeInstallPathDictionary 21 | 22 | 153058CBCCB1CBDDCC34DDF0218B1860A931D0D5 23 | ../../../.. 24 | AD4B458D0D225ED63FAE0155615993B7D3ECE020 25 | ../../../../../.. 26 | 27 | IDESourceControlProjectURL 28 | https://github.com/itpresidents/CreativeCoding.git 29 | IDESourceControlProjectVersion 30 | 111 31 | IDESourceControlProjectWCCIdentifier 32 | 153058CBCCB1CBDDCC34DDF0218B1860A931D0D5 33 | IDESourceControlProjectWCConfigurations 34 | 35 | 36 | IDESourceControlRepositoryExtensionIdentifierKey 37 | public.vcs.git 38 | IDESourceControlWCCIdentifierKey 39 | AD4B458D0D225ED63FAE0155615993B7D3ECE020 40 | IDESourceControlWCCName 41 | .. 42 | 43 | 44 | IDESourceControlRepositoryExtensionIdentifierKey 45 | public.vcs.git 46 | IDESourceControlWCCIdentifierKey 47 | 153058CBCCB1CBDDCC34DDF0218B1860A931D0D5 48 | IDESourceControlWCCName 49 | CreativeCoding 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/03 - PointerArray/pointerArray.xcodeproj/project.xcworkspace/xcuserdata/Craig.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session1/01-Data-Pointers-Classes/03 - PointerArray/pointerArray.xcodeproj/project.xcworkspace/xcuserdata/Craig.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/03 - PointerArray/pointerArray.xcodeproj/project.xcworkspace/xcuserdata/destructor.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session1/01-Data-Pointers-Classes/03 - PointerArray/pointerArray.xcodeproj/project.xcworkspace/xcuserdata/destructor.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/03 - PointerArray/pointerArray.xcodeproj/project.xcworkspace/xcuserdata/ryanbartley.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session1/01-Data-Pointers-Classes/03 - PointerArray/pointerArray.xcodeproj/project.xcworkspace/xcuserdata/ryanbartley.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/03 - PointerArray/pointerArray.xcodeproj/xcuserdata/Craig.xcuserdatad/xcschemes/pointerArray.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/03 - PointerArray/pointerArray.xcodeproj/xcuserdata/Craig.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | pointerArray.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 4F7B0CF519C49B4E004D8605 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/03 - PointerArray/pointerArray.xcodeproj/xcuserdata/destructor.xcuserdatad/xcschemes/pointerArray.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 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/03 - PointerArray/pointerArray.xcodeproj/xcuserdata/destructor.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | pointerArray.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 4F7B0CF519C49B4E004D8605 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/03 - PointerArray/pointerArray.xcodeproj/xcuserdata/ryanbartley.xcuserdatad/xcschemes/pointerArray.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 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/03 - PointerArray/pointerArray.xcodeproj/xcuserdata/ryanbartley.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | pointerArray.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 4F7B0CF519C49B4E004D8605 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/03 - PointerArray/pointerArray/main.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | int main(int argc, const char * argv[]) 5 | { 6 | // Pointers can point to many things. Pointers can point to stack 7 | // memory, i.e. int myInt = 200; int* myIntPtr = &myInt;, they can 8 | // point to heap memory, i.e. int* myIntPtr = new int(200), they're 9 | // used for stack arrays, i.e. int myIntArray[20] (in this case 10 | // myIntArray is a pointer to the first element of myIntArray, using 11 | // [] dereferences the pointer and adds the multiple of the number 12 | // by the size of the data, i.e. myIntArray[4] takes the address at 13 | // myIntArray and adds 4 * sizeof(int), which is 16, to myIntArray, 14 | // and they can be used with heap arrays in a very similar way. For 15 | // instance... 16 | 17 | 18 | // create a new array of 10 ints on the heap 19 | int * myIntHeapArray = new int[10]; 20 | // create a new array of 10 ints on the stack 21 | int myIntStackArray[10]; 22 | 23 | // initialize the data inside each array and stream it out 24 | for( int i = 0; i < 10 ; i++ ){ 25 | myIntHeapArray[i] = i; 26 | myIntStackArray[i] = i * 2; 27 | 28 | std::cout << "myIntHeapArray[" << i << "]: " << myIntHeapArray[i] << std::endl; 29 | std::cout << "myIntStackArray[" << i << "]: " << myIntStackArray[i] << std::endl; 30 | } 31 | 32 | // Even though the two different arrays act very similarly, 33 | // one array (heap) was created by talking to the operating system, 34 | // the other array (stack) was created during compile time so your 35 | // program already knows about the memory specifications of it and 36 | // will free the memory when it leaves scope. 37 | 38 | // To free the memory associated with the heap array you use a similar 39 | // delete command just this time you use the brackets ([]) to let the 40 | // program know that you are going to be giving back an array of things 41 | // to the operating system 42 | delete [] myIntHeapArray; 43 | 44 | // It is important to never try to free stack memory with the delete 45 | // operator. Below, I've commented out the call but you will get errors 46 | // from the compiler if you do this, because when stack memory is known 47 | // at compile time, the program takes care of freeing the memory for you. 48 | // uncomment it to see the errors. 49 | 50 | // delete [] myIntStackArray; 51 | 52 | return 0; 53 | } 54 | 55 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/03 - PointerArray/pointerArray/pointerArray.1: -------------------------------------------------------------------------------- 1 | .\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. 2 | .\"See Also: 3 | .\"man mdoc.samples for a complete listing of options 4 | .\"man mdoc for the short list of editing options 5 | .\"/usr/share/misc/mdoc.template 6 | .Dd 9/13/14 \" DATE 7 | .Dt pointerArray 1 \" Program name and manual section number 8 | .Os Darwin 9 | .Sh NAME \" Section Header - required - don't modify 10 | .Nm pointerArray, 11 | .\" The following lines are read in generating the apropos(man -k) database. Use only key 12 | .\" words here as the database is built based on the words here and in the .ND line. 13 | .Nm Other_name_for_same_program(), 14 | .Nm Yet another name for the same program. 15 | .\" Use .Nm macro to designate other names for the documented program. 16 | .Nd This line parsed for whatis database. 17 | .Sh SYNOPSIS \" Section Header - required - don't modify 18 | .Nm 19 | .Op Fl abcd \" [-abcd] 20 | .Op Fl a Ar path \" [-a path] 21 | .Op Ar file \" [file] 22 | .Op Ar \" [file ...] 23 | .Ar arg0 \" Underlined argument - use .Ar anywhere to underline 24 | arg2 ... \" Arguments 25 | .Sh DESCRIPTION \" Section Header - required - don't modify 26 | Use the .Nm macro to refer to your program throughout the man page like such: 27 | .Nm 28 | Underlining is accomplished with the .Ar macro like this: 29 | .Ar underlined text . 30 | .Pp \" Inserts a space 31 | A list of items with descriptions: 32 | .Bl -tag -width -indent \" Begins a tagged list 33 | .It item a \" Each item preceded by .It macro 34 | Description of item a 35 | .It item b 36 | Description of item b 37 | .El \" Ends the list 38 | .Pp 39 | A list of flags and their descriptions: 40 | .Bl -tag -width -indent \" Differs from above in tag removed 41 | .It Fl a \"-a flag as a list item 42 | Description of -a flag 43 | .It Fl b 44 | Description of -b flag 45 | .El \" Ends the list 46 | .Pp 47 | .\" .Sh ENVIRONMENT \" May not be needed 48 | .\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 49 | .\" .It Ev ENV_VAR_1 50 | .\" Description of ENV_VAR_1 51 | .\" .It Ev ENV_VAR_2 52 | .\" Description of ENV_VAR_2 53 | .\" .El 54 | .Sh FILES \" File used or created by the topic of the man page 55 | .Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact 56 | .It Pa /usr/share/file_name 57 | FILE_1 description 58 | .It Pa /Users/joeuser/Library/really_long_file_name 59 | FILE_2 description 60 | .El \" Ends the list 61 | .\" .Sh DIAGNOSTICS \" May not be needed 62 | .\" .Bl -diag 63 | .\" .It Diagnostic Tag 64 | .\" Diagnostic informtion here. 65 | .\" .It Diagnostic Tag 66 | .\" Diagnostic informtion here. 67 | .\" .El 68 | .Sh SEE ALSO 69 | .\" List links in ascending order by section, alphabetically within a section. 70 | .\" Please do not reference files that do not exist without filing a bug report 71 | .Xr a 1 , 72 | .Xr b 1 , 73 | .Xr c 1 , 74 | .Xr a 2 , 75 | .Xr b 2 , 76 | .Xr a 3 , 77 | .Xr b 3 78 | .\" .Sh BUGS \" Document known, unremedied bugs 79 | .\" .Sh HISTORY \" Document history if command behaves in a unique manner -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/04 - StdVector/stdVector.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/04 - StdVector/stdVector.xcodeproj/project.xcworkspace/xcshareddata/stdVector.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 55093B38-C8B9-4A36-921A-588F5A721EBA 9 | IDESourceControlProjectName 10 | stdVector 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 153058CBCCB1CBDDCC34DDF0218B1860A931D0D5 14 | https://github.com/itpresidents/CreativeCoding.git 15 | AD4B458D0D225ED63FAE0155615993B7D3ECE020 16 | https://github.com/cinder/Cinder.git 17 | 18 | IDESourceControlProjectPath 19 | 01-Data-Pointers-Classes/04 - StdVector/stdVector.xcodeproj 20 | IDESourceControlProjectRelativeInstallPathDictionary 21 | 22 | 153058CBCCB1CBDDCC34DDF0218B1860A931D0D5 23 | ../../../.. 24 | AD4B458D0D225ED63FAE0155615993B7D3ECE020 25 | ../../../../../.. 26 | 27 | IDESourceControlProjectURL 28 | https://github.com/itpresidents/CreativeCoding.git 29 | IDESourceControlProjectVersion 30 | 111 31 | IDESourceControlProjectWCCIdentifier 32 | 153058CBCCB1CBDDCC34DDF0218B1860A931D0D5 33 | IDESourceControlProjectWCConfigurations 34 | 35 | 36 | IDESourceControlRepositoryExtensionIdentifierKey 37 | public.vcs.git 38 | IDESourceControlWCCIdentifierKey 39 | AD4B458D0D225ED63FAE0155615993B7D3ECE020 40 | IDESourceControlWCCName 41 | .. 42 | 43 | 44 | IDESourceControlRepositoryExtensionIdentifierKey 45 | public.vcs.git 46 | IDESourceControlWCCIdentifierKey 47 | 153058CBCCB1CBDDCC34DDF0218B1860A931D0D5 48 | IDESourceControlWCCName 49 | CreativeCoding 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/04 - StdVector/stdVector.xcodeproj/project.xcworkspace/xcuserdata/destructor.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session1/01-Data-Pointers-Classes/04 - StdVector/stdVector.xcodeproj/project.xcworkspace/xcuserdata/destructor.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/04 - StdVector/stdVector.xcodeproj/project.xcworkspace/xcuserdata/ryanbartley.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session1/01-Data-Pointers-Classes/04 - StdVector/stdVector.xcodeproj/project.xcworkspace/xcuserdata/ryanbartley.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/04 - StdVector/stdVector.xcodeproj/xcuserdata/destructor.xcuserdatad/xcschemes/stdVector.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 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/04 - StdVector/stdVector.xcodeproj/xcuserdata/destructor.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | stdVector.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 4FA764E319C5E1C8008AAA53 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/04 - StdVector/stdVector.xcodeproj/xcuserdata/ryanbartley.xcuserdatad/xcschemes/stdVector.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 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/04 - StdVector/stdVector.xcodeproj/xcuserdata/ryanbartley.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | stdVector.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 4FA764E319C5E1C8008AAA53 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/04 - StdVector/stdVector/main.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | // include the code that contains the vector functionality 5 | #include 6 | 7 | // when we know that a number should remain constant, we use 8 | // the keyword 'const' in front of the datatype. This is a 9 | // compiler flag that will throw compile time errors if we 10 | // try to change the value after it has been initialized. 11 | // It is a convention to use all capital letters for the 12 | // variable names. This is also a global variable because 13 | // it is outside any local scopes we've created. 14 | const int NUM_INTS = 10; 15 | 16 | // Uncomment the line below to see what happens 17 | 18 | // NUM_INTS = 12; 19 | 20 | int main(int argc, const char * argv[]) 21 | { 22 | 23 | // A vector, in the 'std' namespace, is a container object, akin to ArrayList in Java 24 | // or Array in JavaScript, that holds a dynamic amount of a specific type, in this case 25 | // integer, and it guarantees that the elements it contains will be in contiguous 26 | // memory. This is also the first time we've come across templates, which are denoted 27 | // by the '< >' operators. This allows us to make truly generic types that can be 28 | // rewritten at compile time. You can think of the type of myInts as not std::vector 29 | // but std::IntVector, because we put 'int' inside the '< >'. We could also put 30 | // std::vector and that would be a different type than std::vector. 31 | std::vector myInts; 32 | 33 | // Vectors have a number of different member functions and helpers to work with the 34 | // specific functionality central to std::vector<>. For instance, resize will check 35 | // the amount of ints it can contain and change that amount to what we pass into it's 36 | // argument. Here we're saying resize myInts to NUM_INTS. It will first check to see 37 | // if the HEAP memory it contains is large enough to store NUM_INTS and if it isn't 38 | // it will go back to the operating system, ask for that amount of memory, copy all 39 | // of the current contents into the 'new' memory and then 'delete' the old memory 40 | myInts.resize( NUM_INTS ); 41 | 42 | for(int i = 0; i < NUM_INTS; i++){ 43 | // You can use std::vector very similarly to a regular array. '[]' operator will access 44 | // the memory at that index. 45 | myInts[i] = i; 46 | 47 | // We can print out the contents similarly as well. 48 | std::cout << myInts[i] << std::endl; 49 | } 50 | 51 | // Lets say that we're somewhere else in the program and we need to add some other elements 52 | // that we didn't intend to add. All we have to do is use the push_back function, this is 53 | // very similar to ArrayList in Java and Array in Javascript. 54 | myInts.push_back( NUM_INTS ); 55 | myInts.push_back( NUM_INTS + 1 ); 56 | 57 | // Now it is storing 2 more than it was resized to have. It will go through the same process 58 | // as it went through with resize to make sure it has enough memory to store them or it 59 | // will go back to the operating system and get more memory. 60 | std::cout << myInts[ NUM_INTS ] << std::endl; 61 | std::cout << myInts[ NUM_INTS + 1 ] << std::endl; 62 | 63 | // The size() function will return the number of elements the vector contains. In our case, 64 | // we originally created 10 or NUM_INTS and then we pushed two more elements onto it so the 65 | // final size is 12. 66 | std::cout << "Number of Integers currently stored in myInts: " << myInts.size() << std::endl; 67 | 68 | // The clear() function will free all the memory in the vector, this happens automatically 69 | // when the vector goes out of scope and the destructor gets called 70 | myInts.clear(); 71 | 72 | return 0; 73 | } 74 | 75 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/04 - StdVector/stdVector/stdVector.1: -------------------------------------------------------------------------------- 1 | .\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. 2 | .\"See Also: 3 | .\"man mdoc.samples for a complete listing of options 4 | .\"man mdoc for the short list of editing options 5 | .\"/usr/share/misc/mdoc.template 6 | .Dd 9/14/14 \" DATE 7 | .Dt stdVector 1 \" Program name and manual section number 8 | .Os Darwin 9 | .Sh NAME \" Section Header - required - don't modify 10 | .Nm stdVector, 11 | .\" The following lines are read in generating the apropos(man -k) database. Use only key 12 | .\" words here as the database is built based on the words here and in the .ND line. 13 | .Nm Other_name_for_same_program(), 14 | .Nm Yet another name for the same program. 15 | .\" Use .Nm macro to designate other names for the documented program. 16 | .Nd This line parsed for whatis database. 17 | .Sh SYNOPSIS \" Section Header - required - don't modify 18 | .Nm 19 | .Op Fl abcd \" [-abcd] 20 | .Op Fl a Ar path \" [-a path] 21 | .Op Ar file \" [file] 22 | .Op Ar \" [file ...] 23 | .Ar arg0 \" Underlined argument - use .Ar anywhere to underline 24 | arg2 ... \" Arguments 25 | .Sh DESCRIPTION \" Section Header - required - don't modify 26 | Use the .Nm macro to refer to your program throughout the man page like such: 27 | .Nm 28 | Underlining is accomplished with the .Ar macro like this: 29 | .Ar underlined text . 30 | .Pp \" Inserts a space 31 | A list of items with descriptions: 32 | .Bl -tag -width -indent \" Begins a tagged list 33 | .It item a \" Each item preceded by .It macro 34 | Description of item a 35 | .It item b 36 | Description of item b 37 | .El \" Ends the list 38 | .Pp 39 | A list of flags and their descriptions: 40 | .Bl -tag -width -indent \" Differs from above in tag removed 41 | .It Fl a \"-a flag as a list item 42 | Description of -a flag 43 | .It Fl b 44 | Description of -b flag 45 | .El \" Ends the list 46 | .Pp 47 | .\" .Sh ENVIRONMENT \" May not be needed 48 | .\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 49 | .\" .It Ev ENV_VAR_1 50 | .\" Description of ENV_VAR_1 51 | .\" .It Ev ENV_VAR_2 52 | .\" Description of ENV_VAR_2 53 | .\" .El 54 | .Sh FILES \" File used or created by the topic of the man page 55 | .Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact 56 | .It Pa /usr/share/file_name 57 | FILE_1 description 58 | .It Pa /Users/joeuser/Library/really_long_file_name 59 | FILE_2 description 60 | .El \" Ends the list 61 | .\" .Sh DIAGNOSTICS \" May not be needed 62 | .\" .Bl -diag 63 | .\" .It Diagnostic Tag 64 | .\" Diagnostic informtion here. 65 | .\" .It Diagnostic Tag 66 | .\" Diagnostic informtion here. 67 | .\" .El 68 | .Sh SEE ALSO 69 | .\" List links in ascending order by section, alphabetically within a section. 70 | .\" Please do not reference files that do not exist without filing a bug report 71 | .Xr a 1 , 72 | .Xr b 1 , 73 | .Xr c 1 , 74 | .Xr a 2 , 75 | .Xr b 2 , 76 | .Xr a 3 , 77 | .Xr b 3 78 | .\" .Sh BUGS \" Document known, unremedied bugs 79 | .\" .Sh HISTORY \" Document history if command behaves in a unique manner -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/05 - PointersAndReferences/05 - PointersAndReferences.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/05 - PointersAndReferences/05 - PointersAndReferences.xcodeproj/project.xcworkspace/xcshareddata/05 - PointersAndReferences.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 8D0C4E41-19B5-4035-8BB2-C9BC4D2386C5 9 | IDESourceControlProjectName 10 | 05 - PointersAndReferences 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 153058CBCCB1CBDDCC34DDF0218B1860A931D0D5 14 | https://github.com/itpresidents/CreativeCoding.git 15 | AD4B458D0D225ED63FAE0155615993B7D3ECE020 16 | https://github.com/cinder/Cinder.git 17 | 18 | IDESourceControlProjectPath 19 | 01-Data-Pointers-Classes/05 - PointersAndReferences/05 - PointersAndReferences.xcodeproj 20 | IDESourceControlProjectRelativeInstallPathDictionary 21 | 22 | 153058CBCCB1CBDDCC34DDF0218B1860A931D0D5 23 | ../../../.. 24 | AD4B458D0D225ED63FAE0155615993B7D3ECE020 25 | ../../../../../.. 26 | 27 | IDESourceControlProjectURL 28 | https://github.com/itpresidents/CreativeCoding.git 29 | IDESourceControlProjectVersion 30 | 111 31 | IDESourceControlProjectWCCIdentifier 32 | 153058CBCCB1CBDDCC34DDF0218B1860A931D0D5 33 | IDESourceControlProjectWCConfigurations 34 | 35 | 36 | IDESourceControlRepositoryExtensionIdentifierKey 37 | public.vcs.git 38 | IDESourceControlWCCIdentifierKey 39 | AD4B458D0D225ED63FAE0155615993B7D3ECE020 40 | IDESourceControlWCCName 41 | .. 42 | 43 | 44 | IDESourceControlRepositoryExtensionIdentifierKey 45 | public.vcs.git 46 | IDESourceControlWCCIdentifierKey 47 | 153058CBCCB1CBDDCC34DDF0218B1860A931D0D5 48 | IDESourceControlWCCName 49 | CreativeCoding 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/05 - PointersAndReferences/05 - PointersAndReferences.xcodeproj/project.xcworkspace/xcuserdata/ryanbartley.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session1/01-Data-Pointers-Classes/05 - PointersAndReferences/05 - PointersAndReferences.xcodeproj/project.xcworkspace/xcuserdata/ryanbartley.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/05 - PointersAndReferences/05 - PointersAndReferences.xcodeproj/xcuserdata/ryanbartley.xcuserdatad/xcschemes/05 - PointersAndReferences.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 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/05 - PointersAndReferences/05 - PointersAndReferences.xcodeproj/xcuserdata/ryanbartley.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | 05 - PointersAndReferences.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | B3BC10FF19C7438500ACF599 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/06 - Circles/include/Circle.h: -------------------------------------------------------------------------------- 1 | // 2 | // Circle.h 3 | // CinderProject 4 | // 5 | // Created by Mike Allison on 9/13/14. 6 | // 7 | // 8 | 9 | #pragma once 10 | 11 | // Syntax to declare a class. If you start typing class, 12 | // it will usually auto complete the entire declaration 13 | class Circle { 14 | // Public signifies that everything under will be available 15 | // to use outside of the class. Normally what is made public 16 | // is the interface you want people or even yourself to 17 | // be able to use. 18 | public: 19 | 20 | // Constructor's and destructors are named as the class 21 | Circle(); // Default Constructor, takes no arguments 22 | Circle( int x, int y ); // Constructor Overload, takes 2 arguments 23 | ~Circle(); // Destructor, takes no arguments and can't be overloaded 24 | 25 | // This will now draw the circle in any way we desire to define it. 26 | void draw(); 27 | 28 | // These are the getters that allow classes outside of this one 29 | // to have access to the private member variables contained in 30 | // the class. Note there is one for each of the member variables 31 | // but there doesn't have to be. 32 | int getX(); 33 | int getY(); 34 | int getRadius(); 35 | // This one has a weird return value. Basically if I were to 36 | // return ci::ColorAf, at runtime every time I wanted to 37 | // call this function it would have to construct a whole 38 | // new ci::ColorAf, this is called Pass-by-Value, because this 39 | // is a larger class than an int like above, I'd rather pass 40 | // a reference for efficiency sake, which is like a pointer, 41 | // see References and Pointers example, and to make sure it 42 | // is safe like Pass-by-Value. I'll make what it is refering 43 | // to const. This way I pass only what I need to pass which 44 | // is the underlying memory. 45 | const ci::ColorAf& getColor(); 46 | 47 | // These are the setters which allow me to change the underlying 48 | // values of my member functions. 49 | void setX( int x ) { mX = x; } 50 | void setY( int y ) { mY = y; } 51 | void setRadius( int radius ) { mRadius = radius; } 52 | // This just like the one above is going to be passing by 53 | // const reference because like the one above I don't want 54 | // to construct a ci::Colorf to pass to mColor. I just 55 | // want to have a reference to it. 56 | void setColor( const ci::Colorf &color ) { mColor = color; } 57 | 58 | // Private signifies that everything under will not be 59 | // available outside of the class. Normally what is private 60 | // are the member variables that should only be accessible 61 | // through your public interface. For instance, getters and 62 | // setters. 63 | private: 64 | // It is a convention to name member variable with a preceding 65 | // m. Some people name it m_someVar. Some people name it mSomeVar 66 | // You can do as you see fit. 67 | int mX, mY; 68 | int mRadius; 69 | ci::Colorf mColor; 70 | }; 71 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/06 - Circles/include/Resources.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "cinder/CinderResources.h" 3 | 4 | //#define RES_MY_RES CINDER_RESOURCE( ../resources/, image_name.png, 128, IMAGE ) 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/06 - Circles/resources/CinderApp.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session1/01-Data-Pointers-Classes/06 - Circles/resources/CinderApp.icns -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/06 - Circles/resources/CinderApp_ios.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session1/01-Data-Pointers-Classes/06 - Circles/resources/CinderApp_ios.png -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/06 - Circles/resources/cinder_app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session1/01-Data-Pointers-Classes/06 - Circles/resources/cinder_app_icon.ico -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/06 - Circles/vc2013/Circles.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Circles", "Circles.vcxproj", "{30C4EC5E-D235-4B32-9CC2-867C14967C74}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {30C4EC5E-D235-4B32-9CC2-867C14967C74}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {30C4EC5E-D235-4B32-9CC2-867C14967C74}.Debug|Win32.Build.0 = Debug|Win32 14 | {30C4EC5E-D235-4B32-9CC2-867C14967C74}.Release|Win32.ActiveCfg = Release|Win32 15 | {30C4EC5E-D235-4B32-9CC2-867C14967C74}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/06 - Circles/vc2013/Circles.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 5 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 6 | 7 | 8 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 9 | h;hpp;hxx;hm;inl;inc;xsd 10 | 11 | 12 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 13 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 14 | 15 | 16 | 17 | 18 | Source Files 19 | 20 | 21 | Source Files 22 | 23 | 24 | Header Files 25 | 26 | 27 | 28 | 29 | Header Files 30 | 31 | 32 | 33 | 34 | Resource Files 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/06 - Circles/vc2013/Resources.rc: -------------------------------------------------------------------------------- 1 | #include "../include/Resources.h" 2 | 3 | 1 ICON "..\\resources\\cinder_app_icon.ico" 4 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/06 - Circles/xcode/Circles_Prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | #if defined( __cplusplus ) 6 | #include "cinder/Cinder.h" 7 | 8 | #include "cinder/app/App.h" 9 | 10 | #include "cinder/gl/gl.h" 11 | 12 | #include "cinder/CinderMath.h" 13 | #include "cinder/Matrix.h" 14 | #include "cinder/Vector.h" 15 | #include "cinder/Quaternion.h" 16 | #endif 17 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/06 - Circles/xcode/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | CinderApp.icns 11 | CFBundleIdentifier 12 | org.libcinder.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2013 __MyCompanyName__. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/06 - Circles/xcode_ios/Circles_Prefix.pch: -------------------------------------------------------------------------------- 1 | #if defined( __OBJC__ ) 2 | #import 3 | #import 4 | #endif 5 | 6 | #if defined( __cplusplus ) 7 | #include "cinder/Cinder.h" 8 | 9 | #include "cinder/app/App.h" 10 | 11 | #include "cinder/gl/gl.h" 12 | 13 | #include "cinder/CinderMath.h" 14 | #include "cinder/Matrix.h" 15 | #include "cinder/Vector.h" 16 | #include "cinder/Quaternion.h" 17 | #endif -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/06 - Circles/xcode_ios/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session1/01-Data-Pointers-Classes/06 - Circles/xcode_ios/Default-568h@2x.png -------------------------------------------------------------------------------- /Session1/01-Data-Pointers-Classes/06 - Circles/xcode_ios/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIcons 14 | 15 | CFBundlePrimaryIcon 16 | 17 | CFBundleIconFiles 18 | 19 | 20 | CinderApp_ios.png 21 | 22 | UIPrerenderedIcon 23 | 24 | 25 | 26 | CFBundleIdentifier 27 | org.libcinder.${PRODUCT_NAME:rfc1034identifier} 28 | CFBundleInfoDictionaryVersion 29 | 6.0 30 | CFBundleName 31 | ${PRODUCT_NAME} 32 | CFBundlePackageType 33 | APPL 34 | CFBundleShortVersionString 35 | 1.0 36 | CFBundleSignature 37 | ???? 38 | CFBundleVersion 39 | 1 40 | LSRequiresIPhoneOS 41 | 42 | NSMainNibFile 43 | 44 | NSMainNibFile~ipad 45 | 46 | UISupportedInterfaceOrientations 47 | 48 | UIInterfaceOrientationPortrait 49 | UIInterfaceOrientationLandscapeLeft 50 | UIInterfaceOrientationLandscapeRight 51 | 52 | UISupportedInterfaceOrientations~ipad 53 | 54 | UIInterfaceOrientationPortrait 55 | UIInterfaceOrientationPortraitUpsideDown 56 | UIInterfaceOrientationLandscapeLeft 57 | UIInterfaceOrientationLandscapeRight 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Session2/02-Inheritance-Abstraction/01 - Sizeof/Sizeof/Sizeof.1: -------------------------------------------------------------------------------- 1 | .\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. 2 | .\"See Also: 3 | .\"man mdoc.samples for a complete listing of options 4 | .\"man mdoc for the short list of editing options 5 | .\"/usr/share/misc/mdoc.template 6 | .Dd 9/20/14 \" DATE 7 | .Dt Sizeof 1 \" Program name and manual section number 8 | .Os Darwin 9 | .Sh NAME \" Section Header - required - don't modify 10 | .Nm Sizeof, 11 | .\" The following lines are read in generating the apropos(man -k) database. Use only key 12 | .\" words here as the database is built based on the words here and in the .ND line. 13 | .Nm Other_name_for_same_program(), 14 | .Nm Yet another name for the same program. 15 | .\" Use .Nm macro to designate other names for the documented program. 16 | .Nd This line parsed for whatis database. 17 | .Sh SYNOPSIS \" Section Header - required - don't modify 18 | .Nm 19 | .Op Fl abcd \" [-abcd] 20 | .Op Fl a Ar path \" [-a path] 21 | .Op Ar file \" [file] 22 | .Op Ar \" [file ...] 23 | .Ar arg0 \" Underlined argument - use .Ar anywhere to underline 24 | arg2 ... \" Arguments 25 | .Sh DESCRIPTION \" Section Header - required - don't modify 26 | Use the .Nm macro to refer to your program throughout the man page like such: 27 | .Nm 28 | Underlining is accomplished with the .Ar macro like this: 29 | .Ar underlined text . 30 | .Pp \" Inserts a space 31 | A list of items with descriptions: 32 | .Bl -tag -width -indent \" Begins a tagged list 33 | .It item a \" Each item preceded by .It macro 34 | Description of item a 35 | .It item b 36 | Description of item b 37 | .El \" Ends the list 38 | .Pp 39 | A list of flags and their descriptions: 40 | .Bl -tag -width -indent \" Differs from above in tag removed 41 | .It Fl a \"-a flag as a list item 42 | Description of -a flag 43 | .It Fl b 44 | Description of -b flag 45 | .El \" Ends the list 46 | .Pp 47 | .\" .Sh ENVIRONMENT \" May not be needed 48 | .\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 49 | .\" .It Ev ENV_VAR_1 50 | .\" Description of ENV_VAR_1 51 | .\" .It Ev ENV_VAR_2 52 | .\" Description of ENV_VAR_2 53 | .\" .El 54 | .Sh FILES \" File used or created by the topic of the man page 55 | .Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact 56 | .It Pa /usr/share/file_name 57 | FILE_1 description 58 | .It Pa /Users/joeuser/Library/really_long_file_name 59 | FILE_2 description 60 | .El \" Ends the list 61 | .\" .Sh DIAGNOSTICS \" May not be needed 62 | .\" .Bl -diag 63 | .\" .It Diagnostic Tag 64 | .\" Diagnostic informtion here. 65 | .\" .It Diagnostic Tag 66 | .\" Diagnostic informtion here. 67 | .\" .El 68 | .Sh SEE ALSO 69 | .\" List links in ascending order by section, alphabetically within a section. 70 | .\" Please do not reference files that do not exist without filing a bug report 71 | .Xr a 1 , 72 | .Xr b 1 , 73 | .Xr c 1 , 74 | .Xr a 2 , 75 | .Xr b 2 , 76 | .Xr a 3 , 77 | .Xr b 3 78 | .\" .Sh BUGS \" Document known, unremedied bugs 79 | .\" .Sh HISTORY \" Document history if command behaves in a unique manner -------------------------------------------------------------------------------- /Session2/02-Inheritance-Abstraction/02 - C-StyleCasting/C-StyleCasting/C_StyleCasting.1: -------------------------------------------------------------------------------- 1 | .\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. 2 | .\"See Also: 3 | .\"man mdoc.samples for a complete listing of options 4 | .\"man mdoc for the short list of editing options 5 | .\"/usr/share/misc/mdoc.template 6 | .Dd 9/20/14 \" DATE 7 | .Dt C-StyleCasting 1 \" Program name and manual section number 8 | .Os Darwin 9 | .Sh NAME \" Section Header - required - don't modify 10 | .Nm C-StyleCasting, 11 | .\" The following lines are read in generating the apropos(man -k) database. Use only key 12 | .\" words here as the database is built based on the words here and in the .ND line. 13 | .Nm Other_name_for_same_program(), 14 | .Nm Yet another name for the same program. 15 | .\" Use .Nm macro to designate other names for the documented program. 16 | .Nd This line parsed for whatis database. 17 | .Sh SYNOPSIS \" Section Header - required - don't modify 18 | .Nm 19 | .Op Fl abcd \" [-abcd] 20 | .Op Fl a Ar path \" [-a path] 21 | .Op Ar file \" [file] 22 | .Op Ar \" [file ...] 23 | .Ar arg0 \" Underlined argument - use .Ar anywhere to underline 24 | arg2 ... \" Arguments 25 | .Sh DESCRIPTION \" Section Header - required - don't modify 26 | Use the .Nm macro to refer to your program throughout the man page like such: 27 | .Nm 28 | Underlining is accomplished with the .Ar macro like this: 29 | .Ar underlined text . 30 | .Pp \" Inserts a space 31 | A list of items with descriptions: 32 | .Bl -tag -width -indent \" Begins a tagged list 33 | .It item a \" Each item preceded by .It macro 34 | Description of item a 35 | .It item b 36 | Description of item b 37 | .El \" Ends the list 38 | .Pp 39 | A list of flags and their descriptions: 40 | .Bl -tag -width -indent \" Differs from above in tag removed 41 | .It Fl a \"-a flag as a list item 42 | Description of -a flag 43 | .It Fl b 44 | Description of -b flag 45 | .El \" Ends the list 46 | .Pp 47 | .\" .Sh ENVIRONMENT \" May not be needed 48 | .\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 49 | .\" .It Ev ENV_VAR_1 50 | .\" Description of ENV_VAR_1 51 | .\" .It Ev ENV_VAR_2 52 | .\" Description of ENV_VAR_2 53 | .\" .El 54 | .Sh FILES \" File used or created by the topic of the man page 55 | .Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact 56 | .It Pa /usr/share/file_name 57 | FILE_1 description 58 | .It Pa /Users/joeuser/Library/really_long_file_name 59 | FILE_2 description 60 | .El \" Ends the list 61 | .\" .Sh DIAGNOSTICS \" May not be needed 62 | .\" .Bl -diag 63 | .\" .It Diagnostic Tag 64 | .\" Diagnostic informtion here. 65 | .\" .It Diagnostic Tag 66 | .\" Diagnostic informtion here. 67 | .\" .El 68 | .Sh SEE ALSO 69 | .\" List links in ascending order by section, alphabetically within a section. 70 | .\" Please do not reference files that do not exist without filing a bug report 71 | .Xr a 1 , 72 | .Xr b 1 , 73 | .Xr c 1 , 74 | .Xr a 2 , 75 | .Xr b 2 , 76 | .Xr a 3 , 77 | .Xr b 3 78 | .\" .Sh BUGS \" Document known, unremedied bugs 79 | .\" .Sh HISTORY \" Document history if command behaves in a unique manner -------------------------------------------------------------------------------- /Session2/02-Inheritance-Abstraction/05 - DrawableShapes/include/Circle.h: -------------------------------------------------------------------------------- 1 | // 2 | // Circle.h 3 | // CinderProject 4 | // 5 | // Created by Mike Allison on 9/13/14. 6 | // 7 | // 8 | 9 | #pragma once 10 | #include "DrawableShape.h" 11 | 12 | // An example of an inherited class. Circle, does what it needs to 13 | // to create an instance. It implements the pure virtual 'draw' and 14 | // also removes the jiggle implementation by creating a blank update 15 | // function. Remember that you can call the base classes implementation 16 | // of a virtual function if a default implementation exists. 17 | 18 | class Circle : public DrawableShape { 19 | public: 20 | // Constructor 21 | Circle( const ci::vec2 &position, float radius ); 22 | // Destructor which will append itself to the destruction process 23 | // of circle. 24 | ~Circle() {} 25 | 26 | // Implementation of the pure virtual 'draw'. Notice the override. 27 | void draw() override; 28 | // Override of 'update'. 29 | void update() override; 30 | 31 | // Another function that could be and is used in the update override. 32 | bool isHit(); 33 | 34 | // Getter for the 'Circle'-specific data member. 35 | float getRadius(){ return mRadius; } 36 | // Setter for the 'Circle'-specific data member. 37 | void setRadius( float rad ){ mRadius = rad; } 38 | 39 | // 'private:' because you don't need to allow access 40 | private: 41 | float mRadius; 42 | }; 43 | -------------------------------------------------------------------------------- /Session2/02-Inheritance-Abstraction/05 - DrawableShapes/include/DrawableShape.h: -------------------------------------------------------------------------------- 1 | // 2 | // DrawableShape.h 3 | // Circles 4 | // 5 | // Created by Mike Allison on 9/20/14. 6 | // 7 | // 8 | 9 | #pragma once 10 | 11 | // Here's our Abstract Base Class. It is very similar to the implementation of 12 | // Circle in the 1st lesson. Basically, it's a structure that has a position and 13 | // color and it is abstract in the syntactically and conceptually. I as the 14 | // writer created this class to represent all DrawableShapes. 15 | class DrawableShape { 16 | public: 17 | 18 | // Constructor 19 | DrawableShape( const ci::vec2 &position ); 20 | // Virtual Destructor. Created this way because we intend to derive from 21 | // this base class. For a further explanation take a look at 04 - C++11AndTypes 22 | virtual ~DrawableShape(){} 23 | 24 | // Here's our pure virtual function that contractually obligates the classes 25 | // that want to inherit from a DrawableShape to implement. At this point, we 26 | // as the writers of the class have no interest how people implement drawing 27 | // to the screen, we just realize that for a DrawableShape, you have to be able 28 | // to draw. Therefore, classes inheriting from this must implement a draw method 29 | // that fulfills the purpose of putting pixels to the screen. 30 | virtual void draw() = 0; 31 | // Here's an overridable virtual function that isn't pure virtual like above. 32 | // I've decided by writing this function that drawable shapes should jiggle, 33 | // which isn't necessarily what DrawableShapes always do. Therefore, any class 34 | // can use this or override it. 35 | virtual void update(); 36 | 37 | // Getter for Position. 38 | ci::vec2 getPosition(); 39 | // Setter for Position. 40 | void setPosition( const ci::vec2& position ){ mPosition = position; } 41 | 42 | // Getter for Color. 43 | const ci::ColorAf& getColor(); 44 | // Setter for Color. 45 | void setColor( const ci::Colorf &color ) { mColor = color; } 46 | 47 | // 'protected:' so that our inheriting classes can use. 48 | protected: 49 | ci::vec2 mPosition; 50 | ci::Colorf mColor; 51 | }; 52 | 53 | 54 | -------------------------------------------------------------------------------- /Session2/02-Inheritance-Abstraction/05 - DrawableShapes/include/Resources.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "cinder/CinderResources.h" 3 | 4 | //#define RES_MY_RES CINDER_RESOURCE( ../resources/, image_name.png, 128, IMAGE ) 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Session2/02-Inheritance-Abstraction/05 - DrawableShapes/include/Square.h: -------------------------------------------------------------------------------- 1 | // 2 | // Square.h 3 | // Circles 4 | // 5 | // Created by Mike Allison on 9/20/14. 6 | // 7 | // 8 | 9 | #pragma once 10 | 11 | #include "DrawableShape.h" 12 | 13 | // An example of an inherited class. Square, does what it needs to 14 | // to create an instance. It implements the pure virtual 'draw' and 15 | // also removes the jiggle implementation by creating a blank update 16 | // function. 17 | 18 | class Square : public DrawableShape { 19 | public: 20 | 21 | // Constructor 22 | Square( const ci::vec2 &position, const ci::vec2 &size ); 23 | // Destructor which will append itself to the destruction process 24 | // of square. 25 | ~Square(){} 26 | 27 | // Implementation of the pure virtual 'draw'. Notice the override. 28 | void draw() override; 29 | // Override of 'update'. In other words, squares will not update 30 | // their positions. 31 | void update() override { } 32 | 33 | // Getter for the 'Square'-specific data member. 34 | ci::vec2 getSize() { return mSize; } 35 | // Setter for the 'Square'-specific data member. 36 | void setSize( const ci::vec2& size ){ mSize = size; } 37 | 38 | // 'private:' because you don't need to allow access 39 | private: 40 | ci::vec2 mSize; 41 | }; -------------------------------------------------------------------------------- /Session2/02-Inheritance-Abstraction/05 - DrawableShapes/resources/CinderApp.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session2/02-Inheritance-Abstraction/05 - DrawableShapes/resources/CinderApp.icns -------------------------------------------------------------------------------- /Session2/02-Inheritance-Abstraction/05 - DrawableShapes/resources/CinderApp_ios.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session2/02-Inheritance-Abstraction/05 - DrawableShapes/resources/CinderApp_ios.png -------------------------------------------------------------------------------- /Session2/02-Inheritance-Abstraction/05 - DrawableShapes/resources/cinder_app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session2/02-Inheritance-Abstraction/05 - DrawableShapes/resources/cinder_app_icon.ico -------------------------------------------------------------------------------- /Session2/02-Inheritance-Abstraction/05 - DrawableShapes/src/Circle.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Circle.cpp 3 | // CinderProject 4 | // 5 | // Created by Mike Allison on 9/13/14. 6 | // 7 | // 8 | 9 | 10 | #include "cinder/gl/gl.h" 11 | #include "cinder/Rand.h" 12 | 13 | #include "Circle.h" 14 | 15 | #include 16 | 17 | 18 | using namespace std; 19 | using namespace ci; 20 | 21 | // Here's our implementation of the declared functions for circle. 22 | 23 | Circle::Circle( const vec2 &position, float radius ) 24 | // DrawableShape is inialized first. 25 | : DrawableShape( position ), mRadius( radius ) 26 | { 27 | } 28 | 29 | // Here's our update implementation that calls the base class 30 | // implementation (jiggle) before testing whether it's been 31 | // hit. 32 | void Circle::update() 33 | { 34 | DrawableShape::update(); 35 | if ( isHit() ) { 36 | // do something 37 | } 38 | } 39 | 40 | // Pretend that 'Circle' can collide with things and so we need 41 | // this function to tell us if we've hit. Right now it just is 42 | // default to true. 43 | bool Circle::isHit() 44 | { 45 | return true; 46 | } 47 | 48 | // This implementation is specific to Circle which DrawableShape allows 49 | // us to create because of the pure virtual function of 'draw'. 50 | void Circle::draw() 51 | { 52 | gl::color( mColor ); 53 | gl::drawSolidCircle( mPosition, mRadius ); 54 | } 55 | 56 | -------------------------------------------------------------------------------- /Session2/02-Inheritance-Abstraction/05 - DrawableShapes/src/DrawableShape.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // DrawableShape.cpp 3 | // DrawableShapes 4 | // 5 | // Created by Mike Allison on 9/20/14. 6 | // 7 | // 8 | 9 | #include "DrawableShape.h" 10 | #include "cinder/gl/gl.h" 11 | #include "cinder/Rand.h" 12 | 13 | #include 14 | 15 | 16 | using namespace std; 17 | using namespace ci; 18 | 19 | DrawableShape::DrawableShape( const vec2 &position ) 20 | : mPosition( position ), mColor( randFloat(), randFloat(), randFloat() ) 21 | { 22 | } 23 | 24 | void DrawableShape::update() 25 | { 26 | mPosition += randVec2(); 27 | } 28 | 29 | 30 | vec2 DrawableShape::getPosition() 31 | { 32 | return mPosition; 33 | } 34 | 35 | 36 | -------------------------------------------------------------------------------- /Session2/02-Inheritance-Abstraction/05 - DrawableShapes/src/DrawableShapesApp.cpp: -------------------------------------------------------------------------------- 1 | #include "cinder/app/App.h" 2 | #include "cinder/app/RendererGl.h" 3 | #include "cinder/gl/gl.h" 4 | #include "cinder/Rand.h" 5 | 6 | #include "DrawableShape.h" 7 | #include "Circle.h" 8 | #include "Square.h" 9 | 10 | using namespace ci; 11 | using namespace ci::app; 12 | using namespace std; 13 | 14 | // I know how many shapes I'd like to make. So, instead of magic numbers all over my 15 | // code. I'll make a global const int and by convention, I'll capitalize all the letters 16 | // to emphasize that it's constant. 17 | const int NUM_SHAPES = 1000; 18 | 19 | // If you need a refresher of what is going on here, look to the 04 - Cpp11AndTypes 20 | // sample. We're basically just defining human readable types. 21 | using DrawableShapeRef = std::shared_ptr< DrawableShape >; 22 | using CircleRef = std::shared_ptr; 23 | using SquareRef = std::shared_ptr; 24 | using DrawableShapes = std::vector; 25 | 26 | class DrawableShapesApp : public App { 27 | public: 28 | void setup() override; 29 | void update() override; 30 | void draw() override; 31 | 32 | // My human readable type, which is defined above as... 33 | // std::vector> 34 | DrawableShapes mShapes; 35 | }; 36 | 37 | void DrawableShapesApp::setup() 38 | { 39 | // I know how many shapes I'd like so I'll resize the vector to that exact number. 40 | mShapes.resize( NUM_SHAPES ); 41 | 42 | 43 | bool square = false; 44 | // Now I just for each mShapes, which constructed nullptr'd shared_ptr's of type 45 | // DrawableShapes, inside the loop I initialize each one. 46 | for( auto & shape : mShapes ) { 47 | // both need a position. Remember because the type on the right is already 48 | // figured out, 'auto' is here to tell the compiler to infer it. therefore 49 | // position is of type vec2. 50 | auto position = vec2( randFloat( 0, getWindowWidth() ), randFloat( 0, getWindowHeight() ) ); 51 | 52 | // I use this construct to create half as circle's and half as squares. 53 | if( square ) { 54 | // same use of auto here as above. 55 | auto size = vec2( randFloat( 5, 10 ), randFloat( 5, 10 ) ); 56 | // we use the 'reset' function of shape which destroys the inner member 57 | // pointer if it exists. One doesn't exist as the above comment tells 58 | // us that resize just creates NUM_SHAPES instances of empty shared_ptr's 59 | // Then reset takes the pointer returned by new and stores that pointer 60 | // inside this shape. 61 | shape.reset( new Square( position, size ) ); 62 | } 63 | else { 64 | // same use of auto as above. randFloat returns a float so radius is 65 | // inferred to float. 66 | auto radius = randFloat( 5, 10 ); 67 | shape.reset( new Circle( position, radius ) ); 68 | } 69 | // swap to create a square or circle. 70 | square = !square; 71 | } 72 | } 73 | 74 | void DrawableShapesApp::update() 75 | { 76 | // Just iterate through mShapes and update. it uses either the default or the 77 | // overriden implementation. 78 | for( auto& shape : mShapes ) { 79 | shape->update(); 80 | } 81 | } 82 | 83 | void DrawableShapesApp::draw() 84 | { 85 | // clear out the window with black 86 | gl::clear( Color( 0, 0, 0 ) ); 87 | 88 | // As above, we just iterate through mShapes and use the draw function of the 89 | // current shape's (which could be either Circle's or Square's) implementation 90 | for( auto& shape : mShapes ) { 91 | shape->draw(); 92 | } 93 | } 94 | 95 | CINDER_APP( DrawableShapesApp, RendererGl ) 96 | -------------------------------------------------------------------------------- /Session2/02-Inheritance-Abstraction/05 - DrawableShapes/src/Square.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Square.cpp 3 | // Circles 4 | // 5 | // Created by Mike Allison on 9/20/14. 6 | // 7 | // 8 | 9 | #include "Square.h" 10 | #include "cinder/app/App.h" 11 | 12 | using namespace ci; 13 | using namespace ci::app; 14 | 15 | // Here's our implementation of the declared functions for square. 16 | 17 | Square::Square( const vec2 &position, const vec2 &size ) 18 | // DrawableShape is inialized first. 19 | : DrawableShape( position ), mSize( size ) 20 | { 21 | } 22 | 23 | // This implementation is specific to Square which DrawableShape allows 24 | // us to create because of the pure virtual function of 'draw'. 25 | void Square::draw() 26 | { 27 | gl::color(mColor); 28 | gl::drawSolidRect(Rectf( mPosition, mPosition+mSize )); 29 | 30 | } -------------------------------------------------------------------------------- /Session2/02-Inheritance-Abstraction/05 - DrawableShapes/vc2013/DrawableShapes.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DrawableShapes", "DrawableShapes.vcxproj", "{4C89F06D-6FD3-4F84-B51E-B7B2DF93571C}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {4C89F06D-6FD3-4F84-B51E-B7B2DF93571C}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {4C89F06D-6FD3-4F84-B51E-B7B2DF93571C}.Debug|Win32.Build.0 = Debug|Win32 14 | {4C89F06D-6FD3-4F84-B51E-B7B2DF93571C}.Release|Win32.ActiveCfg = Release|Win32 15 | {4C89F06D-6FD3-4F84-B51E-B7B2DF93571C}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /Session2/02-Inheritance-Abstraction/05 - DrawableShapes/vc2013/DrawableShapes.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 5 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 6 | 7 | 8 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 9 | h;hpp;hxx;hm;inl;inc;xsd 10 | 11 | 12 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 13 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 14 | 15 | 16 | 17 | 18 | Source Files 19 | 20 | 21 | Source Files 22 | 23 | 24 | Header Files 25 | 26 | 27 | 28 | 29 | Header Files 30 | 31 | 32 | 33 | 34 | Resource Files 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /Session2/02-Inheritance-Abstraction/05 - DrawableShapes/vc2013/Resources.rc: -------------------------------------------------------------------------------- 1 | #include "../include/Resources.h" 2 | 3 | 1 ICON "..\\resources\\cinder_app_icon.ico" 4 | -------------------------------------------------------------------------------- /Session2/02-Inheritance-Abstraction/05 - DrawableShapes/xcode/DrawableShapes_Prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | #if defined( __cplusplus ) 6 | #include "cinder/Cinder.h" 7 | 8 | #include "cinder/app/App.h" 9 | 10 | #include "cinder/gl/gl.h" 11 | 12 | #include "cinder/CinderMath.h" 13 | #include "cinder/Matrix.h" 14 | #include "cinder/Vector.h" 15 | #include "cinder/Quaternion.h" 16 | #endif 17 | -------------------------------------------------------------------------------- /Session2/02-Inheritance-Abstraction/05 - DrawableShapes/xcode/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | CinderApp.icns 11 | CFBundleIdentifier 12 | org.libcinder.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2013 __MyCompanyName__. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /Session2/02-Inheritance-Abstraction/05 - DrawableShapes/xcode_ios/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session2/02-Inheritance-Abstraction/05 - DrawableShapes/xcode_ios/Default-568h@2x.png -------------------------------------------------------------------------------- /Session2/02-Inheritance-Abstraction/05 - DrawableShapes/xcode_ios/DrawableShapes_Prefix.pch: -------------------------------------------------------------------------------- 1 | #if defined( __OBJC__ ) 2 | #import 3 | #import 4 | #endif 5 | 6 | #if defined( __cplusplus ) 7 | #include "cinder/Cinder.h" 8 | 9 | #include "cinder/gl/gl.h" 10 | 11 | #include "cinder/CinderMath.h" 12 | #include "cinder/Matrix.h" 13 | #include "cinder/Vector.h" 14 | #include "cinder/Quaternion.h" 15 | #endif -------------------------------------------------------------------------------- /Session2/02-Inheritance-Abstraction/05 - DrawableShapes/xcode_ios/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIcons 14 | 15 | CFBundlePrimaryIcon 16 | 17 | CFBundleIconFiles 18 | 19 | 20 | CinderApp_ios.png 21 | 22 | UIPrerenderedIcon 23 | 24 | 25 | 26 | CFBundleIdentifier 27 | org.libcinder.${PRODUCT_NAME:rfc1034identifier} 28 | CFBundleInfoDictionaryVersion 29 | 6.0 30 | CFBundleName 31 | ${PRODUCT_NAME} 32 | CFBundlePackageType 33 | APPL 34 | CFBundleShortVersionString 35 | 1.0 36 | CFBundleSignature 37 | ???? 38 | CFBundleVersion 39 | 1 40 | LSRequiresIPhoneOS 41 | 42 | NSMainNibFile 43 | 44 | NSMainNibFile~ipad 45 | 46 | UISupportedInterfaceOrientations 47 | 48 | UIInterfaceOrientationPortrait 49 | UIInterfaceOrientationLandscapeLeft 50 | UIInterfaceOrientationLandscapeRight 51 | 52 | UISupportedInterfaceOrientations~ipad 53 | 54 | UIInterfaceOrientationPortrait 55 | UIInterfaceOrientationPortraitUpsideDown 56 | UIInterfaceOrientationLandscapeLeft 57 | UIInterfaceOrientationLandscapeRight 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Session3/03-Functional/02 - Functor/02 - Functor.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Session3/03-Functional/02 - Functor/02 - Functor.xcodeproj/project.xcworkspace/xcuserdata/Craig.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session3/03-Functional/02 - Functor/02 - Functor.xcodeproj/project.xcworkspace/xcuserdata/Craig.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Session3/03-Functional/02 - Functor/02 - Functor.xcodeproj/xcuserdata/Craig.xcuserdatad/xcschemes/02 - Functor.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /Session3/03-Functional/02 - Functor/02 - Functor.xcodeproj/xcuserdata/Craig.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | 02 - Functor.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | B39C60691B3BD97900DA288C 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Session3/03-Functional/03 - StdFuncBind/03 - StdFuncBind.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Session3/03-Functional/03 - StdFuncBind/03 - StdFuncBind.xcodeproj/project.xcworkspace/xcuserdata/Craig.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session3/03-Functional/03 - StdFuncBind/03 - StdFuncBind.xcodeproj/project.xcworkspace/xcuserdata/Craig.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Session3/03-Functional/03 - StdFuncBind/03 - StdFuncBind.xcodeproj/xcuserdata/Craig.xcuserdatad/xcschemes/03 - StdFuncBind.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /Session3/03-Functional/03 - StdFuncBind/03 - StdFuncBind.xcodeproj/xcuserdata/Craig.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | 03 - StdFuncBind.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | B39C607C1B3C44C700DA288C 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Session3/03-Functional/03 - StdFuncBind/03 - StdFuncBind/main.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // main.cpp 3 | // 3-StdFuncBind 4 | // 5 | // Created by ryan bartley on 6/25/15. 6 | // Copyright (c) 2015 ryan bartley. All rights reserved. 7 | // 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | // If you've made it here congrats. You're definitely on your way and I'm 15 | // not patronizing you. C++ is hard as hell and if you can keep up that's 16 | // half the battle. 17 | 18 | // This example is much harder than the previous because of it's reliance 19 | // on templates. 20 | 21 | void f(int n1, int n2, int n3, const int& n4, int n5) 22 | { 23 | std::cout << n1 << ' ' << n2 << ' ' << n3 << ' ' << n4 << ' ' << n5 << '\n'; 24 | } 25 | 26 | int g(int n1) 27 | { 28 | return n1; 29 | } 30 | 31 | struct Foo { 32 | void print_sum(int n1, int n2) 33 | { 34 | std::cout << n1+n2 << '\n'; 35 | } 36 | int data = 10; 37 | }; 38 | 39 | int main() 40 | { 41 | using namespace std::placeholders; // for _1, _2, _3... 42 | 43 | // demonstrates argument reordering and pass-by-reference 44 | int n = 7; 45 | // (_1 and _2 are from std::placeholders, and represent future 46 | // arguments that will be passed to f1) 47 | auto f1 = std::bind(f, _2, _1, 42, std::cref(n), n); 48 | n = 10; 49 | f1(1, 2, 1001); // 1 is bound by _2, 2 is bound by _1, 1001 is unused 50 | 51 | // nested bind subexpressions share the placeholders 52 | auto f2 = std::bind(f, _3, std::bind(g, _3), _3, 4, 5); 53 | f2(10, 11, 12); 54 | 55 | // common use case: binding a RNG with a distribution 56 | std::default_random_engine e; 57 | std::uniform_int_distribution<> d(0, 10); 58 | std::function rnd = std::bind(d, e); // a copy of e is stored in rnd 59 | for(int n=0; n<10; ++n) 60 | std::cout << rnd() << ' '; 61 | std::cout << '\n'; 62 | 63 | // bind to a member function 64 | Foo foo; 65 | auto f3 = std::bind(&Foo::print_sum, &foo, 95, _1); 66 | f3(5); 67 | 68 | // bind to member data 69 | auto f4 = std::bind(&Foo::data, _1); 70 | std::cout << "foo" << f4(foo) << '\n'; 71 | 72 | // smart pointers can be used to call members of the referenced objects, too 73 | std::cout << f4(std::make_shared(foo)) << '\n' 74 | << f4(std::unique_ptr(new Foo(foo))) << '\n'; 75 | } 76 | -------------------------------------------------------------------------------- /Session3/03-Functional/04 - Lambda/04 - Lambda.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Session3/03-Functional/04 - Lambda/04 - Lambda.xcodeproj/project.xcworkspace/xcuserdata/Craig.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session3/03-Functional/04 - Lambda/04 - Lambda.xcodeproj/project.xcworkspace/xcuserdata/Craig.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Session3/03-Functional/04 - Lambda/04 - Lambda.xcodeproj/xcuserdata/Craig.xcuserdatad/xcschemes/04 - Lambda.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /Session3/03-Functional/04 - Lambda/04 - Lambda.xcodeproj/xcuserdata/Craig.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | 04 - Lambda.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | B39C608F1B3C450A00DA288C 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Session3/03-Functional/04 - Lambda/04 - Lambda/main.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // main.cpp 3 | // 4-Lambda 4 | // 5 | // Created by ryan bartley on 6/25/15. 6 | // Copyright (c) 2015 ryan bartley. All rights reserved. 7 | // 8 | 9 | #include 10 | 11 | int main(int argc, const char * argv[]) { 12 | // insert code here... 13 | std::cout << "Hello, World!\n"; 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /Session3/03-Functional/05 - Signals/include/Resources.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "cinder/CinderResources.h" 3 | 4 | //#define RES_MY_RES CINDER_RESOURCE( ../resources/, image_name.png, 128, IMAGE ) 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Session3/03-Functional/05 - Signals/resources/CinderApp.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session3/03-Functional/05 - Signals/resources/CinderApp.icns -------------------------------------------------------------------------------- /Session3/03-Functional/05 - Signals/resources/cinder_app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session3/03-Functional/05 - Signals/resources/cinder_app_icon.ico -------------------------------------------------------------------------------- /Session3/03-Functional/05 - Signals/src/SignalsApp.cpp: -------------------------------------------------------------------------------- 1 | #include "cinder/app/App.h" 2 | #include "cinder/app/RendererGl.h" 3 | #include "cinder/gl/gl.h" 4 | 5 | using namespace ci; 6 | using namespace ci::app; 7 | using namespace std; 8 | 9 | class SignalsApp : public App { 10 | public: 11 | void setup() override; 12 | void mouseDown( MouseEvent event ) override; 13 | void update() override; 14 | void draw() override; 15 | }; 16 | 17 | void SignalsApp::setup() 18 | { 19 | } 20 | 21 | void SignalsApp::mouseDown( MouseEvent event ) 22 | { 23 | } 24 | 25 | void SignalsApp::update() 26 | { 27 | } 28 | 29 | void SignalsApp::draw() 30 | { 31 | gl::clear( Color( 0, 0, 0 ) ); 32 | } 33 | 34 | CINDER_APP( SignalsApp, RendererGl ) 35 | -------------------------------------------------------------------------------- /Session3/03-Functional/05 - Signals/vc2013/Resources.rc: -------------------------------------------------------------------------------- 1 | #include "../include/Resources.h" 2 | 3 | 1 ICON "..\\resources\\cinder_app_icon.ico" 4 | -------------------------------------------------------------------------------- /Session3/03-Functional/05 - Signals/vc2013/Signals.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Signals", "Signals.vcxproj", "{08B08939-370F-4321-AC76-6E5191020078}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x64 = Debug|x64 9 | Release|x64 = Release|x64 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {08B08939-370F-4321-AC76-6E5191020078}.Debug|x64.ActiveCfg = Debug|x64 13 | {08B08939-370F-4321-AC76-6E5191020078}.Debug|x64.Build.0 = Debug|x64 14 | {08B08939-370F-4321-AC76-6E5191020078}.Release|x64.ActiveCfg = Release|x64 15 | {08B08939-370F-4321-AC76-6E5191020078}.Release|x64.Build.0 = Release|x64 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /Session3/03-Functional/05 - Signals/vc2013/Signals.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 5 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 6 | 7 | 8 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 9 | h;hpp;hxx;hm;inl;inc;xsd 10 | 11 | 12 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 13 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 14 | 15 | 16 | 17 | 18 | Source Files 19 | 20 | 21 | Source Files 22 | 23 | 24 | Header Files 25 | 26 | 27 | 28 | 29 | Header Files 30 | 31 | 32 | 33 | 34 | Resource Files 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /Session3/03-Functional/05 - Signals/xcode/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | CinderApp.icns 11 | CFBundleIdentifier 12 | org.libcinder.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2013 __MyCompanyName__. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /Session3/03-Functional/05 - Signals/xcode/Signals.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Session3/03-Functional/05 - Signals/xcode/Signals.xcodeproj/project.xcworkspace/xcuserdata/Craig.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session3/03-Functional/05 - Signals/xcode/Signals.xcodeproj/project.xcworkspace/xcuserdata/Craig.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Session3/03-Functional/05 - Signals/xcode/Signals.xcodeproj/project.xcworkspace/xcuserdata/Craig.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildLocationStyle 6 | UseTargetSettings 7 | 8 | 9 | -------------------------------------------------------------------------------- /Session3/03-Functional/05 - Signals/xcode/Signals.xcodeproj/xcuserdata/Craig.xcuserdatad/xcschemes/Signals.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /Session3/03-Functional/05 - Signals/xcode/Signals.xcodeproj/xcuserdata/Craig.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Signals.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 8D1107260486CEB800E47090 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Session3/03-Functional/05 - Signals/xcode/Signals_Prefix.pch: -------------------------------------------------------------------------------- 1 | #if defined( __cplusplus ) 2 | #include "cinder/Cinder.h" 3 | 4 | #include "cinder/app/App.h" 5 | 6 | #include "cinder/gl/gl.h" 7 | 8 | #include "cinder/CinderMath.h" 9 | #include "cinder/Matrix.h" 10 | #include "cinder/Vector.h" 11 | #include "cinder/Quaternion.h" 12 | #endif 13 | -------------------------------------------------------------------------------- /Session3/03-Functional/05 - Signals/xcode/build/Signals.build/Debug/Signals.build/Objects-normal/x86_64/Signals.LinkFileList: -------------------------------------------------------------------------------- 1 | /Users/Craig/Documents/unconference/CreativeCoding/03-Functional/05 - Signals/xcode/build/Signals.build/Debug/Signals.build/Objects-normal/x86_64/SignalsApp.o 2 | -------------------------------------------------------------------------------- /Session3/03-Functional/05 - Signals/xcode/build/Signals.build/Debug/Signals.build/Signals-all-non-framework-target-headers.hmap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session3/03-Functional/05 - Signals/xcode/build/Signals.build/Debug/Signals.build/Signals-all-non-framework-target-headers.hmap -------------------------------------------------------------------------------- /Session3/03-Functional/05 - Signals/xcode/build/Signals.build/Debug/Signals.build/Signals-all-target-headers.hmap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session3/03-Functional/05 - Signals/xcode/build/Signals.build/Debug/Signals.build/Signals-all-target-headers.hmap -------------------------------------------------------------------------------- /Session3/03-Functional/05 - Signals/xcode/build/Signals.build/Debug/Signals.build/Signals-generated-files.hmap: -------------------------------------------------------------------------------- 1 | pamhx -------------------------------------------------------------------------------- /Session3/03-Functional/05 - Signals/xcode/build/Signals.build/Debug/Signals.build/Signals-own-target-headers.hmap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session3/03-Functional/05 - Signals/xcode/build/Signals.build/Debug/Signals.build/Signals-own-target-headers.hmap -------------------------------------------------------------------------------- /Session3/03-Functional/05 - Signals/xcode/build/Signals.build/Debug/Signals.build/Signals-project-headers.hmap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session3/03-Functional/05 - Signals/xcode/build/Signals.build/Debug/Signals.build/Signals-project-headers.hmap -------------------------------------------------------------------------------- /Session3/03-Functional/05 - Signals/xcode/build/Signals.build/Debug/Signals.build/Signals.hmap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session3/03-Functional/05 - Signals/xcode/build/Signals.build/Debug/Signals.build/Signals.hmap -------------------------------------------------------------------------------- /Session3/03-Functional/05 - Signals/xcode/build/Signals.build/Debug/Signals.build/dgph: -------------------------------------------------------------------------------- 1 | DGPH1.04 Oct 19 201516:32:50e/UsersCraig Documents unconferenceCreativeCoding 03-Functional 05 - Signalsxcode buildtmp Signals.dstvar foldersc6hgdpfy2n6gn9vqp6r2nyv43r0000gnCcom.apple.DeveloperTools 7.1.1-7B1005Xcode 2 | Debug 3 | Signals.buildDebugSharedPrecompiledHeaders Applications Xcode.appContents Developer PlatformsMacOSX.platform DeveloperSDKs MacOSX10.11.sdk 4 | Info.plist Signals.build#DerivedSources Signals.app%Contents& 5 | Info.plist&PkgInfo&MacOS)Signals& ResourcesOnDemandResources resources-CinderApp.icns+CinderApp.icnssrc0SignalsApp.cpp#Objects-normal2x86_643 SignalsApp.o Signals_Prefix.pch+Signals_Prefix-hjjxgfdrwkblvtfwniubcpjtdkkg6Signals_Prefix.pch.pch!SDKSettings.plist!System9Library: CoreServices;SystemVersion.plist3SignalsApp.astLibrary> Developer?Xcode@ DerivedDataA$Signals-cxeaykfrtmnjpgdehljncoculjiwBIndexCPrecompiledHeadersD/Signals_Prefix-elminhnifdedvibuttskgkdvppao_astESignals_Prefix.pch.pch3Signals.LinkFileList: 6 | FrameworksHAVFoundation.frameworkI AVFoundationHCoreMedia.frameworkK CoreMediaSystemMLibraryN 7 | FrameworksOCocoa.frameworkPCocoaOOpenGL.frameworkROpenGLOCoreVideo.frameworkT CoreVideoHAccelerate.frameworkV 8 | AccelerateHAudioToolbox.frameworkX AudioToolboxHAudioUnit.frameworkZ AudioUnitHCoreAudio.framework\ CoreAudioHIOKit.framework^IOKitHIOSurface.framework` IOSurface{&Headers&PrivateHeaders&PlugIns -------------------------------------------------------------------------------- /Session3/03-Functional/05 - Signals/xcode/build/Signals.build/Debug/Signals.build/dgph~: -------------------------------------------------------------------------------- 1 | DGPH1.04 Oct 19 201516:32:50 /UsersCraig Documents unconferenceCreativeCoding 03-Functional 05 - Signalsxcode -------------------------------------------------------------------------------- /Session3/03-Functional/06 - CollidableShapes/include/Circle.h: -------------------------------------------------------------------------------- 1 | // 2 | // Circle.h 3 | // CinderProject 4 | // 5 | // Created by Mike Allison on 9/13/14. 6 | // 7 | // 8 | 9 | #pragma once 10 | 11 | #include "InteractableShape.h" 12 | 13 | using CircleRef = std::shared_ptr; 14 | 15 | class Circle : public InteractableShape { 16 | public: 17 | Circle( const ci::ColorAf &color, const ci::vec2 &position, float radius ); 18 | ~Circle() {} 19 | 20 | static const int mId; 21 | 22 | void draw() override; 23 | void update() override; 24 | void hit() override; 25 | const int& getType() const { return mId; } 26 | 27 | float getRadius(){ return mRadius; } 28 | void setRadius( float rad ){ mRadius = rad; } 29 | 30 | private: 31 | float mRadius; 32 | }; 33 | -------------------------------------------------------------------------------- /Session3/03-Functional/06 - CollidableShapes/include/CollisionSystem.h: -------------------------------------------------------------------------------- 1 | // 2 | // CollisionSystem.h 3 | // CollidableShapes 4 | // 5 | // Created by Ryan Bartley on 9/25/14. 6 | // 7 | // 8 | 9 | #pragma once 10 | 11 | #include "InteractableShape.h" 12 | 13 | using Callback = std::function; 14 | 15 | class CollisionSystem { 16 | public: 17 | 18 | CollisionSystem(){} 19 | ~CollisionSystem(){} 20 | 21 | void update(); 22 | void draw(); 23 | 24 | void addShape( const InteractableShapeRef& shape ); 25 | void addCallback( int type, const Callback& callback ); 26 | 27 | void checkMouse( const ci::vec2& mousePos ); 28 | 29 | private: 30 | std::vector mShapes; 31 | std::map mCallbacks; 32 | }; -------------------------------------------------------------------------------- /Session3/03-Functional/06 - CollidableShapes/include/DrawableShape.h: -------------------------------------------------------------------------------- 1 | // 2 | // DrawableShape.h 3 | // Circles 4 | // 5 | // Created by Mike Allison on 9/20/14. 6 | // 7 | // 8 | 9 | #pragma once 10 | 11 | class DrawableShape { 12 | public: 13 | 14 | // Constructor 15 | DrawableShape( const ci::ColorAf &color ); 16 | virtual ~DrawableShape(){} 17 | 18 | virtual void draw() = 0; 19 | 20 | const ci::ColorAf& getColor(); 21 | void setColor( const ci::Colorf &color ) { mColor = color; } 22 | 23 | protected: 24 | ci::ColorAf mColor; 25 | }; 26 | 27 | 28 | -------------------------------------------------------------------------------- /Session3/03-Functional/06 - CollidableShapes/include/InteractableShape.h: -------------------------------------------------------------------------------- 1 | // 2 | // CollidableShape.h 3 | // CollidableShapes 4 | // 5 | // Created by Ryan Bartley on 9/25/14. 6 | // 7 | // 8 | 9 | #pragma once 10 | 11 | #include "cinder/Rect.h" 12 | 13 | #include "DrawableShape.h" 14 | #include "cinder/app/App.h" 15 | 16 | using InteractableShapeRef = std::shared_ptr< class InteractableShape >; 17 | 18 | class InteractableShape : public DrawableShape { 19 | public: 20 | 21 | InteractableShape( const ci::ColorAf &color, const ci::vec2 &position, const ci::vec2 &size ) 22 | : DrawableShape( color ), mPosition( position ), mVelocity( ci::vec2( 0 ) ), mSize( size ) {} 23 | 24 | virtual ~InteractableShape() {} 25 | 26 | virtual void update() { 27 | 28 | //update position 29 | 30 | mPosition += mVelocity; 31 | 32 | //check edges 33 | 34 | if( mPosition.x > ci::app::getWindowWidth() - mSize.x/2 || mPosition.x < mSize.x/2 35 | || mPosition.y > ci::app::getWindowHeight() - mSize.y/2 || mPosition.y < mSize.y/2 ) 36 | mVelocity.y *= -1; 37 | } 38 | 39 | virtual void hit() { mVelocity *= -1; } 40 | 41 | virtual const int& getType() const = 0; 42 | 43 | bool contains( const ci::vec2 &position ) { return ci::Rectf( mPosition, mPosition+mSize ).contains( position ); } 44 | bool intersects( const ci::Rectf &boundingRect ) { return ci::Rectf( mPosition, mPosition+mSize ).intersects( boundingRect ); } 45 | 46 | const ci::vec2& getSize() { return mSize; } 47 | const ci::vec2& getVelocity() { return mVelocity; } 48 | const ci::vec2& getPosition() { return mPosition; } 49 | void setPosition( const ci::vec2& position ){ mPosition = position; } 50 | 51 | protected: 52 | 53 | void setVelocity( const ci::vec2& velocity ) { mVelocity = velocity; } 54 | 55 | ci::vec2 mPosition; 56 | ci::vec2 mVelocity; 57 | ci::vec2 mSize; 58 | 59 | friend class CollisionSystem; 60 | }; 61 | -------------------------------------------------------------------------------- /Session3/03-Functional/06 - CollidableShapes/include/Resources.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "cinder/CinderResources.h" 3 | 4 | //#define RES_MY_RES CINDER_RESOURCE( ../resources/, image_name.png, 128, IMAGE ) 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Session3/03-Functional/06 - CollidableShapes/include/Square.h: -------------------------------------------------------------------------------- 1 | // 2 | // Square.h 3 | // Circles 4 | // 5 | // Created by Mike Allison on 9/20/14. 6 | // 7 | // 8 | 9 | #pragma once 10 | 11 | #include "InteractableShape.h" 12 | 13 | using SquareRef = std::shared_ptr; 14 | 15 | class Square : public InteractableShape { 16 | public: 17 | 18 | Square( const ci::ColorAf &color, const ci::vec2 &position, const ci::vec2 &size ); 19 | ~Square(){} 20 | 21 | static const int mId; 22 | 23 | void draw() override; 24 | void update() override; 25 | void hit() override; 26 | const int& getType() const { return mId; } 27 | 28 | private: 29 | }; -------------------------------------------------------------------------------- /Session3/03-Functional/06 - CollidableShapes/resources/CinderApp.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session3/03-Functional/06 - CollidableShapes/resources/CinderApp.icns -------------------------------------------------------------------------------- /Session3/03-Functional/06 - CollidableShapes/resources/CinderApp_ios.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session3/03-Functional/06 - CollidableShapes/resources/CinderApp_ios.png -------------------------------------------------------------------------------- /Session3/03-Functional/06 - CollidableShapes/resources/cinder_app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session3/03-Functional/06 - CollidableShapes/resources/cinder_app_icon.ico -------------------------------------------------------------------------------- /Session3/03-Functional/06 - CollidableShapes/src/Circle.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Circle.cpp 3 | // CinderProject 4 | // 5 | // Created by Mike Allison on 9/13/14. 6 | // 7 | // 8 | 9 | 10 | #include "cinder/gl/gl.h" 11 | #include "cinder/Rand.h" 12 | 13 | #include "Circle.h" 14 | 15 | #include 16 | 17 | 18 | using namespace std; 19 | using namespace ci; 20 | 21 | Circle::Circle( const ci::ColorAf &color, const vec2 &position, float radius ) 22 | : InteractableShape( color, position, vec2( radius*2, radius*2 ) ), mRadius( radius ) 23 | { 24 | } 25 | 26 | const int Circle::mId = 0; 27 | 28 | void Circle::update() 29 | { 30 | InteractableShape::update(); 31 | 32 | //circle update stuff here 33 | 34 | } 35 | 36 | void Circle::hit(){ 37 | 38 | InteractableShape::hit(); 39 | 40 | //do something here when it gets hit. 41 | 42 | } 43 | 44 | 45 | void Circle::draw() 46 | { 47 | gl::color( mColor ); 48 | gl::drawSolidCircle( mPosition, mRadius ); 49 | } 50 | 51 | -------------------------------------------------------------------------------- /Session3/03-Functional/06 - CollidableShapes/src/CollidableShapesApp.cpp: -------------------------------------------------------------------------------- 1 | #include "cinder/app/App.h" 2 | #include "cinder/app/RendererGl.h" 3 | #include "cinder/gl/gl.h" 4 | #include "cinder/Rand.h" 5 | 6 | #include "CollisionSystem.h" 7 | #include "Circle.h" 8 | #include "Square.h" 9 | 10 | using namespace ci; 11 | using namespace ci::app; 12 | using namespace std; 13 | 14 | enum ShapeType { 15 | SQUARE = 0, 16 | CIRCLE = 1 17 | }; 18 | 19 | class DrawableShapesApp : public App { 20 | public: 21 | void setup() override; 22 | void mouseDown( MouseEvent event ) override; 23 | void update() override; 24 | void draw() override; 25 | 26 | CollisionSystem mSystem; 27 | 28 | }; 29 | 30 | void DrawableShapesApp::setup() 31 | { 32 | 33 | for( int i = 0; i < 100; i++){ 34 | 35 | if( i % 2 == 0 ) 36 | mSystem.addShape( 37 | CircleRef( new Circle( 38 | ColorAf( randFloat(), randFloat(), randFloat(), 1. ), 39 | vec2( randFloat(getWindowWidth()), randFloat(getWindowHeight()) ), 40 | randFloat(5, 15) 41 | ) 42 | ) 43 | ); 44 | else 45 | mSystem.addShape( 46 | SquareRef( new Square( 47 | ColorAf( randFloat(), randFloat(), randFloat(), 1. ), 48 | vec2( randFloat(getWindowWidth()), randFloat(getWindowHeight()) ), 49 | vec2(randFloat(5, 10),randFloat(5,10) ) 50 | ) 51 | ) 52 | ); 53 | 54 | 55 | } 56 | 57 | } 58 | 59 | void DrawableShapesApp::mouseDown( MouseEvent event ) 60 | { 61 | mSystem.checkMouse(event.getPos()); 62 | } 63 | 64 | void DrawableShapesApp::update() 65 | { 66 | mSystem.update(); 67 | } 68 | 69 | void DrawableShapesApp::draw() 70 | { 71 | // clear out the window with black 72 | gl::clear( Color( 0, 0, 0 ) ); 73 | mSystem.draw(); 74 | 75 | } 76 | 77 | CINDER_APP( DrawableShapesApp, RendererGl ) 78 | -------------------------------------------------------------------------------- /Session3/03-Functional/06 - CollidableShapes/src/CollisionSystem.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // CollisionSystem.cpp 3 | // CollidableShapes 4 | // 5 | // Created by Ryan Bartley on 9/25/14. 6 | // 7 | // 8 | 9 | #include "CollisionSystem.h" 10 | #include "Circle.h" 11 | #include "Square.h" 12 | #include "cinder/Rand.h" 13 | #include "cinder/Log.h" 14 | 15 | using namespace ci; 16 | using namespace ci::app; 17 | 18 | void CollisionSystem::update(){ 19 | 20 | for(auto & shape : mShapes ){ 21 | 22 | for(auto & other_shape : mShapes ){ 23 | 24 | if( shape != other_shape && shape->intersects( Rectf( other_shape->getPosition(), other_shape->getPosition() + other_shape->getSize() )) ){ 25 | 26 | 27 | shape->hit(); 28 | 29 | switch (shape->getType()) { 30 | 31 | case 0: { 32 | if( mCallbacks.count(Square::mId) > 0 ) 33 | mCallbacks[Square::mId](); 34 | } 35 | break; 36 | case 1: { 37 | if( mCallbacks.count(Circle::mId) > 0 ) 38 | mCallbacks[Circle::mId](); 39 | } 40 | break; 41 | default: { 42 | CI_LOG_E("CollisionSystem::Update couldn't find a callback for this type."); 43 | } 44 | break; 45 | } 46 | } 47 | 48 | } 49 | 50 | shape->update(); 51 | } 52 | 53 | } 54 | 55 | void CollisionSystem::checkMouse(const ci::vec2 &mousePos){ 56 | 57 | for( auto & shape : mShapes ){ 58 | if( shape->contains(mousePos) ){ 59 | shape->hit(); 60 | } 61 | } 62 | 63 | } 64 | 65 | 66 | void CollisionSystem::draw(){ 67 | 68 | 69 | for(auto & shape : mShapes )shape->draw(); 70 | 71 | } 72 | 73 | 74 | void CollisionSystem::addShape( const InteractableShapeRef& shape ){ 75 | shape->setVelocity( randVec2() * randFloat( 1, 3 ) ); 76 | mShapes.push_back(shape); 77 | } 78 | void CollisionSystem::addCallback( int type, const Callback& callback ){ mCallbacks.insert(std::make_pair(type,callback)); } 79 | -------------------------------------------------------------------------------- /Session3/03-Functional/06 - CollidableShapes/src/DrawableShape.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // DrawableShape.cpp 3 | // DrawableShapes 4 | // 5 | // Created by Mike Allison on 9/20/14. 6 | // 7 | // 8 | 9 | #include "DrawableShape.h" 10 | #include "cinder/gl/gl.h" 11 | #include "cinder/Rand.h" 12 | 13 | #include 14 | 15 | 16 | using namespace std; 17 | using namespace ci; 18 | 19 | DrawableShape::DrawableShape( const ci::ColorAf &color ) 20 | : mColor( color ) 21 | { 22 | } 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Session3/03-Functional/06 - CollidableShapes/src/Square.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Square.cpp 3 | // Circles 4 | // 5 | // Created by Mike Allison on 9/20/14. 6 | // 7 | // 8 | 9 | #include "Square.h" 10 | 11 | using namespace ci; 12 | using namespace ci::app; 13 | 14 | 15 | Square::Square( const ci::ColorAf &color, const vec2 &position, const vec2 &size ) 16 | : InteractableShape( color, position, size ) 17 | { 18 | } 19 | 20 | const int Square::mId = 0; 21 | 22 | void Square::update(){ 23 | 24 | InteractableShape::update(); 25 | 26 | //square update stuff here 27 | 28 | } 29 | 30 | void Square::draw() 31 | { 32 | gl::color(mColor); 33 | gl::drawSolidRect(Rectf( mPosition, mPosition+mSize )); 34 | 35 | } 36 | 37 | void Square::hit(){ 38 | 39 | InteractableShape::hit(); 40 | 41 | //do something here when it gets hit 42 | 43 | } -------------------------------------------------------------------------------- /Session3/03-Functional/06 - CollidableShapes/vc2013/CollidableShapes.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CollidableShapes", "CollidableShapes.vcxproj", "{1F5BC6CC-43D7-41FB-8911-9763A3DCE3E5}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {1F5BC6CC-43D7-41FB-8911-9763A3DCE3E5}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {1F5BC6CC-43D7-41FB-8911-9763A3DCE3E5}.Debug|Win32.Build.0 = Debug|Win32 14 | {1F5BC6CC-43D7-41FB-8911-9763A3DCE3E5}.Release|Win32.ActiveCfg = Release|Win32 15 | {1F5BC6CC-43D7-41FB-8911-9763A3DCE3E5}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /Session3/03-Functional/06 - CollidableShapes/vc2013/CollidableShapes.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 5 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 6 | 7 | 8 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 9 | h;hpp;hxx;hm;inl;inc;xsd 10 | 11 | 12 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 13 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 14 | 15 | 16 | 17 | 18 | Source Files 19 | 20 | 21 | Source Files 22 | 23 | 24 | Header Files 25 | 26 | 27 | 28 | 29 | Header Files 30 | 31 | 32 | 33 | 34 | Resource Files 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /Session3/03-Functional/06 - CollidableShapes/vc2013/Resources.rc: -------------------------------------------------------------------------------- 1 | #include "../include/Resources.h" 2 | 3 | 1 ICON "..\\resources\\cinder_app_icon.ico" 4 | -------------------------------------------------------------------------------- /Session3/03-Functional/06 - CollidableShapes/xcode/CollidableShapes_Prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | #if defined( __cplusplus ) 6 | #include "cinder/Cinder.h" 7 | 8 | #include "cinder/app/App.h" 9 | 10 | #include "cinder/gl/gl.h" 11 | 12 | #include "cinder/CinderMath.h" 13 | #include "cinder/Matrix.h" 14 | #include "cinder/Vector.h" 15 | #include "cinder/Quaternion.h" 16 | #endif 17 | -------------------------------------------------------------------------------- /Session3/03-Functional/06 - CollidableShapes/xcode/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | CinderApp.icns 11 | CFBundleIdentifier 12 | org.libcinder.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2013 __MyCompanyName__. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /Session3/03-Functional/06 - CollidableShapes/xcode_ios/CollidableShapes_Prefix.pch: -------------------------------------------------------------------------------- 1 | #if defined( __OBJC__ ) 2 | #import 3 | #import 4 | #endif 5 | 6 | #if defined( __cplusplus ) 7 | #include "cinder/Cinder.h" 8 | 9 | #include "cinder/gl/gl.h" 10 | 11 | #include "cinder/CinderMath.h" 12 | #include "cinder/Matrix.h" 13 | #include "cinder/Vector.h" 14 | #include "cinder/Quaternion.h" 15 | #endif -------------------------------------------------------------------------------- /Session3/03-Functional/06 - CollidableShapes/xcode_ios/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session3/03-Functional/06 - CollidableShapes/xcode_ios/Default-568h@2x.png -------------------------------------------------------------------------------- /Session3/03-Functional/06 - CollidableShapes/xcode_ios/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIcons 14 | 15 | CFBundlePrimaryIcon 16 | 17 | CFBundleIconFiles 18 | 19 | 20 | CinderApp_ios.png 21 | 22 | UIPrerenderedIcon 23 | 24 | 25 | 26 | CFBundleIdentifier 27 | org.libcinder.${PRODUCT_NAME:rfc1034identifier} 28 | CFBundleInfoDictionaryVersion 29 | 6.0 30 | CFBundleName 31 | ${PRODUCT_NAME} 32 | CFBundlePackageType 33 | APPL 34 | CFBundleShortVersionString 35 | 1.0 36 | CFBundleSignature 37 | ???? 38 | CFBundleVersion 39 | 1 40 | LSRequiresIPhoneOS 41 | 42 | NSMainNibFile 43 | 44 | NSMainNibFile~ipad 45 | 46 | UISupportedInterfaceOrientations 47 | 48 | UIInterfaceOrientationPortrait 49 | UIInterfaceOrientationLandscapeLeft 50 | UIInterfaceOrientationLandscapeRight 51 | 52 | UISupportedInterfaceOrientations~ipad 53 | 54 | UIInterfaceOrientationPortrait 55 | UIInterfaceOrientationPortraitUpsideDown 56 | UIInterfaceOrientationLandscapeLeft 57 | UIInterfaceOrientationLandscapeRight 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Session3/README.md: -------------------------------------------------------------------------------- 1 | # Session 3 2 | 3 | ## Arrays 4 | Array is something that you'll find in almost every programming language. It allows you to store x amount of same data type elements in a variable. However, you must declare at initialization how many elements can be stored in the array. You don't need to use all of the available places, but you can never change how many slots are in the array. So if you use all the available slots, you have to copy the array into a new, and larger, array. 5 | 6 | Elements in an array are stored in consective memory addresses. You declare an array as `datatype varname[num]`. Here are some examples of that: 7 | 8 | ``` 9 | string names[4]; // this can store up to four string variables 10 | int ages[10]; // this can store ten integers 11 | ``` 12 | 13 | The only time you don't have to declare a size is if you use an initializer list. Here is an example of that: 14 | 15 | ``` 16 | string seasons[] = {"Winter", "Spring", "Summer", "Fall"}; 17 | ``` 18 | 19 | Note, we still use the square brackets which indicates to the program that `seasons` is an array. This also sets the size of the seasons array to 4. 20 | 21 | Arrays are just pointers to where the data is stored. So when you pass an array as an argument it is automatically a call by reference (check the readme for Session 2 if you need a reminder what that is). 22 | 23 | Also remember, to access an element in an array you *must* use an index value (ie seasons[1], names[3], ages[8]). 24 | 25 | ## Pointers 26 | Every piece of data in a program can be found in memory via an address. A pointer is data type consisting of an address to a value in memory. Let's look at some code: 27 | 28 | ``` 29 | int katsAcct = 12345; 30 | int* katsPtr = &katsAcct; 31 | ``` 32 | My first variable is an integer and my second value is a pointer that points to an integer. The * after the data type tells the computer it is a pointer and the & is what tells the computer to find the address of the variable. 33 | 34 | So let's look at the following code: 35 | 36 | ``` 37 | cout << katsPtr << endl; 38 | cout << *katsPtr << endl; 39 | ``` 40 | Our printout will be: 41 | 42 | ``` 43 | 0x23a4f5 44 | 12345 45 | ``` 46 | The first line is a hexadecimal number (you can tell because it starts with 0x) which is the address to where my variable `katsAcct` is stored. The second line is the vairable value. By placing an * before the pointer name, we *dereferenced* the pointer so that it prints out its variable's value. 47 | -------------------------------------------------------------------------------- /Session4/04-Algorithms/PixelSorting/include/Resources.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "cinder/CinderResources.h" 3 | 4 | //#define RES_MY_RES CINDER_RESOURCE( ../resources/, image_name.png, 128, IMAGE ) 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Session4/04-Algorithms/PixelSorting/resources/CinderApp.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session4/04-Algorithms/PixelSorting/resources/CinderApp.icns -------------------------------------------------------------------------------- /Session4/04-Algorithms/PixelSorting/xcode/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | CinderApp.icns 11 | CFBundleIdentifier 12 | org.libcinder.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2013 __MyCompanyName__. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /Session4/04-Algorithms/PixelSorting/xcode/PixelSorting.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Session4/04-Algorithms/PixelSorting/xcode/PixelSorting.xcodeproj/project.xcworkspace/xcuserdata/Craig.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session4/04-Algorithms/PixelSorting/xcode/PixelSorting.xcodeproj/project.xcworkspace/xcuserdata/Craig.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Session4/04-Algorithms/PixelSorting/xcode/PixelSorting.xcodeproj/project.xcworkspace/xcuserdata/Craig.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildLocationStyle 6 | UseTargetSettings 7 | 8 | 9 | -------------------------------------------------------------------------------- /Session4/04-Algorithms/PixelSorting/xcode/PixelSorting.xcodeproj/xcuserdata/Craig.xcuserdatad/xcschemes/PixelSorting.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /Session4/04-Algorithms/PixelSorting/xcode/PixelSorting.xcodeproj/xcuserdata/Craig.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | PixelSorting.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 8D1107260486CEB800E47090 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Session4/04-Algorithms/PixelSorting/xcode/PixelSorting_Prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | #if defined( __cplusplus ) 6 | #include "cinder/Cinder.h" 7 | 8 | #include "cinder/app/App.h" 9 | 10 | #include "cinder/gl/gl.h" 11 | 12 | #include "cinder/CinderMath.h" 13 | #include "cinder/Matrix.h" 14 | #include "cinder/Vector.h" 15 | #include "cinder/Quaternion.h" 16 | #endif 17 | -------------------------------------------------------------------------------- /Session4/04-Algorithms/PixelSorting/xcode/build/PixelSorting.build/Debug/PixelSorting.build/Objects-normal/x86_64/PixelSorting.LinkFileList: -------------------------------------------------------------------------------- 1 | /Users/Craig/Documents/ITP/Residency/FundamentalsOfComputing/Session4/04-Algorithms/PixelSorting/xcode/build/PixelSorting.build/Debug/PixelSorting.build/Objects-normal/x86_64/PixelSortingApp.o 2 | -------------------------------------------------------------------------------- /Session4/04-Algorithms/PixelSorting/xcode/build/PixelSorting.build/Debug/PixelSorting.build/PixelSorting-all-non-framework-target-headers.hmap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session4/04-Algorithms/PixelSorting/xcode/build/PixelSorting.build/Debug/PixelSorting.build/PixelSorting-all-non-framework-target-headers.hmap -------------------------------------------------------------------------------- /Session4/04-Algorithms/PixelSorting/xcode/build/PixelSorting.build/Debug/PixelSorting.build/PixelSorting-all-target-headers.hmap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session4/04-Algorithms/PixelSorting/xcode/build/PixelSorting.build/Debug/PixelSorting.build/PixelSorting-all-target-headers.hmap -------------------------------------------------------------------------------- /Session4/04-Algorithms/PixelSorting/xcode/build/PixelSorting.build/Debug/PixelSorting.build/PixelSorting-generated-files.hmap: -------------------------------------------------------------------------------- 1 | pamhx -------------------------------------------------------------------------------- /Session4/04-Algorithms/PixelSorting/xcode/build/PixelSorting.build/Debug/PixelSorting.build/PixelSorting-own-target-headers.hmap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session4/04-Algorithms/PixelSorting/xcode/build/PixelSorting.build/Debug/PixelSorting.build/PixelSorting-own-target-headers.hmap -------------------------------------------------------------------------------- /Session4/04-Algorithms/PixelSorting/xcode/build/PixelSorting.build/Debug/PixelSorting.build/PixelSorting-project-headers.hmap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session4/04-Algorithms/PixelSorting/xcode/build/PixelSorting.build/Debug/PixelSorting.build/PixelSorting-project-headers.hmap -------------------------------------------------------------------------------- /Session4/04-Algorithms/PixelSorting/xcode/build/PixelSorting.build/Debug/PixelSorting.build/PixelSorting.hmap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session4/04-Algorithms/PixelSorting/xcode/build/PixelSorting.build/Debug/PixelSorting.build/PixelSorting.hmap -------------------------------------------------------------------------------- /Session4/04-Algorithms/PixelSorting/xcode/build/PixelSorting.build/Debug/PixelSorting.build/dgph: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session4/04-Algorithms/PixelSorting/xcode/build/PixelSorting.build/Debug/PixelSorting.build/dgph -------------------------------------------------------------------------------- /Session4/04-Algorithms/PixelSorting/xcode/build/PixelSorting.build/Debug/PixelSorting.build/dgph~: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Craigson/FundamentalsOfComputing/6ac3fdd71e78121461a9e99e3da9bafcb96ac10e/Session4/04-Algorithms/PixelSorting/xcode/build/PixelSorting.build/Debug/PixelSorting.build/dgph~ -------------------------------------------------------------------------------- /Session4/README.md: -------------------------------------------------------------------------------- 1 | # Session 4 2 | 3 | ## Structured Data 4 | In C++ you have access to something called *Abstract Data Types*, or ADT. ADT group together multiple primitive data types, and are created by the programmer. This may sound similar to a class, but they are different because ADT does not include any function definitions. 5 | 6 | A structured data type can contain other struct data types or arrays. To access the data properities of a struct data array you use dot notation. Also, you can initialize a structure when you create it. 7 | 8 | **Clarification: ADT is the logical description of this concept and structured data type is the actual implemenation of it. 9 | 10 | Let's look at an example: 11 | 12 | ``` 13 | struct Address { 14 | char city[30]; 15 | char state[3]; 16 | int zipcode; 17 | }; 18 | 19 | struct DateOfBirth { 20 | int month; 21 | int date; 22 | int year; 23 | } 24 | 25 | struct Employee { 26 | char name[60]; 27 | double hourlyWage; 28 | Address address; 29 | DateOfBirth dob; 30 | } 31 | 32 | int numEmployees; 33 | cout<<"How many employees do you have? \t"; 34 | cin>>numEmployees; 35 | // create an array of type Employee 36 | Employee employees[numEmployees]; 37 | 38 | for(int i=0; i>employees[i].name; 41 | cout<<"Please enter their city \t"; 42 | cin>>employees[i].address.city; 43 | cout<<"Please enter their month of birth \t"; 44 | cin>>employees[i].dob.month; 45 | } 46 | ``` 47 | 48 | ## Vectors 49 | 50 | A big downside to arrays is that they are a fixed size and once you initalize them, you can never change their size. So C++ offers the data type *vector*. It's similar to an array, but their size is dynamic, meaning we can change its size throughout the program. This is very similar to Java's ArrayList. But just like arrays, vector can only store data of the same data type. 51 | 52 | Here are some ways you can declare a vector: 53 | 54 | ``` 55 | // initialized as an empty list of ints 56 | vector nums; 57 | 58 | // nums2 contains 10 integer values 59 | vector nums2(10); 60 | 61 | // prices contains 5 double values that are all set to 0.0 62 | vector prices(5, 0.0); 63 | ``` 64 | 65 | To add elements to a vector we use the function *push_back* 66 | 67 | ``` 68 | for(int i=0; i<10; i++){ 69 | nums2.push_back(i); 70 | } 71 | ``` 72 | 73 | Now nums is a vector containing 0,1,2,3,4,5,6,7,8,9. 74 | 75 | If you already initialized a vector with a certain size (that can be changed later in the program) you can use [] to access certain indices. 76 | 77 | ``` 78 | for(int i=0; i mAveragedColors; 26 | std::vector mThresholdValues; 27 | 28 | int threshold; 29 | 30 | Color8u getAverage(Surface* _surface, vec2 _ULvertex); 31 | int getValue(Surface* _surface, vec2 _ULvertex); 32 | }; 33 | 34 | void PixelMirrorApp::setup() 35 | { 36 | threshold = 128; 37 | 38 | try { 39 | mCapture = Capture::create(640,480); 40 | mCapture->start(); 41 | } catch (CaptureExc &exc) { 42 | CI_LOG_EXCEPTION("failed to init camera", exc); 43 | } 44 | 45 | numX = mCapture->getWidth() / PIXEL_SIZE; 46 | numY = mCapture->getHeight() / PIXEL_SIZE; 47 | } 48 | 49 | void PixelMirrorApp::mouseDown( MouseEvent event ) 50 | { 51 | } 52 | 53 | void PixelMirrorApp::update() 54 | { 55 | if (mCapture && mCapture->checkNewFrame()){ 56 | 57 | mAveragedColors.clear(); 58 | 59 | auto mPixels = *mCapture->getSurface(); 60 | 61 | for (int i = 0; i < mPixels.getWidth(); i += PIXEL_SIZE){ 62 | for (int j = 0; j < mPixels.getHeight(); j += PIXEL_SIZE){ 63 | 64 | Color8u tempColor = getAverage(&mPixels, vec2(i,j)); 65 | 66 | mAveragedColors.push_back(tempColor); 67 | } 68 | } 69 | 70 | } 71 | } 72 | 73 | void PixelMirrorApp::draw() 74 | { 75 | gl::clear( Color( 0, 0, 0 ) ); 76 | 77 | if (mAveragedColors.size() > 0){ 78 | 79 | int index = 0; 80 | 81 | for (int i = 0; i < getWindowWidth(); i += PIXEL_SIZE){ 82 | 83 | for (int j = 0; j < getWindowHeight(); j += PIXEL_SIZE){ 84 | 85 | gl::color(Color8u(mAveragedColors[index])); 86 | 87 | Rectf rect = Rectf (vec2(i,j), vec2(i+PIXEL_SIZE, j + PIXEL_SIZE)); 88 | 89 | gl::drawSolidRect(rect); 90 | 91 | index++; 92 | 93 | } 94 | } 95 | 96 | 97 | 98 | } 99 | } 100 | 101 | Color8u PixelMirrorApp::getAverage(Surface* _surface, vec2 _ULvertex) 102 | { 103 | 104 | Area area = Area(_ULvertex.x, _ULvertex.y, _ULvertex.x + PIXEL_SIZE, _ULvertex.y + PIXEL_SIZE); 105 | 106 | int32_t sumR, sumG, sumB; 107 | 108 | sumR = 0; 109 | sumG = 0; 110 | sumB = 0; 111 | 112 | int counter = 0; 113 | 114 | Surface::Iter iter = _surface->getIter(area); 115 | 116 | while (iter.line() ) { 117 | while (iter.pixel() ) { 118 | 119 | sumR += (int) iter.r(); 120 | sumG += (int) iter.g(); 121 | sumB += (int) iter.b(); 122 | 123 | counter++; 124 | } 125 | } 126 | 127 | return Color8u( sumG/counter, sumR/counter, sumB/counter); 128 | 129 | } 130 | 131 | CINDER_APP( PixelMirrorApp, RendererGl ) 132 | 133 | --------------------------------------------------------------------------------