Browse Source

created simpler example

master
Theodoros Papatheodorou 8 years ago
parent
commit
96ef55afbd
  1. 1
      example/bin/.gitignore
  2. 28
      example/bin/data/ofxpimapper.xml
  3. 64
      example/example.qbs
  4. 5
      example_simpler/.gitignore
  5. 13
      example_simpler/Makefile
  6. 3
      example_simpler/addons.make
  7. 0
      example_simpler/bin/data/.gitkeep
  8. BIN
      example_simpler/bin/data/dummy-objects.png
  9. 81
      example_simpler/bin/data/ofxpimapper.xml
  10. BIN
      example_simpler/bin/data/sources/images/blending.png
  11. BIN
      example_simpler/bin/data/sources/images/image2.jpg
  12. BIN
      example_simpler/bin/data/sources/images/image4.jpg
  13. BIN
      example_simpler/bin/data/sources/videos/control-panel-and-operation.mp4
  14. 62
      example_simpler/example_simpler.qbs
  15. 245
      example_simpler/example_simpler.qbs.user
  16. 41
      example_simpler/src/CustomSource.cpp
  17. 14
      example_simpler/src/CustomSource.h
  18. 22
      example_simpler/src/Settings.cpp
  19. 18
      example_simpler/src/Settings.h
  20. 22
      example_simpler/src/main.cpp
  21. 55
      example_simpler/src/ofApp.cpp
  22. 28
      example_simpler/src/ofApp.h

1
example/bin/.gitignore

@ -3,5 +3,6 @@ data/*.jpg
data/settings.xml
data/surfaces.xml
example
example_debug
libs
readMe.txt

28
example/bin/data/ofxpimapper.xml

@ -2,16 +2,16 @@
<surface type="0">
<vertices>
<vertex>
<x>250.000000000</x>
<y>138.187255859</y>
<x>194.000000000</x>
<y>57.187255859</y>
</vertex>
<vertex>
<x>403.625549316</x>
<y>291.812774658</y>
<x>467.000000000</x>
<y>412.000000000</y>
</vertex>
<vertex>
<x>96.374511719</x>
<y>291.812774658</y>
<x>40.374511719</x>
<y>210.812774658</y>
</vertex>
</vertices>
<texCoords>
@ -36,20 +36,20 @@
<surface type="1">
<vertices>
<vertex>
<x>425.565002441</x>
<y>144.782531738</y>
<x>407.565002441</x>
<y>111.782531738</y>
</vertex>
<vertex>
<x>718.434936523</x>
<y>144.782531738</y>
<x>700.434936523</x>
<y>111.782531738</y>
</vertex>
<vertex>
<x>718.434936523</x>
<y>291.217407227</y>
<x>700.434936523</x>
<y>258.217407227</y>
</vertex>
<vertex>
<x>425.565002441</x>
<y>291.217407227</y>
<x>407.565002441</x>
<y>258.217407227</y>
</vertex>
</vertices>
<texCoords>

64
example/example.qbs

@ -0,0 +1,64 @@
import qbs
import qbs.Process
import qbs.File
import qbs.FileInfo
import qbs.TextFile
import "../../../libs/openFrameworksCompiled/project/qtcreator/ofApp.qbs" as ofApp
Project{
property string of_root: "../../.."
ofApp {
name: { return FileInfo.baseName(path) }
files: [
"src/CrossSource.cpp",
"src/CrossSource.h",
"src/CustomSource.cpp",
"src/CustomSource.h",
"src/Settings.cpp",
"src/Settings.h",
'src/main.cpp',
'src/ofApp.cpp',
'src/ofApp.h',
]
of.addons: [
'ofxGui',
'ofxPiMapper',
'ofxXmlSettings',
]
// additional flags for the project. the of module sets some
// flags by default to add the core libraries, search paths...
// this flags can be augmented through the following properties:
of.pkgConfigs: [] // list of additional system pkgs to include
of.includePaths: [] // include search paths
of.cFlags: [] // flags passed to the c compiler
of.cxxFlags: [] // flags passed to the c++ compiler
of.linkerFlags: [] // flags passed to the linker
of.defines: [] // defines are passed as -D to the compiler
// and can be checked with #ifdef or #if in the code
// other flags can be set through the cpp module: http://doc.qt.io/qbs/cpp-module.html
// eg: this will enable ccache when compiling
//
// cpp.compilerWrapper: 'ccache'
Depends{
name: "cpp"
}
// common rules that parse the include search paths, core libraries...
Depends{
name: "of"
}
// dependency with the OF library
Depends{
name: "openFrameworks"
}
}
references: [FileInfo.joinPaths(of_root, "/libs/openFrameworksCompiled/project/qtcreator/openFrameworks.qbs")]
}

5
example_simpler/.gitignore

@ -0,0 +1,5 @@
obj
*.xcworkspace
*.xcuserdatad
*~
config.make

13
example_simpler/Makefile

@ -0,0 +1,13 @@
# Attempt to load a config.make file.
# If none is found, project defaults in config.project.make will be used.
ifneq ($(wildcard config.make),)
include config.make
endif
# make sure the the OF_ROOT location is defined
ifndef OF_ROOT
OF_ROOT=$(realpath ../../..)
endif
# call the project makefile!
include $(OF_ROOT)/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk

3
example_simpler/addons.make

@ -0,0 +1,3 @@
ofxGui
ofxPiMapper
ofxXmlSettings

0
example_simpler/bin/data/.gitkeep

BIN
example_simpler/bin/data/dummy-objects.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

81
example_simpler/bin/data/ofxpimapper.xml

@ -0,0 +1,81 @@
<surfaces>
<surface type="0">
<vertices>
<vertex>
<x>193.000000000</x>
<y>58.187255859</y>
</vertex>
<vertex>
<x>466.000000000</x>
<y>413.000000000</y>
</vertex>
<vertex>
<x>39.374511719</x>
<y>211.812774658</y>
</vertex>
</vertices>
<texCoords>
<texCoord>
<x>-0.006000000</x>
<y>-0.014000000</y>
</texCoord>
<texCoord>
<x>1.000000000</x>
<y>1.000000000</y>
</texCoord>
<texCoord>
<x>0.000000000</x>
<y>1.000000000</y>
</texCoord>
</texCoords>
<source>
<source-type>image</source-type>
<source-name>image4.jpg</source-name>
</source>
</surface>
<surface type="1">
<vertices>
<vertex>
<x>758.067382812</x>
<y>360.033691406</y>
</vertex>
<vertex>
<x>1125.932617188</x>
<y>360.033691406</y>
</vertex>
<vertex>
<x>1129.000000000</x>
<y>719.000000000</y>
</vertex>
<vertex>
<x>759.000000000</x>
<y>721.000000000</y>
</vertex>
</vertices>
<texCoords>
<texCoord>
<x>0.000000000</x>
<y>0.000000000</y>
</texCoord>
<texCoord>
<x>1.000000000</x>
<y>0.000000000</y>
</texCoord>
<texCoord>
<x>1.000000000</x>
<y>1.000000000</y>
</texCoord>
<texCoord>
<x>0.000000000</x>
<y>1.000000000</y>
</texCoord>
</texCoords>
<source>
<source-type>fbo</source-type>
<source-name>Custom FBO Source</source-name>
</source>
<properties>
<perspectiveWarping>1</perspectiveWarping>
</properties>
</surface>
</surfaces>

BIN
example_simpler/bin/data/sources/images/blending.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

BIN
example_simpler/bin/data/sources/images/image2.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 KiB

BIN
example_simpler/bin/data/sources/images/image4.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

BIN
example_simpler/bin/data/sources/videos/control-panel-and-operation.mp4

Binary file not shown.

62
example_simpler/example_simpler.qbs

@ -0,0 +1,62 @@
import qbs
import qbs.Process
import qbs.File
import qbs.FileInfo
import qbs.TextFile
import "../../../libs/openFrameworksCompiled/project/qtcreator/ofApp.qbs" as ofApp
Project{
property string of_root: "../../.."
ofApp {
name: { return FileInfo.baseName(path) }
files: [
"src/CustomSource.cpp",
"src/CustomSource.h",
"src/Settings.cpp",
"src/Settings.h",
"src/main.cpp",
"src/ofApp.cpp",
"src/ofApp.h",
]
of.addons: [
'ofxGui',
'ofxPiMapper',
'ofxXmlSettings',
]
// additional flags for the project. the of module sets some
// flags by default to add the core libraries, search paths...
// this flags can be augmented through the following properties:
of.pkgConfigs: [] // list of additional system pkgs to include
of.includePaths: [] // include search paths
of.cFlags: [] // flags passed to the c compiler
of.cxxFlags: [] // flags passed to the c++ compiler
of.linkerFlags: [] // flags passed to the linker
of.defines: [] // defines are passed as -D to the compiler
// and can be checked with #ifdef or #if in the code
// other flags can be set through the cpp module: http://doc.qt.io/qbs/cpp-module.html
// eg: this will enable ccache when compiling
//
// cpp.compilerWrapper: 'ccache'
Depends{
name: "cpp"
}
// common rules that parse the include search paths, core libraries...
Depends{
name: "of"
}
// dependency with the OF library
Depends{
name: "openFrameworks"
}
}
references: [FileInfo.joinPaths(of_root, "/libs/openFrameworksCompiled/project/qtcreator/openFrameworks.qbs")]
}

245
example_simpler/example_simpler.qbs.user

@ -0,0 +1,245 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.1.0, 2017-11-19T01:04:03. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{8be5f52a-5735-4165-a4b3-4f0f5d90a15e}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap"/>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{a4d26ffb-0245-4d65-8e2f-7d8767bb05ec}</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/theodoros/bin/of_v0.9.8_linux64_release/addons/ofxPiMapper/build-example_simpler-Desktop-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Qbs Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qbs.BuildStep</value>
<value type="bool" key="Qbs.CleanInstallRoot">false</value>
<valuemap type="QVariantMap" key="Qbs.Configuration">
<value type="QString" key="qbs.buildVariant">debug</value>
<value type="QString" key="qbs.profile">qtc_Desktop_1976aced</value>
</valuemap>
<value type="bool" key="Qbs.DryKeepGoing">false</value>
<value type="bool" key="Qbs.DryRun">false</value>
<value type="bool" key="Qbs.Install">true</value>
<value type="int" key="Qbs.MaxJobs">8</value>
<value type="bool" key="Qbs.ShowCommandLines">false</value>
<value type="bool" key="Qbs.forceProbesKey">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Qbs Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qbs.CleanStep</value>
<value type="bool" key="Qbs.DryKeepGoing">false</value>
<value type="bool" key="Qbs.DryRun">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qbs.QbsBuildConfiguration</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/theodoros/bin/of_v0.9.8_linux64_release/addons/ofxPiMapper/build-example_simpler-Desktop-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Qbs Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qbs.BuildStep</value>
<value type="bool" key="Qbs.CleanInstallRoot">false</value>
<valuemap type="QVariantMap" key="Qbs.Configuration">
<value type="QString" key="qbs.buildVariant">release</value>
<value type="QString" key="qbs.profile">qtc_Desktop_1976aced</value>
</valuemap>
<value type="bool" key="Qbs.DryKeepGoing">false</value>
<value type="bool" key="Qbs.DryRun">false</value>
<value type="bool" key="Qbs.Install">true</value>
<value type="int" key="Qbs.MaxJobs">0</value>
<value type="bool" key="Qbs.ShowCommandLines">false</value>
<value type="bool" key="Qbs.forceProbesKey">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Qbs Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qbs.CleanStep</value>
<value type="bool" key="Qbs.DryKeepGoing">false</value>
<value type="bool" key="Qbs.DryRun">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qbs.QbsBuildConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Qbs Install</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qbs.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">example_simpler</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qbs.RunConfiguration:example_simpler.qtc_Desktop_1976aced---Qbs.RC.NameSeparator---example_simpler</value>
<value type="QString" key="Qbs.RunConfiguration.CommandLineArguments"></value>
<value type="QString" key="Qbs.RunConfiguration.WorkingDirectory"></value>
<value type="QString" key="Qbs.RunConfiguration.WorkingDirectory.default">/home/theodoros/bin/of_v0.9.8_linux64_release/addons/ofxPiMapper/example_simpler/bin</value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">18</value>
</data>
<data>
<variable>Version</variable>
<value type="int">18</value>
</data>
</qtcreator>

41
example_simpler/src/CustomSource.cpp

@ -0,0 +1,41 @@
#include "CustomSource.h"
void CustomSource::setup(){
// Give our source a decent name
name = "Custom FBO Source";
// Allocate our FBO source, decide how big it should be
allocate(500, 500);
// Genereate rects to be rendered into the FBO
int numRects = 20; // change this to add more or less rects
for(int i = 0; i < numRects; i++){
rects.push_back(ofRectangle(0,
ofRandom(fbo->getHeight()),
fbo->getWidth(),
ofRandom(20)));
rectSpeeds.push_back((1.0f + ofRandom(5)));
}
}
// Don't do any drawing here
void CustomSource::update(){
// Move rects
for(int i = 0; i < rects.size(); i++){
rects[i].y += rectSpeeds[i];
if(rects[i].y > fbo->getHeight()){
rects[i].y = -rects[i].getHeight();
}
}
}
// No need to take care of fbo.begin() and fbo.end() here.
// All within draw() is being rendered into fbo;
void CustomSource::draw(){
// Fill FBO with our rects
ofClear(0);
ofSetColor(255);
for(int i = 0; i < rects.size(); i++){
ofDrawRectangle(rects[i]);
}
}

14
example_simpler/src/CustomSource.h

@ -0,0 +1,14 @@
#pragma once
#include "ofMain.h"
#include "FboSource.h"
class CustomSource : public ofx::piMapper::FboSource {
public:
void setup();
void update();
void draw();
vector <ofRectangle> rects;
vector <float> rectSpeeds;
};

22
example_simpler/src/Settings.cpp

@ -0,0 +1,22 @@
#include "Settings.h"
Settings * Settings::_instance = 0;
Settings * Settings::instance(){
if(_instance == 0){
_instance = new Settings();
}
return _instance;
}
Settings::Settings(){
_fullscreen = false;
}
void Settings::setFullscreen(bool f){
_fullscreen = f;
}
bool Settings::getFullscreen(){
return _fullscreen;
}

18
example_simpler/src/Settings.h

@ -0,0 +1,18 @@
#pragma once
#include "ofMain.h"
class Settings {
public:
static Settings * instance();
void setFullscreen(bool f);
bool getFullscreen();
private:
static Settings * _instance;
Settings();
bool _fullscreen;
};

22
example_simpler/src/main.cpp

@ -0,0 +1,22 @@
#include "ofMain.h"
#include "ofApp.h"
#include <string>
#include <vector>
#include "Settings.h"
int main(int argc, char * argv[]){
bool fullscreen = false;
vector<string> arguments = vector<string>(argv, argv + argc);
for(int i = 0; i < arguments.size(); ++i){
if(arguments.at(i) == "-f"){
fullscreen = true;
break;
}
}
Settings::instance()->setFullscreen(fullscreen);
ofSetupOpenGL(800, 450, OF_WINDOW);
ofRunApp(new ofApp());
}

55
example_simpler/src/ofApp.cpp

@ -0,0 +1,55 @@
#include "ofApp.h"
void ofApp::setup(){
ofBackground(0);
// Enable or disable audio for video sources globally
// Set this to false to save resources on the Raspberry Pi
ofx::piMapper::VideoSource::enableAudio = true;
ofx::piMapper::VideoSource::useHDMIForAudio = false;
// Add our CustomSource to list of fbo sources of the piMapper
// FBO sources should be added before piMapper.setup() so the
// piMapper is able to load the source if it is assigned to
// a surface in XML settings.
customSource = new CustomSource();
piMapper.registerFboSource(customSource);
piMapper.setup();
// The info layer is hidden by default, press <i> to toggle
// piMapper.showInfo();
ofSetFullscreen(Settings::instance()->getFullscreen());
ofSetEscapeQuitsApp(false);
dummyObjects.load("dummy-objects.png");
}
void ofApp::update(){
piMapper.update();
}
void ofApp::draw(){
dummyObjects.draw(200,200);
piMapper.draw();
}
void ofApp::keyPressed(int key){
piMapper.keyPressed(key);
}
void ofApp::keyReleased(int key){
piMapper.keyReleased(key);
}
void ofApp::mousePressed(int x, int y, int button){
piMapper.mousePressed(x, y, button);
}
void ofApp::mouseReleased(int x, int y, int button){
piMapper.mouseReleased(x, y, button);
}
void ofApp::mouseDragged(int x, int y, int button){
piMapper.mouseDragged(x, y, button);
}

28
example_simpler/src/ofApp.h

@ -0,0 +1,28 @@
#pragma once
#include "ofMain.h"
#include "Settings.h"
#include "ofxPiMapper.h"
#include "CustomSource.h"
#include "VideoSource.h"
class ofApp : public ofBaseApp {
public:
void setup();
void update();
void draw();
void keyPressed(int key);
void keyReleased(int key);
void mousePressed(int x, int y, int button);
void mouseReleased(int x, int y, int button);
void mouseDragged(int x, int y, int button);
ofxPiMapper piMapper;
// By using a custom source that is derived from FboSource
// you will be able to see the source listed in sources editor
CustomSource * customSource;
ofImage dummyObjects;
};
Loading…
Cancel
Save