mirror of
https://github.com/sojamo/controlp5
synced 2024-11-24 14:47:56 +01:00
moving repository from google code to github.
This commit is contained in:
commit
e3a05cb1bc
7
.buildpath
Normal file
7
.buildpath
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<buildpath>
|
||||||
|
<buildpathentry kind="src" path="src"/>
|
||||||
|
<buildpathentry kind="con" path="org.eclipse.dltk.mod.launching.INTERPRETER_CONTAINER"/>
|
||||||
|
<buildpathentry kind="con" path="org.eclipse.vjet.eclipse.core.JSNATIVE_CONTAINER/JS Native Types"/>
|
||||||
|
<buildpathentry kind="con" path="org.eclipse.vjet.eclipse.core.BROWSER_CONTAINER/Browser SDK"/>
|
||||||
|
</buildpath>
|
7
.classpath
Normal file
7
.classpath
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="src" path="src"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||||
|
<classpathentry kind="lib" path="/Users/andreasschlegel/Documents/workspace/libs/core.jar"/>
|
||||||
|
<classpathentry kind="output" path="bin"/>
|
||||||
|
</classpath>
|
7
.externalToolBuilders/cp5-build.launch
Normal file
7
.externalToolBuilders/cp5-build.launch
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType">
|
||||||
|
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
|
||||||
|
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/controlp5/resources/jar.sh}"/>
|
||||||
|
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,auto,"/>
|
||||||
|
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
|
||||||
|
</launchConfiguration>
|
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
/bin/
|
||||||
|
/distribution/src/
|
||||||
|
/distribution/tmp/
|
||||||
|
/distribution/web/
|
||||||
|
/src-js/
|
||||||
|
.svn/
|
33
.project
Normal file
33
.project
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>controlp5</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.vjet.eclipse.core.builder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
|
||||||
|
<triggers>auto,full,incremental,</triggers>
|
||||||
|
<arguments>
|
||||||
|
<dictionary>
|
||||||
|
<key>LaunchConfigHandle</key>
|
||||||
|
<value><project>/.externalToolBuilders/cp5-build.launch</value>
|
||||||
|
</dictionary>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.vjet.core.nature</nature>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
291
.settings/org.eclipse.jdt.core.prefs
Normal file
291
.settings/org.eclipse.jdt.core.prefs
Normal file
@ -0,0 +1,291 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||||
|
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||||
|
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||||
|
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||||
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.6
|
||||||
|
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_field=0
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_method=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_package=0
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
|
||||||
|
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
|
||||||
|
org.eclipse.jdt.core.formatter.comment.format_block_comments=true
|
||||||
|
org.eclipse.jdt.core.formatter.comment.format_header=true
|
||||||
|
org.eclipse.jdt.core.formatter.comment.format_html=true
|
||||||
|
org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
|
||||||
|
org.eclipse.jdt.core.formatter.comment.format_line_comments=false
|
||||||
|
org.eclipse.jdt.core.formatter.comment.format_source_code=true
|
||||||
|
org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
|
||||||
|
org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
|
||||||
|
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
|
||||||
|
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
|
||||||
|
org.eclipse.jdt.core.formatter.comment.line_length=140
|
||||||
|
org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=false
|
||||||
|
org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
|
||||||
|
org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=true
|
||||||
|
org.eclipse.jdt.core.formatter.compact_else_if=true
|
||||||
|
org.eclipse.jdt.core.formatter.continuation_indentation=2
|
||||||
|
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
|
||||||
|
org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
|
||||||
|
org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
|
||||||
|
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_empty_lines=false
|
||||||
|
org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
|
||||||
|
org.eclipse.jdt.core.formatter.indentation.size=4
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=insert
|
||||||
|
org.eclipse.jdt.core.formatter.join_lines_in_comments=false
|
||||||
|
org.eclipse.jdt.core.formatter.join_wrapped_lines=true
|
||||||
|
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.lineSplit=250
|
||||||
|
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
|
||||||
|
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
|
||||||
|
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
|
||||||
|
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
|
||||||
|
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
|
||||||
|
org.eclipse.jdt.core.formatter.tabulation.char=tab
|
||||||
|
org.eclipse.jdt.core.formatter.tabulation.size=2
|
||||||
|
org.eclipse.jdt.core.formatter.use_on_off_tags=false
|
||||||
|
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true
|
||||||
|
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
|
||||||
|
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
|
||||||
|
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
|
3
.settings/org.eclipse.jdt.ui.prefs
Normal file
3
.settings/org.eclipse.jdt.ui.prefs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
formatter_profile=_sojamo
|
||||||
|
formatter_settings_version=12
|
2
.settings/org.eclipse.vjet.eclipse.core.prefs
Normal file
2
.settings/org.eclipse.vjet.eclipse.core.prefs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
initialized_project_from_v4classpath=true
|
67
README.md
Normal file
67
README.md
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
# ControlP5
|
||||||
|
|
||||||
|
ControlP5 is a library written by Andreas Schlegel for the programming environment [processing](http://www.processing.org). ControlP5 is a GUI and controller library for processing that can be used in authoring, application mode.
|
||||||
|
|
||||||
|
The range of available controllers includes Slider, Button, Toggle, Knob, Textfield, RadioButton, Checkbox, Lists amongst others. These controllers can be easily added to a processing sketch, or displayed inside a separate control window. They can be organized in tabs or groups as well as rendered into PGraphics buffers. The state of a controller can be saved to file in JSON format.
|
||||||
|
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
To get started, a simple example that will create a slider and automatically link its value to variable v1.
|
||||||
|
|
||||||
|
```java
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
int v1;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400,400);
|
||||||
|
noStroke();
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
cp5.addSlider("v1")
|
||||||
|
.setPosition(40,40)
|
||||||
|
.setSize(200,20)
|
||||||
|
.setRange(100,300)
|
||||||
|
.setValue(250)
|
||||||
|
.setColorCaptionLabel(0xff111111);
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(0xffdddddd);
|
||||||
|
pushMatrix();
|
||||||
|
fill(0xffffdc00);
|
||||||
|
rect(v1,100,60,200);
|
||||||
|
fill(0xff01ff70);
|
||||||
|
rect(40,v1,320,40);
|
||||||
|
translate(200,200);
|
||||||
|
rotate(map(v1,100,300,-PI,PI));
|
||||||
|
fill(0xff39cccc);
|
||||||
|
rect(0,0,100,100);
|
||||||
|
popMatrix();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## History
|
||||||
|
|
||||||
|
ControlP5 is a project that started in 2006 as a very simple UI for controlling Processing parameters for better debugging, testing and interaction purposes. Starting from only 3 controllers its controller base has grown up to around 30 controllers and over 70 examples. A history of controlP5 versions is available at [google code downloads](https://code.google.com/p/controlp5/downloads/list?can=1&q=&colspec=Filename+Summary+Uploaded+ReleaseDate+Size+DownloadCount). This library has been widely used by processing user in academic, research and professional environments for prototyping and tool development.
|
||||||
|
|
||||||
|
|
||||||
|
### Why is controlP5's source code so convoluted and bloated
|
||||||
|
|
||||||
|
ControlP5 has been in development for over 9 years and started as a small GUI library for Processing. Over the years both Processing and ControlP5 have grown substantially and as part of that journey many changes have been applied to both. From a ControlP5 perspective some changes were due to changes made to Processing's API and source code, other changes were due to additional controller implementations, extended functionality, user feedback and reuqests. Since writing controlP5 from scratch was a learning process for myself in itself, a proper initial strategy for the software architecture of the library was missing. When it became apparent that a proper architecture would have made the development much easier and comfortable it was already too late, I had to comply to the piles of code I had created. Would I do things differently now? yes I would.
|
||||||
|
|
||||||
|
|
||||||
|
## Font rendering
|
||||||
|
|
||||||
|
Why is the bit-font so blurry? it used to be crisp. Let me blame this on the OpenGL texture rendering. If you have a suggestion or a simple and easy to implement solution, please let me know inside the issues section.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Javascript
|
||||||
|
|
||||||
|
Currently there is no javascript version of ControlP5, though I had started implementing a slimmed down version for processing.js but since it is currently unclear which javascript version - processing.js or p5.js - will become the default js version of processing, controlP5.js is on hold. There is a tendency that p5.js will become the primary javascript environment
|
||||||
|
|
BIN
distribution/library/controlP5.jar
Normal file
BIN
distribution/library/controlP5.jar
Normal file
Binary file not shown.
1159
distribution/library/controlP5.js
Normal file
1159
distribution/library/controlP5.js
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,44 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 ButtonBar
|
||||||
|
*
|
||||||
|
* work-in-progress
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400, 400);
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
ButtonBar b = cp5.addButtonBar("bar")
|
||||||
|
.setPosition(0, 0)
|
||||||
|
.setSize(400, 20)
|
||||||
|
.addItems(split("a b c d e f g h i j"," "))
|
||||||
|
;
|
||||||
|
println(b.getItem("a"));
|
||||||
|
b.changeItem("a","text","first");
|
||||||
|
b.changeItem("b","text","second");
|
||||||
|
b.changeItem("c","text","third");
|
||||||
|
b.onMove(new CallbackListener(){
|
||||||
|
public void controlEvent(CallbackEvent ev) {
|
||||||
|
ButtonBar bar = (ButtonBar)ev.getController();
|
||||||
|
println("hello ",bar.hover());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void bar(int n) {
|
||||||
|
println("bar clicked, item-value:", n);
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(220);
|
||||||
|
}
|
||||||
|
|
175
examples/controllers/ControlP5ColorWheel/ControlP5ColorWheel.pde
Normal file
175
examples/controllers/ControlP5ColorWheel/ControlP5ColorWheel.pde
Normal file
@ -0,0 +1,175 @@
|
|||||||
|
/**
|
||||||
|
* ColorWheel is working but still under development as of 22.April 2014.
|
||||||
|
* for API see source code of controlP5/ColorWheel.java
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(500, 500);
|
||||||
|
cp5 = new ControlP5( this );
|
||||||
|
cp5.printPublicMethodsFor(ColorWheel.class);
|
||||||
|
cp5.addColorWheel("c" , 250 , 10 , 200 ).setRGB(color(128,0,255));
|
||||||
|
noStroke();
|
||||||
|
}
|
||||||
|
|
||||||
|
int c = color(100);
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(50);
|
||||||
|
fill( c );
|
||||||
|
rect(0,240,width,200);
|
||||||
|
println(cp5.get(ColorWheel.class,"c").getRGB());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ControlP5 ColorWheel
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* find a list of public methods available for the ColorWheel Controller
|
||||||
|
* at the bottom of this sketch.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
a list of all methods available for the ColorWheel Controller
|
||||||
|
use ControlP5.printPublicMethodsFor(ColorWheel.class);
|
||||||
|
to print the following list into the console.
|
||||||
|
|
||||||
|
You can find further details about class ColorWheel in the javadoc.
|
||||||
|
|
||||||
|
Format:
|
||||||
|
ClassName : returnType methodName(parameter type)
|
||||||
|
|
||||||
|
controlP5.ColorWheel : ColorWheel setAlpha(int)
|
||||||
|
controlP5.ColorWheel : ColorWheel setHSL(double, double, double)
|
||||||
|
controlP5.ColorWheel : ColorWheel setRGB(int)
|
||||||
|
controlP5.ColorWheel : double[] RGBtoHSL(int)
|
||||||
|
controlP5.ColorWheel : double[] RGBtoHSL(int, int, int)
|
||||||
|
controlP5.ColorWheel : int HSLtoRGB(double, double, double)
|
||||||
|
controlP5.ColorWheel : int HSLtoRGB(double[])
|
||||||
|
controlP5.ColorWheel : int HSVtoRGB(double, double, double)
|
||||||
|
controlP5.ColorWheel : int HSVtoRGB(double[])
|
||||||
|
controlP5.ColorWheel : int a()
|
||||||
|
controlP5.ColorWheel : int b()
|
||||||
|
controlP5.ColorWheel : int g()
|
||||||
|
controlP5.ColorWheel : int r()
|
||||||
|
controlP5.ColorWheel : int getRGB()
|
||||||
|
controlP5.ColorWheel : void setHue(double)
|
||||||
|
controlP5.ColorWheel : void setLightness(double)
|
||||||
|
controlP5.ColorWheel : void setSaturation(double)
|
||||||
|
controlP5.Controller : CColor getColor()
|
||||||
|
controlP5.Controller : ColorWheel addCallback(CallbackListener)
|
||||||
|
controlP5.Controller : ColorWheel addListener(ControlListener)
|
||||||
|
controlP5.Controller : ColorWheel align(int, int, int, int)
|
||||||
|
controlP5.Controller : ColorWheel bringToFront()
|
||||||
|
controlP5.Controller : ColorWheel bringToFront(ControllerInterface)
|
||||||
|
controlP5.Controller : ColorWheel hide()
|
||||||
|
controlP5.Controller : ColorWheel linebreak()
|
||||||
|
controlP5.Controller : ColorWheel listen(boolean)
|
||||||
|
controlP5.Controller : ColorWheel lock()
|
||||||
|
controlP5.Controller : ColorWheel plugTo(Object)
|
||||||
|
controlP5.Controller : ColorWheel plugTo(Object, String)
|
||||||
|
controlP5.Controller : ColorWheel plugTo(Object[])
|
||||||
|
controlP5.Controller : ColorWheel plugTo(Object[], String)
|
||||||
|
controlP5.Controller : ColorWheel registerProperty(String)
|
||||||
|
controlP5.Controller : ColorWheel registerProperty(String, String)
|
||||||
|
controlP5.Controller : ColorWheel registerTooltip(String)
|
||||||
|
controlP5.Controller : ColorWheel removeBehavior()
|
||||||
|
controlP5.Controller : ColorWheel removeCallback()
|
||||||
|
controlP5.Controller : ColorWheel removeCallback(CallbackListener)
|
||||||
|
controlP5.Controller : ColorWheel removeListener(ControlListener)
|
||||||
|
controlP5.Controller : ColorWheel removeProperty(String)
|
||||||
|
controlP5.Controller : ColorWheel removeProperty(String, String)
|
||||||
|
controlP5.Controller : ColorWheel setArrayValue(float[])
|
||||||
|
controlP5.Controller : ColorWheel setArrayValue(int, float)
|
||||||
|
controlP5.Controller : ColorWheel setBehavior(ControlBehavior)
|
||||||
|
controlP5.Controller : ColorWheel setBroadcast(boolean)
|
||||||
|
controlP5.Controller : ColorWheel setCaptionLabel(String)
|
||||||
|
controlP5.Controller : ColorWheel setColor(CColor)
|
||||||
|
controlP5.Controller : ColorWheel setColorActive(int)
|
||||||
|
controlP5.Controller : ColorWheel setColorBackground(int)
|
||||||
|
controlP5.Controller : ColorWheel setColorCaptionLabel(int)
|
||||||
|
controlP5.Controller : ColorWheel setColorForeground(int)
|
||||||
|
controlP5.Controller : ColorWheel setColorValueLabel(int)
|
||||||
|
controlP5.Controller : ColorWheel setDecimalPrecision(int)
|
||||||
|
controlP5.Controller : ColorWheel setDefaultValue(float)
|
||||||
|
controlP5.Controller : ColorWheel setHeight(int)
|
||||||
|
controlP5.Controller : ColorWheel setId(int)
|
||||||
|
controlP5.Controller : ColorWheel setLabelVisible(boolean)
|
||||||
|
controlP5.Controller : ColorWheel setLock(boolean)
|
||||||
|
controlP5.Controller : ColorWheel setMax(float)
|
||||||
|
controlP5.Controller : ColorWheel setMin(float)
|
||||||
|
controlP5.Controller : ColorWheel setMouseOver(boolean)
|
||||||
|
controlP5.Controller : ColorWheel setMoveable(boolean)
|
||||||
|
controlP5.Controller : ColorWheel setPosition(PVector)
|
||||||
|
controlP5.Controller : ColorWheel setPosition(float, float)
|
||||||
|
controlP5.Controller : ColorWheel setSize(PImage)
|
||||||
|
controlP5.Controller : ColorWheel setSize(int, int)
|
||||||
|
controlP5.Controller : ColorWheel setStringValue(String)
|
||||||
|
controlP5.Controller : ColorWheel setUpdate(boolean)
|
||||||
|
controlP5.Controller : ColorWheel setValue(float)
|
||||||
|
controlP5.Controller : ColorWheel setValueLabel(String)
|
||||||
|
controlP5.Controller : ColorWheel setValueSelf(float)
|
||||||
|
controlP5.Controller : ColorWheel setView(ControllerView)
|
||||||
|
controlP5.Controller : ColorWheel setVisible(boolean)
|
||||||
|
controlP5.Controller : ColorWheel setWidth(int)
|
||||||
|
controlP5.Controller : ColorWheel show()
|
||||||
|
controlP5.Controller : ColorWheel unlock()
|
||||||
|
controlP5.Controller : ColorWheel unplugFrom(Object)
|
||||||
|
controlP5.Controller : ColorWheel unplugFrom(Object[])
|
||||||
|
controlP5.Controller : ColorWheel unregisterTooltip()
|
||||||
|
controlP5.Controller : ColorWheel update()
|
||||||
|
controlP5.Controller : ColorWheel updateSize()
|
||||||
|
controlP5.Controller : ControlBehavior getBehavior()
|
||||||
|
controlP5.Controller : ControlWindow getControlWindow()
|
||||||
|
controlP5.Controller : ControlWindow getWindow()
|
||||||
|
controlP5.Controller : ControllerProperty getProperty(String)
|
||||||
|
controlP5.Controller : ControllerProperty getProperty(String, String)
|
||||||
|
controlP5.Controller : ControllerView getView()
|
||||||
|
controlP5.Controller : Label getCaptionLabel()
|
||||||
|
controlP5.Controller : Label getValueLabel()
|
||||||
|
controlP5.Controller : List getControllerPlugList()
|
||||||
|
controlP5.Controller : PVector getAbsolutePosition()
|
||||||
|
controlP5.Controller : PVector getPosition()
|
||||||
|
controlP5.Controller : Pointer getPointer()
|
||||||
|
controlP5.Controller : String getAddress()
|
||||||
|
controlP5.Controller : String getInfo()
|
||||||
|
controlP5.Controller : String getName()
|
||||||
|
controlP5.Controller : String getStringValue()
|
||||||
|
controlP5.Controller : String toString()
|
||||||
|
controlP5.Controller : Tab getTab()
|
||||||
|
controlP5.Controller : boolean isActive()
|
||||||
|
controlP5.Controller : boolean isBroadcast()
|
||||||
|
controlP5.Controller : boolean isInside()
|
||||||
|
controlP5.Controller : boolean isLabelVisible()
|
||||||
|
controlP5.Controller : boolean isListening()
|
||||||
|
controlP5.Controller : boolean isLock()
|
||||||
|
controlP5.Controller : boolean isMouseOver()
|
||||||
|
controlP5.Controller : boolean isMousePressed()
|
||||||
|
controlP5.Controller : boolean isMoveable()
|
||||||
|
controlP5.Controller : boolean isUpdate()
|
||||||
|
controlP5.Controller : boolean isVisible()
|
||||||
|
controlP5.Controller : float getArrayValue(int)
|
||||||
|
controlP5.Controller : float getDefaultValue()
|
||||||
|
controlP5.Controller : float getMax()
|
||||||
|
controlP5.Controller : float getMin()
|
||||||
|
controlP5.Controller : float getValue()
|
||||||
|
controlP5.Controller : float[] getArrayValue()
|
||||||
|
controlP5.Controller : int getDecimalPrecision()
|
||||||
|
controlP5.Controller : int getHeight()
|
||||||
|
controlP5.Controller : int getId()
|
||||||
|
controlP5.Controller : int getWidth()
|
||||||
|
controlP5.Controller : int listenerSize()
|
||||||
|
controlP5.Controller : void remove()
|
||||||
|
controlP5.Controller : void setView(ControllerView, int)
|
||||||
|
java.lang.Object : String toString()
|
||||||
|
java.lang.Object : boolean equals(Object)
|
||||||
|
*/
|
||||||
|
|
271
examples/controllers/ControlP5accordion/ControlP5accordion.pde
Normal file
271
examples/controllers/ControlP5accordion/ControlP5accordion.pde
Normal file
@ -0,0 +1,271 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 Accordion
|
||||||
|
* arrange controller groups in an accordion like style.
|
||||||
|
*
|
||||||
|
* find a list of public methods available for the Accordion Controller
|
||||||
|
* at the bottom of this sketch. In the example below 3 groups with controllers
|
||||||
|
* are created and added to an accordion controller. Furthermore several key
|
||||||
|
* combinations are mapped to control individual settings of the accordion.
|
||||||
|
* An accordion comes in 2 modes, Accordion.SINGLE and Accordion.MULTI where the
|
||||||
|
* latter allows to open multiple groups of an accordion and the SINGLE mode only
|
||||||
|
* allows 1 group to be opened at a time.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
Accordion accordion;
|
||||||
|
|
||||||
|
color c = color(0, 160, 100);
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400, 600);
|
||||||
|
noStroke();
|
||||||
|
smooth();
|
||||||
|
gui();
|
||||||
|
}
|
||||||
|
|
||||||
|
void gui() {
|
||||||
|
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
|
||||||
|
// group number 1, contains 2 bangs
|
||||||
|
Group g1 = cp5.addGroup("myGroup1")
|
||||||
|
.setBackgroundColor(color(0, 64))
|
||||||
|
.setBackgroundHeight(150)
|
||||||
|
;
|
||||||
|
|
||||||
|
cp5.addBang("bang")
|
||||||
|
.setPosition(10,20)
|
||||||
|
.setSize(100,100)
|
||||||
|
.moveTo(g1)
|
||||||
|
.plugTo(this,"shuffle");
|
||||||
|
;
|
||||||
|
|
||||||
|
// group number 2, contains a radiobutton
|
||||||
|
Group g2 = cp5.addGroup("myGroup2")
|
||||||
|
.setBackgroundColor(color(0, 64))
|
||||||
|
.setBackgroundHeight(150)
|
||||||
|
;
|
||||||
|
|
||||||
|
cp5.addRadioButton("radio")
|
||||||
|
.setPosition(10,20)
|
||||||
|
.setItemWidth(20)
|
||||||
|
.setItemHeight(20)
|
||||||
|
.addItem("black", 0)
|
||||||
|
.addItem("red", 1)
|
||||||
|
.addItem("green", 2)
|
||||||
|
.addItem("blue", 3)
|
||||||
|
.addItem("grey", 4)
|
||||||
|
.setColorLabel(color(255))
|
||||||
|
.activate(2)
|
||||||
|
.moveTo(g2)
|
||||||
|
;
|
||||||
|
|
||||||
|
// group number 3, contains a bang and a slider
|
||||||
|
Group g3 = cp5.addGroup("myGroup3")
|
||||||
|
.setBackgroundColor(color(0, 64))
|
||||||
|
.setBackgroundHeight(150)
|
||||||
|
;
|
||||||
|
|
||||||
|
cp5.addBang("shuffle")
|
||||||
|
.setPosition(10,20)
|
||||||
|
.setSize(40,50)
|
||||||
|
.moveTo(g3)
|
||||||
|
;
|
||||||
|
|
||||||
|
cp5.addSlider("hello")
|
||||||
|
.setPosition(60,20)
|
||||||
|
.setSize(100,20)
|
||||||
|
.setRange(100,500)
|
||||||
|
.setValue(100)
|
||||||
|
.moveTo(g3)
|
||||||
|
;
|
||||||
|
|
||||||
|
cp5.addSlider("world")
|
||||||
|
.setPosition(60,50)
|
||||||
|
.setSize(100,20)
|
||||||
|
.setRange(100,500)
|
||||||
|
.setValue(200)
|
||||||
|
.moveTo(g3)
|
||||||
|
;
|
||||||
|
|
||||||
|
// create a new accordion
|
||||||
|
// add g1, g2, and g3 to the accordion.
|
||||||
|
accordion = cp5.addAccordion("acc")
|
||||||
|
.setPosition(40,40)
|
||||||
|
.setWidth(200)
|
||||||
|
.addItem(g1)
|
||||||
|
.addItem(g2)
|
||||||
|
.addItem(g3)
|
||||||
|
;
|
||||||
|
|
||||||
|
cp5.mapKeyFor(new ControlKey() {public void keyEvent() {accordion.open(0,1,2);}}, 'o');
|
||||||
|
cp5.mapKeyFor(new ControlKey() {public void keyEvent() {accordion.close(0,1,2);}}, 'c');
|
||||||
|
cp5.mapKeyFor(new ControlKey() {public void keyEvent() {accordion.setWidth(300);}}, '1');
|
||||||
|
cp5.mapKeyFor(new ControlKey() {public void keyEvent() {accordion.setPosition(0,0);accordion.setItemHeight(190);}}, '2');
|
||||||
|
cp5.mapKeyFor(new ControlKey() {public void keyEvent() {accordion.setCollapseMode(ControlP5.ALL);}}, '3');
|
||||||
|
cp5.mapKeyFor(new ControlKey() {public void keyEvent() {accordion.setCollapseMode(ControlP5.SINGLE);}}, '4');
|
||||||
|
cp5.mapKeyFor(new ControlKey() {public void keyEvent() {cp5.remove("myGroup1");}}, '0');
|
||||||
|
|
||||||
|
accordion.open(0,1,2);
|
||||||
|
|
||||||
|
// use Accordion.MULTI to allow multiple group
|
||||||
|
// to be open at a time.
|
||||||
|
accordion.setCollapseMode(Accordion.MULTI);
|
||||||
|
|
||||||
|
// when in SINGLE mode, only 1 accordion
|
||||||
|
// group can be open at a time.
|
||||||
|
// accordion.setCollapseMode(Accordion.SINGLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void radio(int theC) {
|
||||||
|
switch(theC) {
|
||||||
|
case(0):c=color(0,200);break;
|
||||||
|
case(1):c=color(255,0,0,200);break;
|
||||||
|
case(2):c=color(0, 200, 140,200);break;
|
||||||
|
case(3):c=color(0, 128, 255,200);break;
|
||||||
|
case(4):c=color(50,128);break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void shuffle() {
|
||||||
|
c = color(random(255),random(255),random(255),random(128,255));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(220);
|
||||||
|
|
||||||
|
fill(c);
|
||||||
|
|
||||||
|
float s1 = cp5.getController("hello").getValue();
|
||||||
|
ellipse(200,400,s1,s1);
|
||||||
|
|
||||||
|
float s2 = cp5.getController("world").getValue();
|
||||||
|
ellipse(300,100,s2,s2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
a list of all methods available for the Accordion Controller
|
||||||
|
use ControlP5.printPublicMethodsFor(Accordion.class);
|
||||||
|
to print the following list into the console.
|
||||||
|
|
||||||
|
You can find further details about class Accordion in the javadoc.
|
||||||
|
|
||||||
|
Format:
|
||||||
|
ClassName : returnType methodName(parameter type)
|
||||||
|
|
||||||
|
|
||||||
|
controlP5.Accordion : Accordion addItem(ControlGroup)
|
||||||
|
controlP5.Accordion : Accordion remove(ControllerInterface)
|
||||||
|
controlP5.Accordion : Accordion removeItem(ControlGroup)
|
||||||
|
controlP5.Accordion : Accordion setItemHeight(int)
|
||||||
|
controlP5.Accordion : Accordion setMinItemHeight(int)
|
||||||
|
controlP5.Accordion : Accordion setWidth(int)
|
||||||
|
controlP5.Accordion : Accordion updateItems()
|
||||||
|
controlP5.Accordion : int getItemHeight()
|
||||||
|
controlP5.Accordion : int getMinItemHeight()
|
||||||
|
controlP5.ControlGroup : Accordion activateEvent(boolean)
|
||||||
|
controlP5.ControlGroup : Accordion addListener(ControlListener)
|
||||||
|
controlP5.ControlGroup : Accordion hideBar()
|
||||||
|
controlP5.ControlGroup : Accordion removeListener(ControlListener)
|
||||||
|
controlP5.ControlGroup : Accordion setBackgroundColor(int)
|
||||||
|
controlP5.ControlGroup : Accordion setBackgroundHeight(int)
|
||||||
|
controlP5.ControlGroup : Accordion setBarHeight(int)
|
||||||
|
controlP5.ControlGroup : Accordion showBar()
|
||||||
|
controlP5.ControlGroup : Accordion updateInternalEvents(PApplet)
|
||||||
|
controlP5.ControlGroup : String getInfo()
|
||||||
|
controlP5.ControlGroup : String toString()
|
||||||
|
controlP5.ControlGroup : boolean isBarVisible()
|
||||||
|
controlP5.ControlGroup : int getBackgroundHeight()
|
||||||
|
controlP5.ControlGroup : int getBarHeight()
|
||||||
|
controlP5.ControlGroup : int listenerSize()
|
||||||
|
controlP5.ControllerGroup : Accordion add(ControllerInterface)
|
||||||
|
controlP5.ControllerGroup : Accordion bringToFront()
|
||||||
|
controlP5.ControllerGroup : Accordion bringToFront(ControllerInterface)
|
||||||
|
controlP5.ControllerGroup : Accordion close()
|
||||||
|
controlP5.ControllerGroup : Accordion disableCollapse()
|
||||||
|
controlP5.ControllerGroup : Accordion enableCollapse()
|
||||||
|
controlP5.ControllerGroup : Accordion hide()
|
||||||
|
controlP5.ControllerGroup : Accordion moveTo(ControlWindow)
|
||||||
|
controlP5.ControllerGroup : Accordion moveTo(PApplet)
|
||||||
|
controlP5.ControllerGroup : Accordion open()
|
||||||
|
controlP5.ControllerGroup : Accordion registerProperty(String)
|
||||||
|
controlP5.ControllerGroup : Accordion registerProperty(String, String)
|
||||||
|
controlP5.ControllerGroup : Accordion remove(CDrawable)
|
||||||
|
controlP5.ControllerGroup : Accordion remove(ControllerInterface)
|
||||||
|
controlP5.ControllerGroup : Accordion removeCanvas(ControlWindowCanvas)
|
||||||
|
controlP5.ControllerGroup : Accordion removeProperty(String)
|
||||||
|
controlP5.ControllerGroup : Accordion removeProperty(String, String)
|
||||||
|
controlP5.ControllerGroup : Accordion setAddress(String)
|
||||||
|
controlP5.ControllerGroup : Accordion setArrayValue(float[])
|
||||||
|
controlP5.ControllerGroup : Accordion setColor(CColor)
|
||||||
|
controlP5.ControllerGroup : Accordion setColorActive(int)
|
||||||
|
controlP5.ControllerGroup : Accordion setColorBackground(int)
|
||||||
|
controlP5.ControllerGroup : Accordion setColorForeground(int)
|
||||||
|
controlP5.ControllerGroup : Accordion setColorLabel(int)
|
||||||
|
controlP5.ControllerGroup : Accordion setColorValue(int)
|
||||||
|
controlP5.ControllerGroup : Accordion setHeight(int)
|
||||||
|
controlP5.ControllerGroup : Accordion setId(int)
|
||||||
|
controlP5.ControllerGroup : Accordion setLabel(String)
|
||||||
|
controlP5.ControllerGroup : Accordion setMouseOver(boolean)
|
||||||
|
controlP5.ControllerGroup : Accordion setMoveable(boolean)
|
||||||
|
controlP5.ControllerGroup : Accordion setOpen(boolean)
|
||||||
|
controlP5.ControllerGroup : Accordion setPosition(PVector)
|
||||||
|
controlP5.ControllerGroup : Accordion setPosition(float, float)
|
||||||
|
controlP5.ControllerGroup : Accordion setStringValue(String)
|
||||||
|
controlP5.ControllerGroup : Accordion setUpdate(boolean)
|
||||||
|
controlP5.ControllerGroup : Accordion setValue(float)
|
||||||
|
controlP5.ControllerGroup : Accordion setVisible(boolean)
|
||||||
|
controlP5.ControllerGroup : Accordion setWidth(int)
|
||||||
|
controlP5.ControllerGroup : Accordion show()
|
||||||
|
controlP5.ControllerGroup : Accordion update()
|
||||||
|
controlP5.ControllerGroup : Accordion updateAbsolutePosition()
|
||||||
|
controlP5.ControllerGroup : CColor getColor()
|
||||||
|
controlP5.ControllerGroup : ControlWindow getWindow()
|
||||||
|
controlP5.ControllerGroup : ControlWindowCanvas addCanvas(ControlWindowCanvas)
|
||||||
|
controlP5.ControllerGroup : Controller getController(String)
|
||||||
|
controlP5.ControllerGroup : ControllerProperty getProperty(String)
|
||||||
|
controlP5.ControllerGroup : ControllerProperty getProperty(String, String)
|
||||||
|
controlP5.ControllerGroup : Label getCaptionLabel()
|
||||||
|
controlP5.ControllerGroup : Label getValueLabel()
|
||||||
|
controlP5.ControllerGroup : PVector getPosition()
|
||||||
|
controlP5.ControllerGroup : String getAddress()
|
||||||
|
controlP5.ControllerGroup : String getInfo()
|
||||||
|
controlP5.ControllerGroup : String getName()
|
||||||
|
controlP5.ControllerGroup : String getStringValue()
|
||||||
|
controlP5.ControllerGroup : String toString()
|
||||||
|
controlP5.ControllerGroup : Tab getTab()
|
||||||
|
controlP5.ControllerGroup : boolean isCollapse()
|
||||||
|
controlP5.ControllerGroup : boolean isMouseOver()
|
||||||
|
controlP5.ControllerGroup : boolean isMoveable()
|
||||||
|
controlP5.ControllerGroup : boolean isOpen()
|
||||||
|
controlP5.ControllerGroup : boolean isUpdate()
|
||||||
|
controlP5.ControllerGroup : boolean isVisible()
|
||||||
|
controlP5.ControllerGroup : boolean setMousePressed(boolean)
|
||||||
|
controlP5.ControllerGroup : float getValue()
|
||||||
|
controlP5.ControllerGroup : float[] getArrayValue()
|
||||||
|
controlP5.ControllerGroup : int getHeight()
|
||||||
|
controlP5.ControllerGroup : int getId()
|
||||||
|
controlP5.ControllerGroup : int getWidth()
|
||||||
|
controlP5.ControllerGroup : void remove()
|
||||||
|
java.lang.Object : String toString()
|
||||||
|
java.lang.Object : boolean equals(Object)
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
206
examples/controllers/ControlP5bang/ControlP5bang.pde
Normal file
206
examples/controllers/ControlP5bang/ControlP5bang.pde
Normal file
@ -0,0 +1,206 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 Bang
|
||||||
|
* A bang triggers an event that can be received by a function named after the bang.
|
||||||
|
* By default a bang is triggered when pressed, this can be changed to 'release'
|
||||||
|
* using theBang.setTriggerEvent(Bang.RELEASE).
|
||||||
|
*
|
||||||
|
* find a list of public methods available for the Bang Controller
|
||||||
|
* at the bottom of this sketch.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
int myColorBackground = color(0, 0, 0);
|
||||||
|
|
||||||
|
color[] col = new color[] {
|
||||||
|
color(100), color(150), color(200), color(250)
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400, 600);
|
||||||
|
noStroke();
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
for (int i=0;i<col.length;i++) {
|
||||||
|
cp5.addBang("bang"+i)
|
||||||
|
.setPosition(40+i*80, 200)
|
||||||
|
.setSize(40, 40)
|
||||||
|
.setId(i)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
// change the trigger event, by default it is PRESSED.
|
||||||
|
cp5.addBang("bang")
|
||||||
|
.setPosition(40, 300)
|
||||||
|
.setSize(280, 40)
|
||||||
|
.setTriggerEvent(Bang.RELEASE)
|
||||||
|
.setLabel("changeBackground")
|
||||||
|
;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(myColorBackground);
|
||||||
|
for (int i=0;i<col.length;i++) {
|
||||||
|
fill(col[i]);
|
||||||
|
rect(40+i*80, 50, 40, 80);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void bang() {
|
||||||
|
int theColor = (int)random(255);
|
||||||
|
myColorBackground = color(theColor);
|
||||||
|
println("### bang(). a bang event. setting background to "+theColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void controlEvent(ControlEvent theEvent) {
|
||||||
|
for (int i=0;i<col.length;i++) {
|
||||||
|
if (theEvent.getController().getName().equals("bang"+i)) {
|
||||||
|
col[i] = color(random(255));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
println(
|
||||||
|
"## controlEvent / id:"+theEvent.controller().getId()+
|
||||||
|
" / name:"+theEvent.controller().getName()+
|
||||||
|
" / value:"+theEvent.controller().getValue()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
a list of all methods available for the Bang Controller
|
||||||
|
use ControlP5.printPublicMethodsFor(Bang.class);
|
||||||
|
to print the following list into the console.
|
||||||
|
|
||||||
|
You can find further details about class Bang in the javadoc.
|
||||||
|
|
||||||
|
Format:
|
||||||
|
ClassName : returnType methodName(parameter type)
|
||||||
|
|
||||||
|
|
||||||
|
controlP5.Bang : Bang setTriggerEvent(int)
|
||||||
|
controlP5.Bang : Bang setValue(float)
|
||||||
|
controlP5.Bang : Bang update()
|
||||||
|
controlP5.Bang : String getInfo()
|
||||||
|
controlP5.Bang : String toString()
|
||||||
|
controlP5.Bang : int getTriggerEvent()
|
||||||
|
controlP5.Controller : Bang addCallback(CallbackListener)
|
||||||
|
controlP5.Controller : Bang addListener(ControlListener)
|
||||||
|
controlP5.Controller : Bang bringToFront()
|
||||||
|
controlP5.Controller : Bang bringToFront(ControllerInterface)
|
||||||
|
controlP5.Controller : Bang hide()
|
||||||
|
controlP5.Controller : Bang linebreak()
|
||||||
|
controlP5.Controller : Bang listen(boolean)
|
||||||
|
controlP5.Controller : Bang lock()
|
||||||
|
controlP5.Controller : Bang plugTo(Object)
|
||||||
|
controlP5.Controller : Bang plugTo(Object, String)
|
||||||
|
controlP5.Controller : Bang plugTo(Object[])
|
||||||
|
controlP5.Controller : Bang plugTo(Object[], String)
|
||||||
|
controlP5.Controller : Bang registerProperty(String)
|
||||||
|
controlP5.Controller : Bang registerProperty(String, String)
|
||||||
|
controlP5.Controller : Bang registerTooltip(String)
|
||||||
|
controlP5.Controller : Bang removeBehavior()
|
||||||
|
controlP5.Controller : Bang removeCallback()
|
||||||
|
controlP5.Controller : Bang removeCallback(CallbackListener)
|
||||||
|
controlP5.Controller : Bang removeListener(ControlListener)
|
||||||
|
controlP5.Controller : Bang removeProperty(String)
|
||||||
|
controlP5.Controller : Bang removeProperty(String, String)
|
||||||
|
controlP5.Controller : Bang setArrayValue(float[])
|
||||||
|
controlP5.Controller : Bang setArrayValue(int, float)
|
||||||
|
controlP5.Controller : Bang setBehavior(ControlBehavior)
|
||||||
|
controlP5.Controller : Bang setBroadcast(boolean)
|
||||||
|
controlP5.Controller : Bang setCaptionLabel(String)
|
||||||
|
controlP5.Controller : Bang setColor(CColor)
|
||||||
|
controlP5.Controller : Bang setColorActive(int)
|
||||||
|
controlP5.Controller : Bang setColorBackground(int)
|
||||||
|
controlP5.Controller : Bang setColorCaptionLabel(int)
|
||||||
|
controlP5.Controller : Bang setColorForeground(int)
|
||||||
|
controlP5.Controller : Bang setColorValueLabel(int)
|
||||||
|
controlP5.Controller : Bang setDecimalPrecision(int)
|
||||||
|
controlP5.Controller : Bang setDefaultValue(float)
|
||||||
|
controlP5.Controller : Bang setHeight(int)
|
||||||
|
controlP5.Controller : Bang setId(int)
|
||||||
|
controlP5.Controller : Bang setImages(PImage, PImage, PImage)
|
||||||
|
controlP5.Controller : Bang setImages(PImage, PImage, PImage, PImage)
|
||||||
|
controlP5.Controller : Bang setLabelVisible(boolean)
|
||||||
|
controlP5.Controller : Bang setLock(boolean)
|
||||||
|
controlP5.Controller : Bang setMax(float)
|
||||||
|
controlP5.Controller : Bang setMin(float)
|
||||||
|
controlP5.Controller : Bang setMouseOver(boolean)
|
||||||
|
controlP5.Controller : Bang setMoveable(boolean)
|
||||||
|
controlP5.Controller : Bang setPosition(PVector)
|
||||||
|
controlP5.Controller : Bang setPosition(float, float)
|
||||||
|
controlP5.Controller : Bang setSize(PImage)
|
||||||
|
controlP5.Controller : Bang setSize(int, int)
|
||||||
|
controlP5.Controller : Bang setStringValue(String)
|
||||||
|
controlP5.Controller : Bang setUpdate(boolean)
|
||||||
|
controlP5.Controller : Bang setValueLabel(String)
|
||||||
|
controlP5.Controller : Bang setView(ControllerView)
|
||||||
|
controlP5.Controller : Bang setVisible(boolean)
|
||||||
|
controlP5.Controller : Bang setWidth(int)
|
||||||
|
controlP5.Controller : Bang show()
|
||||||
|
controlP5.Controller : Bang unlock()
|
||||||
|
controlP5.Controller : Bang unplugFrom(Object)
|
||||||
|
controlP5.Controller : Bang unplugFrom(Object[])
|
||||||
|
controlP5.Controller : Bang unregisterTooltip()
|
||||||
|
controlP5.Controller : Bang update()
|
||||||
|
controlP5.Controller : Bang updateSize()
|
||||||
|
controlP5.Controller : CColor getColor()
|
||||||
|
controlP5.Controller : ControlBehavior getBehavior()
|
||||||
|
controlP5.Controller : ControlWindow getControlWindow()
|
||||||
|
controlP5.Controller : ControlWindow getWindow()
|
||||||
|
controlP5.Controller : ControllerProperty getProperty(String)
|
||||||
|
controlP5.Controller : ControllerProperty getProperty(String, String)
|
||||||
|
controlP5.Controller : Label getCaptionLabel()
|
||||||
|
controlP5.Controller : Label getValueLabel()
|
||||||
|
controlP5.Controller : List getControllerPlugList()
|
||||||
|
controlP5.Controller : PImage setImage(PImage)
|
||||||
|
controlP5.Controller : PImage setImage(PImage, int)
|
||||||
|
controlP5.Controller : PVector getAbsolutePosition()
|
||||||
|
controlP5.Controller : PVector getPosition()
|
||||||
|
controlP5.Controller : String getAddress()
|
||||||
|
controlP5.Controller : String getInfo()
|
||||||
|
controlP5.Controller : String getName()
|
||||||
|
controlP5.Controller : String getStringValue()
|
||||||
|
controlP5.Controller : String toString()
|
||||||
|
controlP5.Controller : Tab getTab()
|
||||||
|
controlP5.Controller : boolean isActive()
|
||||||
|
controlP5.Controller : boolean isBroadcast()
|
||||||
|
controlP5.Controller : boolean isInside()
|
||||||
|
controlP5.Controller : boolean isLabelVisible()
|
||||||
|
controlP5.Controller : boolean isListening()
|
||||||
|
controlP5.Controller : boolean isLock()
|
||||||
|
controlP5.Controller : boolean isMouseOver()
|
||||||
|
controlP5.Controller : boolean isMousePressed()
|
||||||
|
controlP5.Controller : boolean isMoveable()
|
||||||
|
controlP5.Controller : boolean isUpdate()
|
||||||
|
controlP5.Controller : boolean isVisible()
|
||||||
|
controlP5.Controller : float getArrayValue(int)
|
||||||
|
controlP5.Controller : float getDefaultValue()
|
||||||
|
controlP5.Controller : float getMax()
|
||||||
|
controlP5.Controller : float getMin()
|
||||||
|
controlP5.Controller : float getValue()
|
||||||
|
controlP5.Controller : float[] getArrayValue()
|
||||||
|
controlP5.Controller : int getDecimalPrecision()
|
||||||
|
controlP5.Controller : int getHeight()
|
||||||
|
controlP5.Controller : int getId()
|
||||||
|
controlP5.Controller : int getWidth()
|
||||||
|
controlP5.Controller : int listenerSize()
|
||||||
|
controlP5.Controller : void remove()
|
||||||
|
controlP5.Controller : void setView(ControllerView, int)
|
||||||
|
java.lang.Object : String toString()
|
||||||
|
java.lang.Object : boolean equals(Object)
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
241
examples/controllers/ControlP5button/ControlP5button.pde
Normal file
241
examples/controllers/ControlP5button/ControlP5button.pde
Normal file
@ -0,0 +1,241 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 Button
|
||||||
|
* this example shows how to create buttons with controlP5.
|
||||||
|
*
|
||||||
|
* find a list of public methods available for the Button Controller
|
||||||
|
* at the bottom of this sketch's source code
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
int myColor = color(255);
|
||||||
|
|
||||||
|
int c1,c2;
|
||||||
|
|
||||||
|
float n,n1;
|
||||||
|
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400,600);
|
||||||
|
noStroke();
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
|
||||||
|
// create a new button with name 'buttonA'
|
||||||
|
cp5.addButton("colorA")
|
||||||
|
.setValue(0)
|
||||||
|
.setPosition(100,100)
|
||||||
|
.setSize(200,19)
|
||||||
|
;
|
||||||
|
|
||||||
|
// and add another 2 buttons
|
||||||
|
cp5.addButton("colorB")
|
||||||
|
.setValue(100)
|
||||||
|
.setPosition(100,120)
|
||||||
|
.setSize(200,19)
|
||||||
|
;
|
||||||
|
|
||||||
|
cp5.addButton("colorC")
|
||||||
|
.setPosition(100,140)
|
||||||
|
.setSize(200,19)
|
||||||
|
.setValue(0)
|
||||||
|
;
|
||||||
|
|
||||||
|
PImage[] imgs = {loadImage("button_a.png"),loadImage("button_b.png"),loadImage("button_c.png")};
|
||||||
|
cp5.addButton("play")
|
||||||
|
.setValue(128)
|
||||||
|
.setPosition(140,300)
|
||||||
|
.setImages(imgs)
|
||||||
|
.updateSize()
|
||||||
|
;
|
||||||
|
|
||||||
|
cp5.addButton("playAgain")
|
||||||
|
.setValue(128)
|
||||||
|
.setPosition(210,300)
|
||||||
|
.setImages(imgs)
|
||||||
|
.updateSize()
|
||||||
|
;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(myColor);
|
||||||
|
myColor = lerpColor(c1,c2,n);
|
||||||
|
n += (1-n)* 0.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void controlEvent(ControlEvent theEvent) {
|
||||||
|
println(theEvent.getController().getName());
|
||||||
|
n = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// function colorA will receive changes from
|
||||||
|
// controller with name colorA
|
||||||
|
public void colorA(int theValue) {
|
||||||
|
println("a button event from colorA: "+theValue);
|
||||||
|
c1 = c2;
|
||||||
|
c2 = color(0,160,100);
|
||||||
|
}
|
||||||
|
|
||||||
|
// function colorB will receive changes from
|
||||||
|
// controller with name colorB
|
||||||
|
public void colorB(int theValue) {
|
||||||
|
println("a button event from colorB: "+theValue);
|
||||||
|
c1 = c2;
|
||||||
|
c2 = color(150,0,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// function colorC will receive changes from
|
||||||
|
// controller with name colorC
|
||||||
|
public void colorC(int theValue) {
|
||||||
|
println("a button event from colorC: "+theValue);
|
||||||
|
c1 = c2;
|
||||||
|
c2 = color(255,255,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void play(int theValue) {
|
||||||
|
println("a button event from buttonB: "+theValue);
|
||||||
|
c1 = c2;
|
||||||
|
c2 = color(0,0,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
a list of all methods available for the Button Controller
|
||||||
|
use ControlP5.printPublicMethodsFor(Button.class);
|
||||||
|
to print the following list into the console.
|
||||||
|
|
||||||
|
You can find further details about class Button in the javadoc.
|
||||||
|
|
||||||
|
Format:
|
||||||
|
ClassName : returnType methodName(parameter type)
|
||||||
|
|
||||||
|
|
||||||
|
controlP5.Button : Button activateBy(int)
|
||||||
|
controlP5.Button : Button setOff()
|
||||||
|
controlP5.Button : Button setOn()
|
||||||
|
controlP5.Button : Button setSwitch(boolean)
|
||||||
|
controlP5.Button : Button setValue(float)
|
||||||
|
controlP5.Button : Button update()
|
||||||
|
controlP5.Button : String getInfo()
|
||||||
|
controlP5.Button : String toString()
|
||||||
|
controlP5.Button : boolean getBooleanValue()
|
||||||
|
controlP5.Button : boolean isOn()
|
||||||
|
controlP5.Button : boolean isPressed()
|
||||||
|
controlP5.Controller : Button addCallback(CallbackListener)
|
||||||
|
controlP5.Controller : Button addListener(ControlListener)
|
||||||
|
controlP5.Controller : Button bringToFront()
|
||||||
|
controlP5.Controller : Button bringToFront(ControllerInterface)
|
||||||
|
controlP5.Controller : Button hide()
|
||||||
|
controlP5.Controller : Button linebreak()
|
||||||
|
controlP5.Controller : Button listen(boolean)
|
||||||
|
controlP5.Controller : Button lock()
|
||||||
|
controlP5.Controller : Button plugTo(Object)
|
||||||
|
controlP5.Controller : Button plugTo(Object, String)
|
||||||
|
controlP5.Controller : Button plugTo(Object[])
|
||||||
|
controlP5.Controller : Button plugTo(Object[], String)
|
||||||
|
controlP5.Controller : Button registerProperty(String)
|
||||||
|
controlP5.Controller : Button registerProperty(String, String)
|
||||||
|
controlP5.Controller : Button registerTooltip(String)
|
||||||
|
controlP5.Controller : Button removeBehavior()
|
||||||
|
controlP5.Controller : Button removeCallback()
|
||||||
|
controlP5.Controller : Button removeCallback(CallbackListener)
|
||||||
|
controlP5.Controller : Button removeListener(ControlListener)
|
||||||
|
controlP5.Controller : Button removeProperty(String)
|
||||||
|
controlP5.Controller : Button removeProperty(String, String)
|
||||||
|
controlP5.Controller : Button setArrayValue(float[])
|
||||||
|
controlP5.Controller : Button setArrayValue(int, float)
|
||||||
|
controlP5.Controller : Button setBehavior(ControlBehavior)
|
||||||
|
controlP5.Controller : Button setBroadcast(boolean)
|
||||||
|
controlP5.Controller : Button setCaptionLabel(String)
|
||||||
|
controlP5.Controller : Button setColor(CColor)
|
||||||
|
controlP5.Controller : Button setColorActive(int)
|
||||||
|
controlP5.Controller : Button setColorBackground(int)
|
||||||
|
controlP5.Controller : Button setColorCaptionLabel(int)
|
||||||
|
controlP5.Controller : Button setColorForeground(int)
|
||||||
|
controlP5.Controller : Button setColorValueLabel(int)
|
||||||
|
controlP5.Controller : Button setDecimalPrecision(int)
|
||||||
|
controlP5.Controller : Button setDefaultValue(float)
|
||||||
|
controlP5.Controller : Button setHeight(int)
|
||||||
|
controlP5.Controller : Button setId(int)
|
||||||
|
controlP5.Controller : Button setImages(PImage, PImage, PImage)
|
||||||
|
controlP5.Controller : Button setImages(PImage, PImage, PImage, PImage)
|
||||||
|
controlP5.Controller : Button setLabelVisible(boolean)
|
||||||
|
controlP5.Controller : Button setLock(boolean)
|
||||||
|
controlP5.Controller : Button setMax(float)
|
||||||
|
controlP5.Controller : Button setMin(float)
|
||||||
|
controlP5.Controller : Button setMouseOver(boolean)
|
||||||
|
controlP5.Controller : Button setMoveable(boolean)
|
||||||
|
controlP5.Controller : Button setPosition(PVector)
|
||||||
|
controlP5.Controller : Button setPosition(float, float)
|
||||||
|
controlP5.Controller : Button setSize(PImage)
|
||||||
|
controlP5.Controller : Button setSize(int, int)
|
||||||
|
controlP5.Controller : Button setStringValue(String)
|
||||||
|
controlP5.Controller : Button setUpdate(boolean)
|
||||||
|
controlP5.Controller : Button setValueLabel(String)
|
||||||
|
controlP5.Controller : Button setView(ControllerView)
|
||||||
|
controlP5.Controller : Button setVisible(boolean)
|
||||||
|
controlP5.Controller : Button setWidth(int)
|
||||||
|
controlP5.Controller : Button show()
|
||||||
|
controlP5.Controller : Button unlock()
|
||||||
|
controlP5.Controller : Button unplugFrom(Object)
|
||||||
|
controlP5.Controller : Button unplugFrom(Object[])
|
||||||
|
controlP5.Controller : Button unregisterTooltip()
|
||||||
|
controlP5.Controller : Button update()
|
||||||
|
controlP5.Controller : Button updateSize()
|
||||||
|
controlP5.Controller : CColor getColor()
|
||||||
|
controlP5.Controller : ControlBehavior getBehavior()
|
||||||
|
controlP5.Controller : ControlWindow getControlWindow()
|
||||||
|
controlP5.Controller : ControlWindow getWindow()
|
||||||
|
controlP5.Controller : ControllerProperty getProperty(String)
|
||||||
|
controlP5.Controller : ControllerProperty getProperty(String, String)
|
||||||
|
controlP5.Controller : Label getCaptionLabel()
|
||||||
|
controlP5.Controller : Label getValueLabel()
|
||||||
|
controlP5.Controller : List getControllerPlugList()
|
||||||
|
controlP5.Controller : PImage setImage(PImage)
|
||||||
|
controlP5.Controller : PImage setImage(PImage, int)
|
||||||
|
controlP5.Controller : PVector getAbsolutePosition()
|
||||||
|
controlP5.Controller : PVector getPosition()
|
||||||
|
controlP5.Controller : String getAddress()
|
||||||
|
controlP5.Controller : String getInfo()
|
||||||
|
controlP5.Controller : String getName()
|
||||||
|
controlP5.Controller : String getStringValue()
|
||||||
|
controlP5.Controller : String toString()
|
||||||
|
controlP5.Controller : Tab getTab()
|
||||||
|
controlP5.Controller : boolean isActive()
|
||||||
|
controlP5.Controller : boolean isBroadcast()
|
||||||
|
controlP5.Controller : boolean isInside()
|
||||||
|
controlP5.Controller : boolean isLabelVisible()
|
||||||
|
controlP5.Controller : boolean isListening()
|
||||||
|
controlP5.Controller : boolean isLock()
|
||||||
|
controlP5.Controller : boolean isMouseOver()
|
||||||
|
controlP5.Controller : boolean isMousePressed()
|
||||||
|
controlP5.Controller : boolean isMoveable()
|
||||||
|
controlP5.Controller : boolean isUpdate()
|
||||||
|
controlP5.Controller : boolean isVisible()
|
||||||
|
controlP5.Controller : float getArrayValue(int)
|
||||||
|
controlP5.Controller : float getDefaultValue()
|
||||||
|
controlP5.Controller : float getMax()
|
||||||
|
controlP5.Controller : float getMin()
|
||||||
|
controlP5.Controller : float getValue()
|
||||||
|
controlP5.Controller : float[] getArrayValue()
|
||||||
|
controlP5.Controller : int getDecimalPrecision()
|
||||||
|
controlP5.Controller : int getHeight()
|
||||||
|
controlP5.Controller : int getId()
|
||||||
|
controlP5.Controller : int getWidth()
|
||||||
|
controlP5.Controller : int listenerSize()
|
||||||
|
controlP5.Controller : void remove()
|
||||||
|
controlP5.Controller : void setView(ControllerView, int)
|
||||||
|
java.lang.Object : String toString()
|
||||||
|
java.lang.Object : boolean equals(Object)
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
BIN
examples/controllers/ControlP5button/data/button_a.png
Normal file
BIN
examples/controllers/ControlP5button/data/button_a.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
examples/controllers/ControlP5button/data/button_b.png
Normal file
BIN
examples/controllers/ControlP5button/data/button_b.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
examples/controllers/ControlP5button/data/button_c.png
Normal file
BIN
examples/controllers/ControlP5button/data/button_c.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
85
examples/controllers/ControlP5canvas/ControlP5canvas.pde
Normal file
85
examples/controllers/ControlP5canvas/ControlP5canvas.pde
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 Canvas
|
||||||
|
* The ControlWindowCanvas allow you to add custom graphics to
|
||||||
|
* the default controlP5 renderer or a controlWindow rednerer.
|
||||||
|
*
|
||||||
|
* find a list of public methods available for the Canvas Controller
|
||||||
|
* at the bottom of this sketch's source code
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2011
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
ControlWindow controlWindow;
|
||||||
|
|
||||||
|
Canvas cc;
|
||||||
|
|
||||||
|
// MyCanvas, your Canvas render class
|
||||||
|
class MyCanvas extends Canvas {
|
||||||
|
|
||||||
|
int y;
|
||||||
|
int mx = 0;
|
||||||
|
int my = 0;
|
||||||
|
public void setup(PGraphics pg) {
|
||||||
|
y = 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(PApplet p) {
|
||||||
|
mx = p.mouseX;
|
||||||
|
my = p.mouseY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void draw(PGraphics pg) {
|
||||||
|
// renders a square with randomly changing colors
|
||||||
|
// make changes here.
|
||||||
|
pg.fill(100);
|
||||||
|
pg.rect(mx-20, y-20, 240, 30);
|
||||||
|
pg.fill(255);
|
||||||
|
pg.text("This text is drawn by MyCanvas", mx,y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400, 400);
|
||||||
|
frameRate(30);
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
|
||||||
|
// create a control window canvas and add it to
|
||||||
|
// the previously created control window.
|
||||||
|
cc = new MyCanvas();
|
||||||
|
cc.pre(); // use cc.post(); to draw on top of existing controllers.
|
||||||
|
cp5.addCanvas(cc); // add the canvas to cp5
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(0);
|
||||||
|
fill(60);
|
||||||
|
rect(100, 100, 200, 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
a list of all methods available for the ControlWindowCanvas Controller
|
||||||
|
use ControlP5.printPublicMethodsFor(Canvas.class);
|
||||||
|
to print the following list into the console.
|
||||||
|
|
||||||
|
You can find further details about class Canvas in the javadoc.
|
||||||
|
|
||||||
|
Format:
|
||||||
|
ClassName : returnType methodName(parameter type)
|
||||||
|
|
||||||
|
controlP5.Canvas : void moveTo(ControlWindow)
|
||||||
|
controlP5.Canvas : void setup(PApplet)
|
||||||
|
controlP5.Canvas : void draw(PApplet)
|
||||||
|
java.lang.Object : String toString()
|
||||||
|
java.lang.Object : boolean equals(Object)
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
222
examples/controllers/ControlP5chart/ControlP5chart.pde
Normal file
222
examples/controllers/ControlP5chart/ControlP5chart.pde
Normal file
@ -0,0 +1,222 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 Chart
|
||||||
|
*
|
||||||
|
* find a list of public methods available for the Chart Controller
|
||||||
|
* at the bottom of this sketch.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
Chart myChart;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400, 700);
|
||||||
|
smooth();
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
cp5.printPublicMethodsFor(Chart.class);
|
||||||
|
myChart = cp5.addChart("hello")
|
||||||
|
.setPosition(50, 50)
|
||||||
|
.setSize(200, 200)
|
||||||
|
.setRange(-20, 20)
|
||||||
|
.setView(Chart.BAR) // use Chart.LINE, Chart.PIE, Chart.AREA, Chart.BAR_CENTERED
|
||||||
|
;
|
||||||
|
|
||||||
|
myChart.getColor().setBackground(color(255, 100));
|
||||||
|
|
||||||
|
|
||||||
|
myChart.addDataSet("world");
|
||||||
|
myChart.setColors("world", color(255,0,255),color(255,0,0));
|
||||||
|
myChart.setData("world", new float[4]);
|
||||||
|
|
||||||
|
myChart.setStrokeWeight(1.5);
|
||||||
|
|
||||||
|
myChart.addDataSet("earth");
|
||||||
|
myChart.setColors("earth", color(255), color(0, 255, 0));
|
||||||
|
myChart.updateData("earth", 1, 2, 10, 3);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(0);
|
||||||
|
// unshift: add data from left to right (first in)
|
||||||
|
myChart.unshift("world", (sin(frameCount*0.01)*10));
|
||||||
|
|
||||||
|
// push: add data from right to left (last in)
|
||||||
|
myChart.push("earth", (sin(frameCount*0.1)*10));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
a list of all methods available for the Chart Controller
|
||||||
|
use ControlP5.printPublicMethodsFor(Chart.class);
|
||||||
|
to print the following list into the console.
|
||||||
|
|
||||||
|
You can find further details about class Chart in the javadoc.
|
||||||
|
|
||||||
|
Format:
|
||||||
|
ClassName : returnType methodName(parameter type)
|
||||||
|
|
||||||
|
|
||||||
|
controlP5.Chart : Chart addData(ChartData)
|
||||||
|
controlP5.Chart : Chart addData(ChartDataSet, float)
|
||||||
|
controlP5.Chart : Chart addData(String, ChartData)
|
||||||
|
controlP5.Chart : Chart addData(String, float)
|
||||||
|
controlP5.Chart : Chart addData(float)
|
||||||
|
controlP5.Chart : Chart addDataSet(String)
|
||||||
|
controlP5.Chart : Chart addFirst(String, float)
|
||||||
|
controlP5.Chart : Chart addFirst(float)
|
||||||
|
controlP5.Chart : Chart removeData(ChartData)
|
||||||
|
controlP5.Chart : Chart removeData(String, ChartData)
|
||||||
|
controlP5.Chart : Chart removeData(String, int)
|
||||||
|
controlP5.Chart : Chart removeData(int)
|
||||||
|
controlP5.Chart : Chart removeDataSet(String)
|
||||||
|
controlP5.Chart : Chart removeLast()
|
||||||
|
controlP5.Chart : Chart removeLast(String)
|
||||||
|
controlP5.Chart : Chart setData(String, int, ChartData)
|
||||||
|
controlP5.Chart : Chart setData(int, ChartData)
|
||||||
|
controlP5.Chart : Chart setDataSet(ChartDataSet)
|
||||||
|
controlP5.Chart : Chart setDataSet(String, ChartDataSet)
|
||||||
|
controlP5.Chart : Chart setRange(float, float)
|
||||||
|
controlP5.Chart : Chart setResolution(int)
|
||||||
|
controlP5.Chart : Chart setStrokeWeight(float)
|
||||||
|
controlP5.Chart : Chart setValue(float)
|
||||||
|
controlP5.Chart : Chart setView(int)
|
||||||
|
controlP5.Chart : Chart unshift(String, float)
|
||||||
|
controlP5.Chart : Chart unshift(float)
|
||||||
|
controlP5.Chart : ChartData getData(String, int)
|
||||||
|
controlP5.Chart : ChartDataSet getDataSet(String)
|
||||||
|
controlP5.Chart : LinkedHashMap getDataSet()
|
||||||
|
controlP5.Chart : String getInfo()
|
||||||
|
controlP5.Chart : String toString()
|
||||||
|
controlP5.Chart : float getStrokeWeight()
|
||||||
|
controlP5.Chart : float[] getValuesFrom(String)
|
||||||
|
controlP5.Chart : int getResolution()
|
||||||
|
controlP5.Chart : int size()
|
||||||
|
controlP5.Chart : void onEnter()
|
||||||
|
controlP5.Chart : void onLeave()
|
||||||
|
controlP5.Controller : CColor getColor()
|
||||||
|
controlP5.Controller : Chart addCallback(CallbackListener)
|
||||||
|
controlP5.Controller : Chart addListener(ControlListener)
|
||||||
|
controlP5.Controller : Chart align(int, int, int, int)
|
||||||
|
controlP5.Controller : Chart bringToFront()
|
||||||
|
controlP5.Controller : Chart bringToFront(ControllerInterface)
|
||||||
|
controlP5.Controller : Chart hide()
|
||||||
|
controlP5.Controller : Chart linebreak()
|
||||||
|
controlP5.Controller : Chart listen(boolean)
|
||||||
|
controlP5.Controller : Chart lock()
|
||||||
|
controlP5.Controller : Chart plugTo(Object)
|
||||||
|
controlP5.Controller : Chart plugTo(Object, String)
|
||||||
|
controlP5.Controller : Chart plugTo(Object[])
|
||||||
|
controlP5.Controller : Chart plugTo(Object[], String)
|
||||||
|
controlP5.Controller : Chart registerProperty(String)
|
||||||
|
controlP5.Controller : Chart registerProperty(String, String)
|
||||||
|
controlP5.Controller : Chart registerTooltip(String)
|
||||||
|
controlP5.Controller : Chart removeBehavior()
|
||||||
|
controlP5.Controller : Chart removeCallback()
|
||||||
|
controlP5.Controller : Chart removeCallback(CallbackListener)
|
||||||
|
controlP5.Controller : Chart removeListener(ControlListener)
|
||||||
|
controlP5.Controller : Chart removeProperty(String)
|
||||||
|
controlP5.Controller : Chart removeProperty(String, String)
|
||||||
|
controlP5.Controller : Chart setArrayValue(float[])
|
||||||
|
controlP5.Controller : Chart setArrayValue(int, float)
|
||||||
|
controlP5.Controller : Chart setBehavior(ControlBehavior)
|
||||||
|
controlP5.Controller : Chart setBroadcast(boolean)
|
||||||
|
controlP5.Controller : Chart setCaptionLabel(String)
|
||||||
|
controlP5.Controller : Chart setColor(CColor)
|
||||||
|
controlP5.Controller : Chart setColorActive(int)
|
||||||
|
controlP5.Controller : Chart setColorBackground(int)
|
||||||
|
controlP5.Controller : Chart setColorCaptionLabel(int)
|
||||||
|
controlP5.Controller : Chart setColorForeground(int)
|
||||||
|
controlP5.Controller : Chart setColorValueLabel(int)
|
||||||
|
controlP5.Controller : Chart setDecimalPrecision(int)
|
||||||
|
controlP5.Controller : Chart setDefaultValue(float)
|
||||||
|
controlP5.Controller : Chart setHeight(int)
|
||||||
|
controlP5.Controller : Chart setId(int)
|
||||||
|
controlP5.Controller : Chart setImages(PImage, PImage, PImage)
|
||||||
|
controlP5.Controller : Chart setImages(PImage, PImage, PImage, PImage)
|
||||||
|
controlP5.Controller : Chart setLabelVisible(boolean)
|
||||||
|
controlP5.Controller : Chart setLock(boolean)
|
||||||
|
controlP5.Controller : Chart setMax(float)
|
||||||
|
controlP5.Controller : Chart setMin(float)
|
||||||
|
controlP5.Controller : Chart setMouseOver(boolean)
|
||||||
|
controlP5.Controller : Chart setMoveable(boolean)
|
||||||
|
controlP5.Controller : Chart setPosition(PVector)
|
||||||
|
controlP5.Controller : Chart setPosition(float, float)
|
||||||
|
controlP5.Controller : Chart setSize(PImage)
|
||||||
|
controlP5.Controller : Chart setSize(int, int)
|
||||||
|
controlP5.Controller : Chart setStringValue(String)
|
||||||
|
controlP5.Controller : Chart setUpdate(boolean)
|
||||||
|
controlP5.Controller : Chart setValueLabel(String)
|
||||||
|
controlP5.Controller : Chart setView(ControllerView)
|
||||||
|
controlP5.Controller : Chart setVisible(boolean)
|
||||||
|
controlP5.Controller : Chart setWidth(int)
|
||||||
|
controlP5.Controller : Chart show()
|
||||||
|
controlP5.Controller : Chart unlock()
|
||||||
|
controlP5.Controller : Chart unplugFrom(Object)
|
||||||
|
controlP5.Controller : Chart unplugFrom(Object[])
|
||||||
|
controlP5.Controller : Chart unregisterTooltip()
|
||||||
|
controlP5.Controller : Chart update()
|
||||||
|
controlP5.Controller : Chart updateSize()
|
||||||
|
controlP5.Controller : ControlBehavior getBehavior()
|
||||||
|
controlP5.Controller : ControlWindow getControlWindow()
|
||||||
|
controlP5.Controller : ControlWindow getWindow()
|
||||||
|
controlP5.Controller : ControllerProperty getProperty(String)
|
||||||
|
controlP5.Controller : ControllerProperty getProperty(String, String)
|
||||||
|
controlP5.Controller : Label getCaptionLabel()
|
||||||
|
controlP5.Controller : Label getValueLabel()
|
||||||
|
controlP5.Controller : List getControllerPlugList()
|
||||||
|
controlP5.Controller : PImage setImage(PImage)
|
||||||
|
controlP5.Controller : PImage setImage(PImage, int)
|
||||||
|
controlP5.Controller : PVector getAbsolutePosition()
|
||||||
|
controlP5.Controller : PVector getPosition()
|
||||||
|
controlP5.Controller : String getAddress()
|
||||||
|
controlP5.Controller : String getInfo()
|
||||||
|
controlP5.Controller : String getName()
|
||||||
|
controlP5.Controller : String getStringValue()
|
||||||
|
controlP5.Controller : String toString()
|
||||||
|
controlP5.Controller : Tab getTab()
|
||||||
|
controlP5.Controller : boolean isActive()
|
||||||
|
controlP5.Controller : boolean isBroadcast()
|
||||||
|
controlP5.Controller : boolean isInside()
|
||||||
|
controlP5.Controller : boolean isLabelVisible()
|
||||||
|
controlP5.Controller : boolean isListening()
|
||||||
|
controlP5.Controller : boolean isLock()
|
||||||
|
controlP5.Controller : boolean isMouseOver()
|
||||||
|
controlP5.Controller : boolean isMousePressed()
|
||||||
|
controlP5.Controller : boolean isMoveable()
|
||||||
|
controlP5.Controller : boolean isUpdate()
|
||||||
|
controlP5.Controller : boolean isVisible()
|
||||||
|
controlP5.Controller : float getArrayValue(int)
|
||||||
|
controlP5.Controller : float getDefaultValue()
|
||||||
|
controlP5.Controller : float getMax()
|
||||||
|
controlP5.Controller : float getMin()
|
||||||
|
controlP5.Controller : float getValue()
|
||||||
|
controlP5.Controller : float[] getArrayValue()
|
||||||
|
controlP5.Controller : int getDecimalPrecision()
|
||||||
|
controlP5.Controller : int getHeight()
|
||||||
|
controlP5.Controller : int getId()
|
||||||
|
controlP5.Controller : int getWidth()
|
||||||
|
controlP5.Controller : int listenerSize()
|
||||||
|
controlP5.Controller : void remove()
|
||||||
|
controlP5.Controller : void setView(ControllerView, int)
|
||||||
|
java.lang.Object : String toString()
|
||||||
|
java.lang.Object : boolean equals(Object)
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
227
examples/controllers/ControlP5checkBox/ControlP5checkBox.pde
Normal file
227
examples/controllers/ControlP5checkBox/ControlP5checkBox.pde
Normal file
@ -0,0 +1,227 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 Checkbox
|
||||||
|
* an example demonstrating the use of a checkbox in controlP5.
|
||||||
|
* CheckBox extends the RadioButton class.
|
||||||
|
* to control a checkbox use:
|
||||||
|
* activate(), deactivate(), activateAll(), deactivateAll(), toggle(), getState()
|
||||||
|
*
|
||||||
|
* find a list of public methods available for the Checkbox Controller
|
||||||
|
* at the bottom of this sketch's source code
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlP5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
CheckBox checkbox;
|
||||||
|
|
||||||
|
int myColorBackground;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(700, 400);
|
||||||
|
smooth();
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
checkbox = cp5.addCheckBox("checkBox")
|
||||||
|
.setPosition(100, 200)
|
||||||
|
.setSize(40, 40)
|
||||||
|
.setItemsPerRow(3)
|
||||||
|
.setSpacingColumn(30)
|
||||||
|
.setSpacingRow(20)
|
||||||
|
.addItem("0", 0)
|
||||||
|
.addItem("50", 50)
|
||||||
|
.addItem("100", 100)
|
||||||
|
.addItem("150", 150)
|
||||||
|
.addItem("200", 200)
|
||||||
|
.addItem("255", 255)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
void keyPressed() {
|
||||||
|
if (key==' ') {
|
||||||
|
checkbox.deactivateAll();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (int i=0;i<6;i++) {
|
||||||
|
// check if key 0-5 have been pressed and toggle
|
||||||
|
// the checkbox item accordingly.
|
||||||
|
if (keyCode==(48 + i)) {
|
||||||
|
// the index of checkbox items start at 0
|
||||||
|
checkbox.toggle(i);
|
||||||
|
println("toggle "+checkbox.getItem(i).getName());
|
||||||
|
// also see
|
||||||
|
// checkbox.activate(index);
|
||||||
|
// checkbox.deactivate(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(170);
|
||||||
|
pushMatrix();
|
||||||
|
translate(width/2 + 200, height/2);
|
||||||
|
stroke(255);
|
||||||
|
strokeWeight(2);
|
||||||
|
fill(myColorBackground);
|
||||||
|
ellipse(0,0,200,200);
|
||||||
|
popMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
void controlEvent(ControlEvent theEvent) {
|
||||||
|
if (theEvent.isFrom(checkbox)) {
|
||||||
|
myColorBackground = 0;
|
||||||
|
print("got an event from "+checkbox.getName()+"\t\n");
|
||||||
|
// checkbox uses arrayValue to store the state of
|
||||||
|
// individual checkbox-items. usage:
|
||||||
|
println(checkbox.getArrayValue());
|
||||||
|
int col = 0;
|
||||||
|
for (int i=0;i<checkbox.getArrayValue().length;i++) {
|
||||||
|
int n = (int)checkbox.getArrayValue()[i];
|
||||||
|
print(n);
|
||||||
|
if(n==1) {
|
||||||
|
myColorBackground += checkbox.getItem(i).internalValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
println();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkBox(float[] a) {
|
||||||
|
println(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
a list of all methods available for the CheckBox Controller
|
||||||
|
use ControlP5.printPublicMethodsFor(CheckBox.class);
|
||||||
|
to print the following list into the console.
|
||||||
|
|
||||||
|
You can find further details about class CheckBox in the javadoc.
|
||||||
|
|
||||||
|
Format:
|
||||||
|
ClassName : returnType methodName(parameter type)
|
||||||
|
|
||||||
|
|
||||||
|
controlP5.CheckBox : CheckBox addItem(String, float)
|
||||||
|
controlP5.CheckBox : CheckBox addItem(Toggle, float)
|
||||||
|
controlP5.CheckBox : CheckBox deactivateAll()
|
||||||
|
controlP5.CheckBox : CheckBox hideLabels()
|
||||||
|
controlP5.CheckBox : CheckBox removeItem(String)
|
||||||
|
controlP5.CheckBox : CheckBox setArrayValue(float[])
|
||||||
|
controlP5.CheckBox : CheckBox setColorLabels(int)
|
||||||
|
controlP5.CheckBox : CheckBox setImage(PImage)
|
||||||
|
controlP5.CheckBox : CheckBox setImage(PImage, int)
|
||||||
|
controlP5.CheckBox : CheckBox setImages(PImage, PImage, PImage)
|
||||||
|
controlP5.CheckBox : CheckBox setItemHeight(int)
|
||||||
|
controlP5.CheckBox : CheckBox setItemWidth(int)
|
||||||
|
controlP5.CheckBox : CheckBox setItemsPerRow(int)
|
||||||
|
controlP5.CheckBox : CheckBox setNoneSelectedAllowed(boolean)
|
||||||
|
controlP5.CheckBox : CheckBox setSize(PImage)
|
||||||
|
controlP5.CheckBox : CheckBox setSize(int, int)
|
||||||
|
controlP5.CheckBox : CheckBox setSpacingColumn(int)
|
||||||
|
controlP5.CheckBox : CheckBox setSpacingRow(int)
|
||||||
|
controlP5.CheckBox : CheckBox showLabels()
|
||||||
|
controlP5.CheckBox : String getInfo()
|
||||||
|
controlP5.CheckBox : String toString()
|
||||||
|
controlP5.CheckBox : Toggle getItem(int)
|
||||||
|
controlP5.CheckBox : List getItems()
|
||||||
|
controlP5.CheckBox : boolean getState(String)
|
||||||
|
controlP5.CheckBox : boolean getState(int)
|
||||||
|
controlP5.CheckBox : void updateLayout()
|
||||||
|
controlP5.ControlGroup : CheckBox activateEvent(boolean)
|
||||||
|
controlP5.ControlGroup : CheckBox addListener(ControlListener)
|
||||||
|
controlP5.ControlGroup : CheckBox hideBar()
|
||||||
|
controlP5.ControlGroup : CheckBox removeListener(ControlListener)
|
||||||
|
controlP5.ControlGroup : CheckBox setBackgroundColor(int)
|
||||||
|
controlP5.ControlGroup : CheckBox setBackgroundHeight(int)
|
||||||
|
controlP5.ControlGroup : CheckBox setBarHeight(int)
|
||||||
|
controlP5.ControlGroup : CheckBox showBar()
|
||||||
|
controlP5.ControlGroup : CheckBox updateInternalEvents(PApplet)
|
||||||
|
controlP5.ControlGroup : String getInfo()
|
||||||
|
controlP5.ControlGroup : String toString()
|
||||||
|
controlP5.ControlGroup : boolean isBarVisible()
|
||||||
|
controlP5.ControlGroup : int getBackgroundHeight()
|
||||||
|
controlP5.ControlGroup : int getBarHeight()
|
||||||
|
controlP5.ControlGroup : int listenerSize()
|
||||||
|
controlP5.ControllerGroup : CColor getColor()
|
||||||
|
controlP5.ControllerGroup : CheckBox add(ControllerInterface)
|
||||||
|
controlP5.ControllerGroup : CheckBox bringToFront()
|
||||||
|
controlP5.ControllerGroup : CheckBox bringToFront(ControllerInterface)
|
||||||
|
controlP5.ControllerGroup : CheckBox close()
|
||||||
|
controlP5.ControllerGroup : CheckBox disableCollapse()
|
||||||
|
controlP5.ControllerGroup : CheckBox enableCollapse()
|
||||||
|
controlP5.ControllerGroup : CheckBox hide()
|
||||||
|
controlP5.ControllerGroup : CheckBox moveTo(ControlWindow)
|
||||||
|
controlP5.ControllerGroup : CheckBox moveTo(PApplet)
|
||||||
|
controlP5.ControllerGroup : CheckBox open()
|
||||||
|
controlP5.ControllerGroup : CheckBox registerProperty(String)
|
||||||
|
controlP5.ControllerGroup : CheckBox registerProperty(String, String)
|
||||||
|
controlP5.ControllerGroup : CheckBox remove(CDrawable)
|
||||||
|
controlP5.ControllerGroup : CheckBox remove(ControllerInterface)
|
||||||
|
controlP5.ControllerGroup : CheckBox removeCanvas(ControlWindowCanvas)
|
||||||
|
controlP5.ControllerGroup : CheckBox removeProperty(String)
|
||||||
|
controlP5.ControllerGroup : CheckBox removeProperty(String, String)
|
||||||
|
controlP5.ControllerGroup : CheckBox setAddress(String)
|
||||||
|
controlP5.ControllerGroup : CheckBox setArrayValue(float[])
|
||||||
|
controlP5.ControllerGroup : CheckBox setColor(CColor)
|
||||||
|
controlP5.ControllerGroup : CheckBox setColorActive(int)
|
||||||
|
controlP5.ControllerGroup : CheckBox setColorBackground(int)
|
||||||
|
controlP5.ControllerGroup : CheckBox setColorForeground(int)
|
||||||
|
controlP5.ControllerGroup : CheckBox setColorLabel(int)
|
||||||
|
controlP5.ControllerGroup : CheckBox setColorValue(int)
|
||||||
|
controlP5.ControllerGroup : CheckBox setHeight(int)
|
||||||
|
controlP5.ControllerGroup : CheckBox setId(int)
|
||||||
|
controlP5.ControllerGroup : CheckBox setLabel(String)
|
||||||
|
controlP5.ControllerGroup : CheckBox setMouseOver(boolean)
|
||||||
|
controlP5.ControllerGroup : CheckBox setMoveable(boolean)
|
||||||
|
controlP5.ControllerGroup : CheckBox setOpen(boolean)
|
||||||
|
controlP5.ControllerGroup : CheckBox setPosition(PVector)
|
||||||
|
controlP5.ControllerGroup : CheckBox setPosition(float, float)
|
||||||
|
controlP5.ControllerGroup : CheckBox setStringValue(String)
|
||||||
|
controlP5.ControllerGroup : CheckBox setUpdate(boolean)
|
||||||
|
controlP5.ControllerGroup : CheckBox setValue(float)
|
||||||
|
controlP5.ControllerGroup : CheckBox setVisible(boolean)
|
||||||
|
controlP5.ControllerGroup : CheckBox setWidth(int)
|
||||||
|
controlP5.ControllerGroup : CheckBox show()
|
||||||
|
controlP5.ControllerGroup : CheckBox update()
|
||||||
|
controlP5.ControllerGroup : CheckBox updateAbsolutePosition()
|
||||||
|
controlP5.ControllerGroup : ControlWindow getWindow()
|
||||||
|
controlP5.ControllerGroup : ControlWindowCanvas addCanvas(ControlWindowCanvas)
|
||||||
|
controlP5.ControllerGroup : Controller getController(String)
|
||||||
|
controlP5.ControllerGroup : ControllerProperty getProperty(String)
|
||||||
|
controlP5.ControllerGroup : ControllerProperty getProperty(String, String)
|
||||||
|
controlP5.ControllerGroup : Label getCaptionLabel()
|
||||||
|
controlP5.ControllerGroup : Label getValueLabel()
|
||||||
|
controlP5.ControllerGroup : PVector getPosition()
|
||||||
|
controlP5.ControllerGroup : String getAddress()
|
||||||
|
controlP5.ControllerGroup : String getInfo()
|
||||||
|
controlP5.ControllerGroup : String getName()
|
||||||
|
controlP5.ControllerGroup : String getStringValue()
|
||||||
|
controlP5.ControllerGroup : String toString()
|
||||||
|
controlP5.ControllerGroup : Tab getTab()
|
||||||
|
controlP5.ControllerGroup : boolean isCollapse()
|
||||||
|
controlP5.ControllerGroup : boolean isMouseOver()
|
||||||
|
controlP5.ControllerGroup : boolean isMoveable()
|
||||||
|
controlP5.ControllerGroup : boolean isOpen()
|
||||||
|
controlP5.ControllerGroup : boolean isUpdate()
|
||||||
|
controlP5.ControllerGroup : boolean isVisible()
|
||||||
|
controlP5.ControllerGroup : boolean setMousePressed(boolean)
|
||||||
|
controlP5.ControllerGroup : float getValue()
|
||||||
|
controlP5.ControllerGroup : float[] getArrayValue()
|
||||||
|
controlP5.ControllerGroup : int getHeight()
|
||||||
|
controlP5.ControllerGroup : int getId()
|
||||||
|
controlP5.ControllerGroup : int getWidth()
|
||||||
|
controlP5.ControllerGroup : void remove()
|
||||||
|
java.lang.Object : String toString()
|
||||||
|
java.lang.Object : boolean equals(Object)
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,175 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 Color picker. a simple color picker,
|
||||||
|
* 4 horizontal sliders controlling the RGBA channels of a color.
|
||||||
|
* to grab the current color value, use function getColorValue() of
|
||||||
|
* the color picker.
|
||||||
|
*
|
||||||
|
* find a list of public methods available for the ColorPicker Controller
|
||||||
|
* at the bottom of this sketch's source code
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlP5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
ColorPicker cp;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400, 600);
|
||||||
|
noStroke();
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
cp = cp5.addColorPicker("picker")
|
||||||
|
.setPosition(60, 100)
|
||||||
|
.setColorValue(color(255, 128, 0, 128))
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(cp.getColorValue());
|
||||||
|
fill(0, 80);
|
||||||
|
rect(50, 90, 275, 80);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void controlEvent(ControlEvent c) {
|
||||||
|
// when a value change from a ColorPicker is received, extract the ARGB values
|
||||||
|
// from the controller's array value
|
||||||
|
if(c.isFrom(cp)) {
|
||||||
|
int r = int(c.getArrayValue(0));
|
||||||
|
int g = int(c.getArrayValue(1));
|
||||||
|
int b = int(c.getArrayValue(2));
|
||||||
|
int a = int(c.getArrayValue(3));
|
||||||
|
color col = color(r,g,b,a);
|
||||||
|
println("event\talpha:"+a+"\tred:"+r+"\tgreen:"+g+"\tblue:"+b+"\tcol"+col);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// color information from ColorPicker 'picker' are forwarded to the picker(int) function
|
||||||
|
void picker(int col) {
|
||||||
|
println("picker\talpha:"+alpha(col)+"\tred:"+red(col)+"\tgreen:"+green(col)+"\tblue:"+blue(col)+"\tcol"+col);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void keyPressed() {
|
||||||
|
switch(key) {
|
||||||
|
case('1'):
|
||||||
|
// method A to change color
|
||||||
|
cp.setArrayValue(new float[] {120, 0, 120, 255});
|
||||||
|
break;
|
||||||
|
case('2'):
|
||||||
|
// method B to change color
|
||||||
|
cp.setColorValue(color(255, 0, 0, 255));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
a list of all methods available for the ColorPicker Controller
|
||||||
|
use ControlP5.printPublicMethodsFor(ColorPicker.class);
|
||||||
|
to print the following list into the console.
|
||||||
|
|
||||||
|
You can find further details about class ColorPicker in the javadoc.
|
||||||
|
|
||||||
|
Format:
|
||||||
|
ClassName : returnType methodName(parameter type)
|
||||||
|
|
||||||
|
|
||||||
|
controlP5.ColorPicker : ColorPicker setArrayValue(float[])
|
||||||
|
controlP5.ColorPicker : ColorPicker setColorValue(int)
|
||||||
|
controlP5.ColorPicker : String getInfo()
|
||||||
|
controlP5.ColorPicker : int getColorValue()
|
||||||
|
controlP5.ControlGroup : ColorPicker activateEvent(boolean)
|
||||||
|
controlP5.ControlGroup : ColorPicker addListener(ControlListener)
|
||||||
|
controlP5.ControlGroup : ColorPicker hideBar()
|
||||||
|
controlP5.ControlGroup : ColorPicker removeListener(ControlListener)
|
||||||
|
controlP5.ControlGroup : ColorPicker setBackgroundColor(int)
|
||||||
|
controlP5.ControlGroup : ColorPicker setBackgroundHeight(int)
|
||||||
|
controlP5.ControlGroup : ColorPicker setBarHeight(int)
|
||||||
|
controlP5.ControlGroup : ColorPicker showBar()
|
||||||
|
controlP5.ControlGroup : ColorPicker updateInternalEvents(PApplet)
|
||||||
|
controlP5.ControlGroup : String getInfo()
|
||||||
|
controlP5.ControlGroup : String toString()
|
||||||
|
controlP5.ControlGroup : boolean isBarVisible()
|
||||||
|
controlP5.ControlGroup : int getBackgroundHeight()
|
||||||
|
controlP5.ControlGroup : int getBarHeight()
|
||||||
|
controlP5.ControlGroup : int listenerSize()
|
||||||
|
controlP5.ControllerGroup : CColor getColor()
|
||||||
|
controlP5.ControllerGroup : ColorPicker add(ControllerInterface)
|
||||||
|
controlP5.ControllerGroup : ColorPicker bringToFront()
|
||||||
|
controlP5.ControllerGroup : ColorPicker bringToFront(ControllerInterface)
|
||||||
|
controlP5.ControllerGroup : ColorPicker close()
|
||||||
|
controlP5.ControllerGroup : ColorPicker disableCollapse()
|
||||||
|
controlP5.ControllerGroup : ColorPicker enableCollapse()
|
||||||
|
controlP5.ControllerGroup : ColorPicker hide()
|
||||||
|
controlP5.ControllerGroup : ColorPicker moveTo(ControlWindow)
|
||||||
|
controlP5.ControllerGroup : ColorPicker moveTo(PApplet)
|
||||||
|
controlP5.ControllerGroup : ColorPicker open()
|
||||||
|
controlP5.ControllerGroup : ColorPicker registerProperty(String)
|
||||||
|
controlP5.ControllerGroup : ColorPicker registerProperty(String, String)
|
||||||
|
controlP5.ControllerGroup : ColorPicker remove(CDrawable)
|
||||||
|
controlP5.ControllerGroup : ColorPicker remove(ControllerInterface)
|
||||||
|
controlP5.ControllerGroup : ColorPicker removeCanvas(ControlWindowCanvas)
|
||||||
|
controlP5.ControllerGroup : ColorPicker removeProperty(String)
|
||||||
|
controlP5.ControllerGroup : ColorPicker removeProperty(String, String)
|
||||||
|
controlP5.ControllerGroup : ColorPicker setAddress(String)
|
||||||
|
controlP5.ControllerGroup : ColorPicker setArrayValue(float[])
|
||||||
|
controlP5.ControllerGroup : ColorPicker setColor(CColor)
|
||||||
|
controlP5.ControllerGroup : ColorPicker setColorActive(int)
|
||||||
|
controlP5.ControllerGroup : ColorPicker setColorBackground(int)
|
||||||
|
controlP5.ControllerGroup : ColorPicker setColorForeground(int)
|
||||||
|
controlP5.ControllerGroup : ColorPicker setColorLabel(int)
|
||||||
|
controlP5.ControllerGroup : ColorPicker setColorValue(int)
|
||||||
|
controlP5.ControllerGroup : ColorPicker setHeight(int)
|
||||||
|
controlP5.ControllerGroup : ColorPicker setId(int)
|
||||||
|
controlP5.ControllerGroup : ColorPicker setLabel(String)
|
||||||
|
controlP5.ControllerGroup : ColorPicker setMouseOver(boolean)
|
||||||
|
controlP5.ControllerGroup : ColorPicker setMoveable(boolean)
|
||||||
|
controlP5.ControllerGroup : ColorPicker setOpen(boolean)
|
||||||
|
controlP5.ControllerGroup : ColorPicker setPosition(PVector)
|
||||||
|
controlP5.ControllerGroup : ColorPicker setPosition(float, float)
|
||||||
|
controlP5.ControllerGroup : ColorPicker setStringValue(String)
|
||||||
|
controlP5.ControllerGroup : ColorPicker setUpdate(boolean)
|
||||||
|
controlP5.ControllerGroup : ColorPicker setValue(float)
|
||||||
|
controlP5.ControllerGroup : ColorPicker setVisible(boolean)
|
||||||
|
controlP5.ControllerGroup : ColorPicker setWidth(int)
|
||||||
|
controlP5.ControllerGroup : ColorPicker show()
|
||||||
|
controlP5.ControllerGroup : ColorPicker update()
|
||||||
|
controlP5.ControllerGroup : ColorPicker updateAbsolutePosition()
|
||||||
|
controlP5.ControllerGroup : ControlWindow getWindow()
|
||||||
|
controlP5.ControllerGroup : ControlWindowCanvas addCanvas(ControlWindowCanvas)
|
||||||
|
controlP5.ControllerGroup : Controller getController(String)
|
||||||
|
controlP5.ControllerGroup : ControllerProperty getProperty(String)
|
||||||
|
controlP5.ControllerGroup : ControllerProperty getProperty(String, String)
|
||||||
|
controlP5.ControllerGroup : Label getCaptionLabel()
|
||||||
|
controlP5.ControllerGroup : Label getValueLabel()
|
||||||
|
controlP5.ControllerGroup : PVector getPosition()
|
||||||
|
controlP5.ControllerGroup : String getAddress()
|
||||||
|
controlP5.ControllerGroup : String getInfo()
|
||||||
|
controlP5.ControllerGroup : String getName()
|
||||||
|
controlP5.ControllerGroup : String getStringValue()
|
||||||
|
controlP5.ControllerGroup : String toString()
|
||||||
|
controlP5.ControllerGroup : Tab getTab()
|
||||||
|
controlP5.ControllerGroup : boolean isCollapse()
|
||||||
|
controlP5.ControllerGroup : boolean isMouseOver()
|
||||||
|
controlP5.ControllerGroup : boolean isMoveable()
|
||||||
|
controlP5.ControllerGroup : boolean isOpen()
|
||||||
|
controlP5.ControllerGroup : boolean isUpdate()
|
||||||
|
controlP5.ControllerGroup : boolean isVisible()
|
||||||
|
controlP5.ControllerGroup : boolean setMousePressed(boolean)
|
||||||
|
controlP5.ControllerGroup : float getValue()
|
||||||
|
controlP5.ControllerGroup : float[] getArrayValue()
|
||||||
|
controlP5.ControllerGroup : int getHeight()
|
||||||
|
controlP5.ControllerGroup : int getId()
|
||||||
|
controlP5.ControllerGroup : int getWidth()
|
||||||
|
controlP5.ControllerGroup : void remove()
|
||||||
|
java.lang.Object : String toString()
|
||||||
|
java.lang.Object : boolean equals(Object)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
@ -0,0 +1,272 @@
|
|||||||
|
/**
|
||||||
|
* Control5 DropdownList
|
||||||
|
* A dropdownList controller, extends the ListBox controller.
|
||||||
|
* the most recently selected dropdownlist item is displayed inside
|
||||||
|
* the menu bar of the DropdownList.
|
||||||
|
*
|
||||||
|
* find a list of public methods available for the DropdownList Controller
|
||||||
|
* at the bottom of this sketch's source code
|
||||||
|
*
|
||||||
|
* DEPRECATED, use ScrollableList instead.
|
||||||
|
*
|
||||||
|
* by andreas schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
DropdownList d1, d2;
|
||||||
|
|
||||||
|
int cnt = 0;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(700, 400 );
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
|
||||||
|
// DropdownList is DEPRECATED,
|
||||||
|
// use ScrollableList instead,
|
||||||
|
// see example ControlP5scrollableList
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// create a DropdownList,
|
||||||
|
d1 = cp5.addDropdownList("myList-d1")
|
||||||
|
.setPosition(100, 100)
|
||||||
|
;
|
||||||
|
|
||||||
|
customize(d1); // customize the first list
|
||||||
|
|
||||||
|
// create a second DropdownList
|
||||||
|
d2 = cp5.addDropdownList("myList-d2")
|
||||||
|
.setPosition(400, 100)
|
||||||
|
.setSize(200,200)
|
||||||
|
;
|
||||||
|
|
||||||
|
customize(d2); // customize the second list
|
||||||
|
d2.setIndex(10);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void customize(DropdownList ddl) {
|
||||||
|
// a convenience function to customize a DropdownList
|
||||||
|
ddl.setBackgroundColor(color(190));
|
||||||
|
ddl.setItemHeight(20);
|
||||||
|
ddl.setBarHeight(15);
|
||||||
|
ddl.getCaptionLabel().set("dropdown");
|
||||||
|
ddl.getCaptionLabel().style().marginTop = 3;
|
||||||
|
ddl.getCaptionLabel().style().marginLeft = 3;
|
||||||
|
ddl.getValueLabel().style().marginTop = 3;
|
||||||
|
for (int i=0;i<40;i++) {
|
||||||
|
ddl.addItem("item "+i, i);
|
||||||
|
}
|
||||||
|
//ddl.scroll(0);
|
||||||
|
ddl.setColorBackground(color(60));
|
||||||
|
ddl.setColorActive(color(255, 128));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void keyPressed() {
|
||||||
|
// some key events to change the properties of DropdownList d1
|
||||||
|
if (key=='1') {
|
||||||
|
// set the height of a pulldown menu, should always be a multiple of itemHeight
|
||||||
|
d1.setHeight(210);
|
||||||
|
}
|
||||||
|
else if (key=='2') {
|
||||||
|
// set the height of a pulldown menu, should always be a multiple of itemHeight
|
||||||
|
d1.setHeight(120);
|
||||||
|
}
|
||||||
|
else if (key=='3') {
|
||||||
|
// set the height of a pulldown menu item, should always be a fraction of the pulldown menu
|
||||||
|
d1.setItemHeight(30);
|
||||||
|
}
|
||||||
|
else if (key=='4') {
|
||||||
|
// set the height of a pulldown menu item, should always be a fraction of the pulldown menu
|
||||||
|
d1.setItemHeight(12);
|
||||||
|
d1.setBackgroundColor(color(255));
|
||||||
|
}
|
||||||
|
else if (key=='5') {
|
||||||
|
// add new items to the pulldown menu
|
||||||
|
int n = (int)(random(100000));
|
||||||
|
d1.addItem("item "+n, n);
|
||||||
|
}
|
||||||
|
else if (key=='6') {
|
||||||
|
// remove items from the pulldown menu by name
|
||||||
|
d1.removeItem("item "+cnt);
|
||||||
|
cnt++;
|
||||||
|
}
|
||||||
|
else if (key=='7') {
|
||||||
|
d1.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void controlEvent(ControlEvent theEvent) {
|
||||||
|
// DropdownList is of type ControlGroup.
|
||||||
|
// A controlEvent will be triggered from inside the ControlGroup class.
|
||||||
|
// therefore you need to check the originator of the Event with
|
||||||
|
// if (theEvent.isGroup())
|
||||||
|
// to avoid an error message thrown by controlP5.
|
||||||
|
|
||||||
|
if (theEvent.isGroup()) {
|
||||||
|
// check if the Event was triggered from a ControlGroup
|
||||||
|
println("event from group : "+theEvent.getGroup().getValue()+" from "+theEvent.getGroup());
|
||||||
|
}
|
||||||
|
else if (theEvent.isController()) {
|
||||||
|
println("event from controller : "+theEvent.getController().getValue()+" from "+theEvent.getController());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(128);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
a list of all methods available for the DropdownList Controller
|
||||||
|
use ControlP5.printPublicMethodsFor(DropdownList.class);
|
||||||
|
to print the following list into the console.
|
||||||
|
|
||||||
|
You can find further details about DropdownList in the javadoc.
|
||||||
|
|
||||||
|
Format: returnType methodName(parameterType)
|
||||||
|
|
||||||
|
controlP5.DropdownList : ControllerGroup setValue(float)
|
||||||
|
controlP5.DropdownList : float getValue()
|
||||||
|
controlP5.ListBox : ControllerInterface setColorActive(int)
|
||||||
|
controlP5.ListBox : ControllerInterface setColorBackground(int)
|
||||||
|
controlP5.ListBox : ControllerInterface setColorForeground(int)
|
||||||
|
controlP5.ListBox : ControllerInterface setColorLabel(int)
|
||||||
|
controlP5.ListBox : ControllerInterface setColorValue(int)
|
||||||
|
controlP5.ListBox : ListBox setHeight(int)
|
||||||
|
controlP5.ListBox : ListBox setWidth(int)
|
||||||
|
controlP5.ListBox : ListBox toUpperCase(boolean)
|
||||||
|
controlP5.ListBox : ListBoxItem addItem(String, int)
|
||||||
|
controlP5.ListBox : ListBoxItem item(Controller)
|
||||||
|
controlP5.ListBox : ListBoxItem item(String)
|
||||||
|
controlP5.ListBox : ListBoxItem item(int)
|
||||||
|
controlP5.ListBox : String[][] getListBoxItems()
|
||||||
|
controlP5.ListBox : boolean isScrollbarVisible()
|
||||||
|
controlP5.ListBox : float getScrollPosition()
|
||||||
|
controlP5.ListBox : void actAsPulldownMenu(boolean)
|
||||||
|
controlP5.ListBox : void addItems(List)
|
||||||
|
controlP5.ListBox : void addItems(List, int)
|
||||||
|
controlP5.ListBox : void addItems(String[])
|
||||||
|
controlP5.ListBox : void clear()
|
||||||
|
controlP5.ListBox : void controlEvent(ControlEvent)
|
||||||
|
controlP5.ListBox : void hideScrollbar()
|
||||||
|
controlP5.ListBox : void keyEvent(KeyEvent)
|
||||||
|
controlP5.ListBox : void removeItem(String)
|
||||||
|
controlP5.ListBox : void scroll(float)
|
||||||
|
controlP5.ListBox : void scrolled(int)
|
||||||
|
controlP5.ListBox : void setItemHeight(int)
|
||||||
|
controlP5.ListBox : void setListBoxItems(String[][])
|
||||||
|
controlP5.ListBox : void showScrollbar()
|
||||||
|
controlP5.ListBox : void updateListBoxItems()
|
||||||
|
controlP5.ControlGroup : ControlGroup activateEvent(boolean)
|
||||||
|
controlP5.ControlGroup : String info()
|
||||||
|
controlP5.ControlGroup : String stringValue()
|
||||||
|
controlP5.ControlGroup : String toString()
|
||||||
|
controlP5.ControlGroup : boolean isBarVisible()
|
||||||
|
controlP5.ControlGroup : int getBackgroundHeight()
|
||||||
|
controlP5.ControlGroup : int getBarHeight()
|
||||||
|
controlP5.ControlGroup : int listenerSize()
|
||||||
|
controlP5.ControlGroup : void addCloseButton()
|
||||||
|
controlP5.ControlGroup : void addListener(ControlListener)
|
||||||
|
controlP5.ControlGroup : void controlEvent(ControlEvent)
|
||||||
|
controlP5.ControlGroup : void hideBar()
|
||||||
|
controlP5.ControlGroup : void mousePressed()
|
||||||
|
controlP5.ControlGroup : void removeCloseButton()
|
||||||
|
controlP5.ControlGroup : void removeListener(ControlListener)
|
||||||
|
controlP5.ControlGroup : void setBackgroundColor(int)
|
||||||
|
controlP5.ControlGroup : void setBackgroundHeight(int)
|
||||||
|
controlP5.ControlGroup : void setBarHeight(int)
|
||||||
|
controlP5.ControlGroup : void showBar()
|
||||||
|
controlP5.ControllerGroup : CColor getColor()
|
||||||
|
controlP5.ControllerGroup : ControlWindow getWindow()
|
||||||
|
controlP5.ControllerGroup : ControlWindowCanvas addCanvas(ControlWindowCanvas)
|
||||||
|
controlP5.ControllerGroup : Controller getController(String)
|
||||||
|
controlP5.ControllerGroup : ControllerGroup setHeight(int)
|
||||||
|
controlP5.ControllerGroup : ControllerGroup setValue(float)
|
||||||
|
controlP5.ControllerGroup : ControllerGroup setWidth(int)
|
||||||
|
controlP5.ControllerGroup : ControllerInterface add(ControllerInterface)
|
||||||
|
controlP5.ControllerGroup : ControllerInterface hide()
|
||||||
|
controlP5.ControllerGroup : ControllerInterface moveTo(ControlGroup, Tab, ControlWindow)
|
||||||
|
controlP5.ControllerGroup : ControllerInterface registerProperty(String)
|
||||||
|
controlP5.ControllerGroup : ControllerInterface registerProperty(String, String)
|
||||||
|
controlP5.ControllerGroup : ControllerInterface remove(ControllerInterface)
|
||||||
|
controlP5.ControllerGroup : ControllerInterface removeProperty(String)
|
||||||
|
controlP5.ControllerGroup : ControllerInterface removeProperty(String, String)
|
||||||
|
controlP5.ControllerGroup : ControllerInterface setColor(CColor)
|
||||||
|
controlP5.ControllerGroup : ControllerInterface setColorActive(int)
|
||||||
|
controlP5.ControllerGroup : ControllerInterface setColorBackground(int)
|
||||||
|
controlP5.ControllerGroup : ControllerInterface setColorForeground(int)
|
||||||
|
controlP5.ControllerGroup : ControllerInterface setColorLabel(int)
|
||||||
|
controlP5.ControllerGroup : ControllerInterface setColorValue(int)
|
||||||
|
controlP5.ControllerGroup : ControllerInterface setId(int)
|
||||||
|
controlP5.ControllerGroup : ControllerInterface setLabel(String)
|
||||||
|
controlP5.ControllerGroup : ControllerInterface show()
|
||||||
|
controlP5.ControllerGroup : ControllerProperty getProperty(String)
|
||||||
|
controlP5.ControllerGroup : ControllerProperty getProperty(String, String)
|
||||||
|
controlP5.ControllerGroup : Label captionLabel()
|
||||||
|
controlP5.ControllerGroup : Label valueLabel()
|
||||||
|
controlP5.ControllerGroup : PVector getAbsolutePosition()
|
||||||
|
controlP5.ControllerGroup : PVector getPosition()
|
||||||
|
controlP5.ControllerGroup : String getName()
|
||||||
|
controlP5.ControllerGroup : String getStringValue()
|
||||||
|
controlP5.ControllerGroup : String info()
|
||||||
|
controlP5.ControllerGroup : String toString()
|
||||||
|
controlP5.ControllerGroup : Tab getTab()
|
||||||
|
controlP5.ControllerGroup : boolean isCollapse()
|
||||||
|
controlP5.ControllerGroup : boolean isMoveable()
|
||||||
|
controlP5.ControllerGroup : boolean isOpen()
|
||||||
|
controlP5.ControllerGroup : boolean isUpdate()
|
||||||
|
controlP5.ControllerGroup : boolean isVisible()
|
||||||
|
controlP5.ControllerGroup : boolean setMousePressed(boolean)
|
||||||
|
controlP5.ControllerGroup : float getValue()
|
||||||
|
controlP5.ControllerGroup : float[] getArrayValue()
|
||||||
|
controlP5.ControllerGroup : int getHeight()
|
||||||
|
controlP5.ControllerGroup : int getId()
|
||||||
|
controlP5.ControllerGroup : int getWidth()
|
||||||
|
controlP5.ControllerGroup : void close()
|
||||||
|
controlP5.ControllerGroup : void disableCollapse()
|
||||||
|
controlP5.ControllerGroup : void enableCollapse()
|
||||||
|
controlP5.ControllerGroup : void moveTo(ControlGroup)
|
||||||
|
controlP5.ControllerGroup : void moveTo(ControlWindow)
|
||||||
|
controlP5.ControllerGroup : void moveTo(ControlWindow, String)
|
||||||
|
controlP5.ControllerGroup : void moveTo(String)
|
||||||
|
controlP5.ControllerGroup : void moveTo(String, ControlWindow)
|
||||||
|
controlP5.ControllerGroup : void moveTo(Tab)
|
||||||
|
controlP5.ControllerGroup : void moveTo(Tab, ControlWindow)
|
||||||
|
controlP5.ControllerGroup : void open()
|
||||||
|
controlP5.ControllerGroup : void remove()
|
||||||
|
controlP5.ControllerGroup : void remove(CDrawable)
|
||||||
|
controlP5.ControllerGroup : void removeCanvas(ControlWindowCanvas)
|
||||||
|
controlP5.ControllerGroup : void setAbsolutePosition(PVector)
|
||||||
|
controlP5.ControllerGroup : void setArrayValue(float[])
|
||||||
|
controlP5.ControllerGroup : void setGroup(ControllerGroup)
|
||||||
|
controlP5.ControllerGroup : void setGroup(String)
|
||||||
|
controlP5.ControllerGroup : void setMoveable(boolean)
|
||||||
|
controlP5.ControllerGroup : void setOpen(boolean)
|
||||||
|
controlP5.ControllerGroup : void setPosition(PVector)
|
||||||
|
controlP5.ControllerGroup : void setPosition(float, float)
|
||||||
|
controlP5.ControllerGroup : void setTab(ControlWindow, String)
|
||||||
|
controlP5.ControllerGroup : void setTab(String)
|
||||||
|
controlP5.ControllerGroup : void setTab(Tab)
|
||||||
|
controlP5.ControllerGroup : void setUpdate(boolean)
|
||||||
|
controlP5.ControllerGroup : void setVisible(boolean)
|
||||||
|
controlP5.ControllerGroup : void update()
|
||||||
|
controlP5.ControllerGroup : void updateAbsolutePosition()
|
||||||
|
java.lang.Object : String toString()
|
||||||
|
java.lang.Object : boolean equals(Object)
|
||||||
|
*/
|
223
examples/controllers/ControlP5group/ControlP5group.pde
Normal file
223
examples/controllers/ControlP5group/ControlP5group.pde
Normal file
@ -0,0 +1,223 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 Group
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* find a list of public methods available for the Group Controller
|
||||||
|
* at the bottom of this sketch.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(800,400);
|
||||||
|
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
|
||||||
|
Group g1 = cp5.addGroup("g1")
|
||||||
|
.setPosition(100,100)
|
||||||
|
.setBackgroundHeight(100)
|
||||||
|
.setBackgroundColor(color(255,50))
|
||||||
|
;
|
||||||
|
|
||||||
|
cp5.addBang("A-1")
|
||||||
|
.setPosition(10,20)
|
||||||
|
.setSize(80,20)
|
||||||
|
.setGroup(g1)
|
||||||
|
;
|
||||||
|
|
||||||
|
cp5.addBang("A-2")
|
||||||
|
.setPosition(10,60)
|
||||||
|
.setSize(80,20)
|
||||||
|
.setGroup(g1)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
Group g2 = cp5.addGroup("g2")
|
||||||
|
.setPosition(250,100)
|
||||||
|
.setWidth(300)
|
||||||
|
.activateEvent(true)
|
||||||
|
.setBackgroundColor(color(255,80))
|
||||||
|
.setBackgroundHeight(100)
|
||||||
|
.setLabel("Hello World.")
|
||||||
|
;
|
||||||
|
|
||||||
|
cp5.addSlider("S-1")
|
||||||
|
.setPosition(80,10)
|
||||||
|
.setSize(180,9)
|
||||||
|
.setGroup(g2)
|
||||||
|
;
|
||||||
|
|
||||||
|
cp5.addSlider("S-2")
|
||||||
|
.setPosition(80,20)
|
||||||
|
.setSize(180,9)
|
||||||
|
.setGroup(g2)
|
||||||
|
;
|
||||||
|
|
||||||
|
cp5.addRadioButton("radio")
|
||||||
|
.setPosition(10,10)
|
||||||
|
.setSize(20,9)
|
||||||
|
.addItem("black",0)
|
||||||
|
.addItem("red",1)
|
||||||
|
.addItem("green",2)
|
||||||
|
.addItem("blue",3)
|
||||||
|
.addItem("grey",4)
|
||||||
|
.setGroup(g2)
|
||||||
|
;
|
||||||
|
|
||||||
|
Group g3 = cp5.addGroup("g3")
|
||||||
|
.setPosition(600,100)
|
||||||
|
.setSize(150,200)
|
||||||
|
.setBackgroundColor(color(255,100))
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
cp5.addScrollableList("list")
|
||||||
|
.setPosition(10,10)
|
||||||
|
.setSize(130,100)
|
||||||
|
.setGroup(g3)
|
||||||
|
.addItems(java.util.Arrays.asList("a","b","c","d","e","f","g"))
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void controlEvent(ControlEvent theEvent) {
|
||||||
|
if(theEvent.isGroup()) {
|
||||||
|
println("got an event from group "
|
||||||
|
+theEvent.getGroup().getName()
|
||||||
|
+", isOpen? "+theEvent.getGroup().isOpen()
|
||||||
|
);
|
||||||
|
|
||||||
|
} else if (theEvent.isController()){
|
||||||
|
println("got something from a controller "
|
||||||
|
+theEvent.getController().getName()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void keyPressed() {
|
||||||
|
if(key==' ') {
|
||||||
|
if(cp5.getGroup("g1")!=null) {
|
||||||
|
cp5.getGroup("g1").remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
a list of all methods available for the Group Controller
|
||||||
|
use ControlP5.printPublicMethodsFor(Group.class);
|
||||||
|
to print the following list into the console.
|
||||||
|
|
||||||
|
You can find further details about class Group in the javadoc.
|
||||||
|
|
||||||
|
Format:
|
||||||
|
ClassName : returnType methodName(parameter type)
|
||||||
|
|
||||||
|
|
||||||
|
controlP5.ControlGroup : Group activateEvent(boolean)
|
||||||
|
controlP5.ControlGroup : Group addListener(ControlListener)
|
||||||
|
controlP5.ControlGroup : Group hideBar()
|
||||||
|
controlP5.ControlGroup : Group removeListener(ControlListener)
|
||||||
|
controlP5.ControlGroup : Group setBackgroundColor(int)
|
||||||
|
controlP5.ControlGroup : Group setBackgroundHeight(int)
|
||||||
|
controlP5.ControlGroup : Group setBarHeight(int)
|
||||||
|
controlP5.ControlGroup : Group showBar()
|
||||||
|
controlP5.ControlGroup : Group updateInternalEvents(PApplet)
|
||||||
|
controlP5.ControlGroup : String getInfo()
|
||||||
|
controlP5.ControlGroup : String toString()
|
||||||
|
controlP5.ControlGroup : boolean isBarVisible()
|
||||||
|
controlP5.ControlGroup : int getBackgroundHeight()
|
||||||
|
controlP5.ControlGroup : int getBarHeight()
|
||||||
|
controlP5.ControlGroup : int listenerSize()
|
||||||
|
controlP5.ControllerGroup : CColor getColor()
|
||||||
|
controlP5.ControllerGroup : ControlWindow getWindow()
|
||||||
|
controlP5.ControllerGroup : ControlWindowCanvas addCanvas(ControlWindowCanvas)
|
||||||
|
controlP5.ControllerGroup : Controller getController(String)
|
||||||
|
controlP5.ControllerGroup : ControllerProperty getProperty(String)
|
||||||
|
controlP5.ControllerGroup : ControllerProperty getProperty(String, String)
|
||||||
|
controlP5.ControllerGroup : Group add(ControllerInterface)
|
||||||
|
controlP5.ControllerGroup : Group bringToFront()
|
||||||
|
controlP5.ControllerGroup : Group bringToFront(ControllerInterface)
|
||||||
|
controlP5.ControllerGroup : Group close()
|
||||||
|
controlP5.ControllerGroup : Group disableCollapse()
|
||||||
|
controlP5.ControllerGroup : Group enableCollapse()
|
||||||
|
controlP5.ControllerGroup : Group hide()
|
||||||
|
controlP5.ControllerGroup : Group moveTo(ControlWindow)
|
||||||
|
controlP5.ControllerGroup : Group moveTo(PApplet)
|
||||||
|
controlP5.ControllerGroup : Group open()
|
||||||
|
controlP5.ControllerGroup : Group registerProperty(String)
|
||||||
|
controlP5.ControllerGroup : Group registerProperty(String, String)
|
||||||
|
controlP5.ControllerGroup : Group remove(CDrawable)
|
||||||
|
controlP5.ControllerGroup : Group remove(ControllerInterface)
|
||||||
|
controlP5.ControllerGroup : Group removeCanvas(ControlWindowCanvas)
|
||||||
|
controlP5.ControllerGroup : Group removeProperty(String)
|
||||||
|
controlP5.ControllerGroup : Group removeProperty(String, String)
|
||||||
|
controlP5.ControllerGroup : Group setAddress(String)
|
||||||
|
controlP5.ControllerGroup : Group setArrayValue(float[])
|
||||||
|
controlP5.ControllerGroup : Group setColor(CColor)
|
||||||
|
controlP5.ControllerGroup : Group setColorActive(int)
|
||||||
|
controlP5.ControllerGroup : Group setColorBackground(int)
|
||||||
|
controlP5.ControllerGroup : Group setColorForeground(int)
|
||||||
|
controlP5.ControllerGroup : Group setColorLabel(int)
|
||||||
|
controlP5.ControllerGroup : Group setColorValue(int)
|
||||||
|
controlP5.ControllerGroup : Group setHeight(int)
|
||||||
|
controlP5.ControllerGroup : Group setId(int)
|
||||||
|
controlP5.ControllerGroup : Group setLabel(String)
|
||||||
|
controlP5.ControllerGroup : Group setMouseOver(boolean)
|
||||||
|
controlP5.ControllerGroup : Group setMoveable(boolean)
|
||||||
|
controlP5.ControllerGroup : Group setOpen(boolean)
|
||||||
|
controlP5.ControllerGroup : Group setPosition(PVector)
|
||||||
|
controlP5.ControllerGroup : Group setPosition(float, float)
|
||||||
|
controlP5.ControllerGroup : Group setStringValue(String)
|
||||||
|
controlP5.ControllerGroup : Group setUpdate(boolean)
|
||||||
|
controlP5.ControllerGroup : Group setValue(float)
|
||||||
|
controlP5.ControllerGroup : Group setVisible(boolean)
|
||||||
|
controlP5.ControllerGroup : Group setWidth(int)
|
||||||
|
controlP5.ControllerGroup : Group show()
|
||||||
|
controlP5.ControllerGroup : Group update()
|
||||||
|
controlP5.ControllerGroup : Group updateAbsolutePosition()
|
||||||
|
controlP5.ControllerGroup : Label getCaptionLabel()
|
||||||
|
controlP5.ControllerGroup : Label getValueLabel()
|
||||||
|
controlP5.ControllerGroup : PVector getPosition()
|
||||||
|
controlP5.ControllerGroup : String getAddress()
|
||||||
|
controlP5.ControllerGroup : String getInfo()
|
||||||
|
controlP5.ControllerGroup : String getName()
|
||||||
|
controlP5.ControllerGroup : String getStringValue()
|
||||||
|
controlP5.ControllerGroup : String toString()
|
||||||
|
controlP5.ControllerGroup : Tab getTab()
|
||||||
|
controlP5.ControllerGroup : boolean isCollapse()
|
||||||
|
controlP5.ControllerGroup : boolean isMouseOver()
|
||||||
|
controlP5.ControllerGroup : boolean isMoveable()
|
||||||
|
controlP5.ControllerGroup : boolean isOpen()
|
||||||
|
controlP5.ControllerGroup : boolean isUpdate()
|
||||||
|
controlP5.ControllerGroup : boolean isVisible()
|
||||||
|
controlP5.ControllerGroup : boolean setMousePressed(boolean)
|
||||||
|
controlP5.ControllerGroup : float getValue()
|
||||||
|
controlP5.ControllerGroup : float[] getArrayValue()
|
||||||
|
controlP5.ControllerGroup : int getHeight()
|
||||||
|
controlP5.ControllerGroup : int getId()
|
||||||
|
controlP5.ControllerGroup : int getWidth()
|
||||||
|
controlP5.ControllerGroup : void remove()
|
||||||
|
java.lang.Object : String toString()
|
||||||
|
java.lang.Object : boolean equals(Object)
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
233
examples/controllers/ControlP5knob/ControlP5knob.pde
Normal file
233
examples/controllers/ControlP5knob/ControlP5knob.pde
Normal file
@ -0,0 +1,233 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 Knob
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* find a list of public methods available for the Knob Controller
|
||||||
|
* at the bottom of this sketch.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
int myColorBackground = color(0,0,0);
|
||||||
|
int knobValue = 100;
|
||||||
|
|
||||||
|
Knob myKnobA;
|
||||||
|
Knob myKnobB;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(700,400);
|
||||||
|
smooth();
|
||||||
|
noStroke();
|
||||||
|
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
|
||||||
|
myKnobA = cp5.addKnob("knob")
|
||||||
|
.setRange(0,255)
|
||||||
|
.setValue(50)
|
||||||
|
.setPosition(100,70)
|
||||||
|
.setRadius(50)
|
||||||
|
.setDragDirection(Knob.VERTICAL)
|
||||||
|
;
|
||||||
|
|
||||||
|
myKnobB = cp5.addKnob("knobValue")
|
||||||
|
.setRange(0,255)
|
||||||
|
.setValue(220)
|
||||||
|
.setPosition(100,210)
|
||||||
|
.setRadius(50)
|
||||||
|
.setNumberOfTickMarks(10)
|
||||||
|
.setTickMarkLength(4)
|
||||||
|
.snapToTickMarks(true)
|
||||||
|
.setColorForeground(color(255))
|
||||||
|
.setColorBackground(color(0, 160, 100))
|
||||||
|
.setColorActive(color(255,255,0))
|
||||||
|
.setDragDirection(Knob.HORIZONTAL)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(myColorBackground);
|
||||||
|
fill(knobValue);
|
||||||
|
rect(0,height/2,width,height/2);
|
||||||
|
fill(0,100);
|
||||||
|
rect(80,40,140,320);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void knob(int theValue) {
|
||||||
|
myColorBackground = color(theValue);
|
||||||
|
println("a knob event. setting background to "+theValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void keyPressed() {
|
||||||
|
switch(key) {
|
||||||
|
case('1'):myKnobA.setValue(180);break;
|
||||||
|
case('2'):myKnobB.setConstrained(false).hideTickMarks().snapToTickMarks(false);break;
|
||||||
|
case('3'):myKnobA.shuffle();myKnobB.shuffle();break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
a list of all methods available for the Knob Controller
|
||||||
|
use ControlP5.printPublicMethodsFor(Knob.class);
|
||||||
|
to print the following list into the console.
|
||||||
|
|
||||||
|
You can find further details about class Knob in the javadoc.
|
||||||
|
|
||||||
|
Format:
|
||||||
|
ClassName : returnType methodName(parameter type)
|
||||||
|
|
||||||
|
controlP5.Knob : Knob setConstrained(boolean)
|
||||||
|
controlP5.Knob : Knob setDragDirection(int)
|
||||||
|
controlP5.Knob : Knob setMax(float)
|
||||||
|
controlP5.Knob : Knob setMin(float)
|
||||||
|
controlP5.Knob : Knob setNumberOfTickMarks(int)
|
||||||
|
controlP5.Knob : Knob setRadius(float)
|
||||||
|
controlP5.Knob : Knob setRange(float)
|
||||||
|
controlP5.Knob : Knob setResolution(float)
|
||||||
|
controlP5.Knob : Knob setScrollSensitivity(float)
|
||||||
|
controlP5.Knob : Knob setSensitivity(float)
|
||||||
|
controlP5.Knob : Knob setShowRange(boolean)
|
||||||
|
controlP5.Knob : Knob setStartAngle(float)
|
||||||
|
controlP5.Knob : Knob setTickMarkLength(int)
|
||||||
|
controlP5.Knob : Knob setTickMarkWeight(float)
|
||||||
|
controlP5.Knob : Knob setValue(float)
|
||||||
|
controlP5.Knob : Knob setViewStyle(int)
|
||||||
|
controlP5.Knob : Knob showTickMarks(boolean)
|
||||||
|
controlP5.Knob : Knob shuffle()
|
||||||
|
controlP5.Knob : Knob snapToTickMarks(boolean)
|
||||||
|
controlP5.Knob : Knob update()
|
||||||
|
controlP5.Knob : boolean isConstrained()
|
||||||
|
controlP5.Knob : boolean isShowRange()
|
||||||
|
controlP5.Knob : boolean isShowTickMarks()
|
||||||
|
controlP5.Knob : float getAngle()
|
||||||
|
controlP5.Knob : float getRadius()
|
||||||
|
controlP5.Knob : float getRange()
|
||||||
|
controlP5.Knob : float getResolution()
|
||||||
|
controlP5.Knob : float getStartAngle()
|
||||||
|
controlP5.Knob : float getTickMarkWeight()
|
||||||
|
controlP5.Knob : float getValue()
|
||||||
|
controlP5.Knob : int getDragDirection()
|
||||||
|
controlP5.Knob : int getNumberOfTickMarks()
|
||||||
|
controlP5.Knob : int getTickMarkLength()
|
||||||
|
controlP5.Knob : int getViewStyle()
|
||||||
|
controlP5.Controller : CColor getColor()
|
||||||
|
controlP5.Controller : ControlBehavior getBehavior()
|
||||||
|
controlP5.Controller : ControlWindow getControlWindow()
|
||||||
|
controlP5.Controller : ControlWindow getWindow()
|
||||||
|
controlP5.Controller : ControllerProperty getProperty(String)
|
||||||
|
controlP5.Controller : ControllerProperty getProperty(String, String)
|
||||||
|
controlP5.Controller : Knob addCallback(CallbackListener)
|
||||||
|
controlP5.Controller : Knob addListener(ControlListener)
|
||||||
|
controlP5.Controller : Knob bringToFront()
|
||||||
|
controlP5.Controller : Knob bringToFront(ControllerInterface)
|
||||||
|
controlP5.Controller : Knob hide()
|
||||||
|
controlP5.Controller : Knob linebreak()
|
||||||
|
controlP5.Controller : Knob listen(boolean)
|
||||||
|
controlP5.Controller : Knob lock()
|
||||||
|
controlP5.Controller : Knob plugTo(Object)
|
||||||
|
controlP5.Controller : Knob plugTo(Object, String)
|
||||||
|
controlP5.Controller : Knob plugTo(Object[])
|
||||||
|
controlP5.Controller : Knob plugTo(Object[], String)
|
||||||
|
controlP5.Controller : Knob registerProperty(String)
|
||||||
|
controlP5.Controller : Knob registerProperty(String, String)
|
||||||
|
controlP5.Controller : Knob registerTooltip(String)
|
||||||
|
controlP5.Controller : Knob removeBehavior()
|
||||||
|
controlP5.Controller : Knob removeCallback()
|
||||||
|
controlP5.Controller : Knob removeCallback(CallbackListener)
|
||||||
|
controlP5.Controller : Knob removeListener(ControlListener)
|
||||||
|
controlP5.Controller : Knob removeProperty(String)
|
||||||
|
controlP5.Controller : Knob removeProperty(String, String)
|
||||||
|
controlP5.Controller : Knob setArrayValue(float[])
|
||||||
|
controlP5.Controller : Knob setArrayValue(int, float)
|
||||||
|
controlP5.Controller : Knob setBehavior(ControlBehavior)
|
||||||
|
controlP5.Controller : Knob setBroadcast(boolean)
|
||||||
|
controlP5.Controller : Knob setCaptionLabel(String)
|
||||||
|
controlP5.Controller : Knob setColor(CColor)
|
||||||
|
controlP5.Controller : Knob setColorActive(int)
|
||||||
|
controlP5.Controller : Knob setColorBackground(int)
|
||||||
|
controlP5.Controller : Knob setColorCaptionLabel(int)
|
||||||
|
controlP5.Controller : Knob setColorForeground(int)
|
||||||
|
controlP5.Controller : Knob setColorValueLabel(int)
|
||||||
|
controlP5.Controller : Knob setDecimalPrecision(int)
|
||||||
|
controlP5.Controller : Knob setDefaultValue(float)
|
||||||
|
controlP5.Controller : Knob setHeight(int)
|
||||||
|
controlP5.Controller : Knob setId(int)
|
||||||
|
controlP5.Controller : Knob setImages(PImage, PImage, PImage)
|
||||||
|
controlP5.Controller : Knob setImages(PImage, PImage, PImage, PImage)
|
||||||
|
controlP5.Controller : Knob setLabelVisible(boolean)
|
||||||
|
controlP5.Controller : Knob setLock(boolean)
|
||||||
|
controlP5.Controller : Knob setMax(float)
|
||||||
|
controlP5.Controller : Knob setMin(float)
|
||||||
|
controlP5.Controller : Knob setMouseOver(boolean)
|
||||||
|
controlP5.Controller : Knob setMoveable(boolean)
|
||||||
|
controlP5.Controller : Knob setPosition(PVector)
|
||||||
|
controlP5.Controller : Knob setPosition(float, float)
|
||||||
|
controlP5.Controller : Knob setSize(PImage)
|
||||||
|
controlP5.Controller : Knob setSize(int, int)
|
||||||
|
controlP5.Controller : Knob setStringValue(String)
|
||||||
|
controlP5.Controller : Knob setUpdate(boolean)
|
||||||
|
controlP5.Controller : Knob setValueLabel(String)
|
||||||
|
controlP5.Controller : Knob setView(ControllerView)
|
||||||
|
controlP5.Controller : Knob setVisible(boolean)
|
||||||
|
controlP5.Controller : Knob setWidth(int)
|
||||||
|
controlP5.Controller : Knob show()
|
||||||
|
controlP5.Controller : Knob unlock()
|
||||||
|
controlP5.Controller : Knob unplugFrom(Object)
|
||||||
|
controlP5.Controller : Knob unplugFrom(Object[])
|
||||||
|
controlP5.Controller : Knob unregisterTooltip()
|
||||||
|
controlP5.Controller : Knob update()
|
||||||
|
controlP5.Controller : Knob updateSize()
|
||||||
|
controlP5.Controller : Label getCaptionLabel()
|
||||||
|
controlP5.Controller : Label getValueLabel()
|
||||||
|
controlP5.Controller : List getControllerPlugList()
|
||||||
|
controlP5.Controller : PImage setImage(PImage)
|
||||||
|
controlP5.Controller : PImage setImage(PImage, int)
|
||||||
|
controlP5.Controller : PVector getAbsolutePosition()
|
||||||
|
controlP5.Controller : PVector getPosition()
|
||||||
|
controlP5.Controller : String getAddress()
|
||||||
|
controlP5.Controller : String getInfo()
|
||||||
|
controlP5.Controller : String getName()
|
||||||
|
controlP5.Controller : String getStringValue()
|
||||||
|
controlP5.Controller : String toString()
|
||||||
|
controlP5.Controller : Tab getTab()
|
||||||
|
controlP5.Controller : boolean isActive()
|
||||||
|
controlP5.Controller : boolean isBroadcast()
|
||||||
|
controlP5.Controller : boolean isInside()
|
||||||
|
controlP5.Controller : boolean isLabelVisible()
|
||||||
|
controlP5.Controller : boolean isListening()
|
||||||
|
controlP5.Controller : boolean isLock()
|
||||||
|
controlP5.Controller : boolean isMouseOver()
|
||||||
|
controlP5.Controller : boolean isMousePressed()
|
||||||
|
controlP5.Controller : boolean isMoveable()
|
||||||
|
controlP5.Controller : boolean isUpdate()
|
||||||
|
controlP5.Controller : boolean isVisible()
|
||||||
|
controlP5.Controller : float getArrayValue(int)
|
||||||
|
controlP5.Controller : float getDefaultValue()
|
||||||
|
controlP5.Controller : float getMax()
|
||||||
|
controlP5.Controller : float getMin()
|
||||||
|
controlP5.Controller : float getValue()
|
||||||
|
controlP5.Controller : float[] getArrayValue()
|
||||||
|
controlP5.Controller : int getDecimalPrecision()
|
||||||
|
controlP5.Controller : int getHeight()
|
||||||
|
controlP5.Controller : int getId()
|
||||||
|
controlP5.Controller : int getWidth()
|
||||||
|
controlP5.Controller : int listenerSize()
|
||||||
|
controlP5.Controller : void remove()
|
||||||
|
controlP5.Controller : void setView(ControllerView, int)
|
||||||
|
java.lang.Object : String toString()
|
||||||
|
java.lang.Object : boolean equals(Object)
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
266
examples/controllers/ControlP5listBox/ControlP5listBox.pde
Normal file
266
examples/controllers/ControlP5listBox/ControlP5listBox.pde
Normal file
@ -0,0 +1,266 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 ListBox
|
||||||
|
*
|
||||||
|
* find a list of public methods available for the ListBox Controller
|
||||||
|
* at the bottom of this sketch.
|
||||||
|
* use the scrollwheel, up or down cursors to scroll through
|
||||||
|
* a listbox when hovering with the mouse.
|
||||||
|
*
|
||||||
|
* DEPRECATED, use ScrollableList instead.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
ListBox l;
|
||||||
|
|
||||||
|
int cnt = 0;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
|
||||||
|
size(700, 400);
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
|
||||||
|
// ListBox is DEPRECATED,
|
||||||
|
// use ScrollableList instead,
|
||||||
|
// see example ControlP5scrollableList
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
l = cp5.addListBox("myList")
|
||||||
|
.setPosition(100, 100)
|
||||||
|
.setSize(120, 120)
|
||||||
|
.setItemHeight(15)
|
||||||
|
.setBarHeight(15)
|
||||||
|
.setColorBackground(color(255, 128))
|
||||||
|
.setColorActive(color(0))
|
||||||
|
.setColorForeground(color(255, 100,0))
|
||||||
|
;
|
||||||
|
|
||||||
|
l.getCaptionLabel().toUpperCase(true);
|
||||||
|
l.getCaptionLabel().set("A Listbox");
|
||||||
|
l.getCaptionLabel().setColor(0xffff0000);
|
||||||
|
l.getCaptionLabel().style().marginTop = 3;
|
||||||
|
l.getValueLabel().style().marginTop = 3;
|
||||||
|
|
||||||
|
for (int i=0;i<80;i++) {
|
||||||
|
ListBoxItem lbi = l.addItem("item "+i, i);
|
||||||
|
lbi.setColorBackground(0xffff0000);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void keyPressed() {
|
||||||
|
if (key=='0') {
|
||||||
|
// will activate the listbox item with value 5
|
||||||
|
l.setValue(5);
|
||||||
|
}
|
||||||
|
if (key=='1') {
|
||||||
|
// set the height of a listBox should always be a multiple of itemHeight
|
||||||
|
l.setHeight(210);
|
||||||
|
}
|
||||||
|
else if (key=='2') {
|
||||||
|
// set the height of a listBox should always be a multiple of itemHeight
|
||||||
|
l.setHeight(120);
|
||||||
|
}
|
||||||
|
else if (key=='3') {
|
||||||
|
// set the width of a listBox
|
||||||
|
l.setWidth(200);
|
||||||
|
}
|
||||||
|
else if (key=='i') {
|
||||||
|
// set the height of a listBoxItem, should always be a fraction of the listBox
|
||||||
|
l.setItemHeight(30);
|
||||||
|
}
|
||||||
|
else if (key=='u') {
|
||||||
|
// set the height of a listBoxItem, should always be a fraction of the listBox
|
||||||
|
l.setItemHeight(10);
|
||||||
|
l.setBackgroundColor(color(100, 0, 0));
|
||||||
|
}
|
||||||
|
else if (key=='a') {
|
||||||
|
int n = (int)(random(100000));
|
||||||
|
l.addItem("item "+n, n);
|
||||||
|
}
|
||||||
|
else if (key=='d') {
|
||||||
|
l.removeItem("item "+cnt);
|
||||||
|
cnt++;
|
||||||
|
} else if (key=='c') {
|
||||||
|
l.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void controlEvent(ControlEvent theEvent) {
|
||||||
|
// ListBox is if type ControlGroup.
|
||||||
|
// 1 controlEvent will be executed, where the event
|
||||||
|
// originates from a ControlGroup. therefore
|
||||||
|
// you need to check the Event with
|
||||||
|
// if (theEvent.isGroup())
|
||||||
|
// to avoid an error message from controlP5.
|
||||||
|
|
||||||
|
if (theEvent.isGroup()) {
|
||||||
|
// an event from a group e.g. scrollList
|
||||||
|
println(theEvent.getGroup().getValue()+" from "+theEvent.getGroup());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(theEvent.isGroup() && theEvent.getName().equals("myList")){
|
||||||
|
int test = (int)theEvent.getGroup().getValue();
|
||||||
|
println("test "+test);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(128);
|
||||||
|
// scroll the scroll List according to the mouseX position
|
||||||
|
// when holding down SPACE.
|
||||||
|
if (keyPressed && key==' ') {
|
||||||
|
//l.scroll(mouseX/((float)width)); // scroll taks values between 0 and 1
|
||||||
|
}
|
||||||
|
if (keyPressed && key==' ') {
|
||||||
|
l.setWidth(mouseX);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
a list of all methods available for the ListBox Controller
|
||||||
|
use ControlP5.printPublicMethodsFor(ListBox.class);
|
||||||
|
to print the following list into the console.
|
||||||
|
|
||||||
|
You can find further details about class ListBox in the javadoc.
|
||||||
|
|
||||||
|
Format:
|
||||||
|
ClassName : returnType methodName(parameter type)
|
||||||
|
|
||||||
|
|
||||||
|
controlP5.ControlGroup : ControlGroup activateEvent(boolean)
|
||||||
|
controlP5.ControlGroup : ControlGroup addListener(ControlListener)
|
||||||
|
controlP5.ControlGroup : ControlGroup hideBar()
|
||||||
|
controlP5.ControlGroup : ControlGroup removeListener(ControlListener)
|
||||||
|
controlP5.ControlGroup : ControlGroup setBackgroundColor(int)
|
||||||
|
controlP5.ControlGroup : ControlGroup setBackgroundHeight(int)
|
||||||
|
controlP5.ControlGroup : ControlGroup setBarHeight(int)
|
||||||
|
controlP5.ControlGroup : ControlGroup showBar()
|
||||||
|
controlP5.ControlGroup : ControllerGroup updateInternalEvents(PApplet)
|
||||||
|
controlP5.ControlGroup : String info()
|
||||||
|
controlP5.ControlGroup : String toString()
|
||||||
|
controlP5.ControlGroup : boolean isBarVisible()
|
||||||
|
controlP5.ControlGroup : int getBackgroundHeight()
|
||||||
|
controlP5.ControlGroup : int getBarHeight()
|
||||||
|
controlP5.ControlGroup : int listenerSize()
|
||||||
|
controlP5.ControllerGroup : CColor getColor()
|
||||||
|
controlP5.ControllerGroup : ControlWindow getWindow()
|
||||||
|
controlP5.ControllerGroup : ControlWindowCanvas addCanvas(ControlWindowCanvas)
|
||||||
|
controlP5.ControllerGroup : Controller getController(String)
|
||||||
|
controlP5.ControllerGroup : ControllerGroup add(ControllerInterface)
|
||||||
|
controlP5.ControllerGroup : ControllerGroup close()
|
||||||
|
controlP5.ControllerGroup : ControllerGroup disableCollapse()
|
||||||
|
controlP5.ControllerGroup : ControllerGroup enableCollapse()
|
||||||
|
controlP5.ControllerGroup : ControllerGroup hide()
|
||||||
|
controlP5.ControllerGroup : ControllerGroup moveTo(ControlWindow)
|
||||||
|
controlP5.ControllerGroup : ControllerGroup open()
|
||||||
|
controlP5.ControllerGroup : ControllerGroup registerProperty(String)
|
||||||
|
controlP5.ControllerGroup : ControllerGroup registerProperty(String, String)
|
||||||
|
controlP5.ControllerGroup : ControllerGroup remove(CDrawable)
|
||||||
|
controlP5.ControllerGroup : ControllerGroup remove(ControllerInterface)
|
||||||
|
controlP5.ControllerGroup : ControllerGroup removeCanvas(ControlWindowCanvas)
|
||||||
|
controlP5.ControllerGroup : ControllerGroup removeProperty(String)
|
||||||
|
controlP5.ControllerGroup : ControllerGroup removeProperty(String, String)
|
||||||
|
controlP5.ControllerGroup : ControllerGroup setAddress(String)
|
||||||
|
controlP5.ControllerGroup : ControllerGroup setArrayValue(float[])
|
||||||
|
controlP5.ControllerGroup : ControllerGroup setColor(CColor)
|
||||||
|
controlP5.ControllerGroup : ControllerGroup setColorActive(int)
|
||||||
|
controlP5.ControllerGroup : ControllerGroup setColorBackground(int)
|
||||||
|
controlP5.ControllerGroup : ControllerGroup setColorForeground(int)
|
||||||
|
controlP5.ControllerGroup : ControllerGroup setColorLabel(int)
|
||||||
|
controlP5.ControllerGroup : ControllerGroup setColorValue(int)
|
||||||
|
controlP5.ControllerGroup : ControllerGroup setHeight(int)
|
||||||
|
controlP5.ControllerGroup : ControllerGroup setId(int)
|
||||||
|
controlP5.ControllerGroup : ControllerGroup setLabel(String)
|
||||||
|
controlP5.ControllerGroup : ControllerGroup setMoveable(boolean)
|
||||||
|
controlP5.ControllerGroup : ControllerGroup setOpen(boolean)
|
||||||
|
controlP5.ControllerGroup : ControllerGroup setPosition(PVector)
|
||||||
|
controlP5.ControllerGroup : ControllerGroup setPosition(float, float)
|
||||||
|
controlP5.ControllerGroup : ControllerGroup setStringValue(String)
|
||||||
|
controlP5.ControllerGroup : ControllerGroup setUpdate(boolean)
|
||||||
|
controlP5.ControllerGroup : ControllerGroup setValue(float)
|
||||||
|
controlP5.ControllerGroup : ControllerGroup setVisible(boolean)
|
||||||
|
controlP5.ControllerGroup : ControllerGroup setWidth(int)
|
||||||
|
controlP5.ControllerGroup : ControllerGroup show()
|
||||||
|
controlP5.ControllerGroup : ControllerGroup update()
|
||||||
|
controlP5.ControllerGroup : ControllerGroup updateAbsolutePosition()
|
||||||
|
controlP5.ControllerGroup : ControllerProperty getProperty(String)
|
||||||
|
controlP5.ControllerGroup : ControllerProperty getProperty(String, String)
|
||||||
|
controlP5.ControllerGroup : Label captionLabel()
|
||||||
|
controlP5.ControllerGroup : Label valueLabel()
|
||||||
|
controlP5.ControllerGroup : PVector getPosition()
|
||||||
|
controlP5.ControllerGroup : String getAddress()
|
||||||
|
controlP5.ControllerGroup : String getName()
|
||||||
|
controlP5.ControllerGroup : String getStringValue()
|
||||||
|
controlP5.ControllerGroup : String info()
|
||||||
|
controlP5.ControllerGroup : String toString()
|
||||||
|
controlP5.ControllerGroup : Tab getTab()
|
||||||
|
controlP5.ControllerGroup : boolean isCollapse()
|
||||||
|
controlP5.ControllerGroup : boolean isMouseOver()
|
||||||
|
controlP5.ControllerGroup : boolean isMoveable()
|
||||||
|
controlP5.ControllerGroup : boolean isOpen()
|
||||||
|
controlP5.ControllerGroup : boolean isUpdate()
|
||||||
|
controlP5.ControllerGroup : boolean isVisible()
|
||||||
|
controlP5.ControllerGroup : boolean setMousePressed(boolean)
|
||||||
|
controlP5.ControllerGroup : float getValue()
|
||||||
|
controlP5.ControllerGroup : float[] getArrayValue()
|
||||||
|
controlP5.ControllerGroup : int getHeight()
|
||||||
|
controlP5.ControllerGroup : int getId()
|
||||||
|
controlP5.ControllerGroup : int getWidth()
|
||||||
|
controlP5.ControllerGroup : void remove()
|
||||||
|
controlP5.ListBox : ListBox actAsPulldownMenu(boolean)
|
||||||
|
controlP5.ListBox : ListBox addItems(List)
|
||||||
|
controlP5.ListBox : ListBox addItems(List, int)
|
||||||
|
controlP5.ListBox : ListBox addItems(String[])
|
||||||
|
controlP5.ListBox : ListBox clear()
|
||||||
|
controlP5.ListBox : ListBox hideScrollbar()
|
||||||
|
controlP5.ListBox : ListBox removeItem(String)
|
||||||
|
controlP5.ListBox : ListBox scroll(float)
|
||||||
|
controlP5.ListBox : ListBox setColorActive(int)
|
||||||
|
controlP5.ListBox : ListBox setColorBackground(int)
|
||||||
|
controlP5.ListBox : ListBox setColorForeground(int)
|
||||||
|
controlP5.ListBox : ListBox setColorLabel(int)
|
||||||
|
controlP5.ListBox : ListBox setHeight(int)
|
||||||
|
controlP5.ListBox : ListBox setItemHeight(int)
|
||||||
|
controlP5.ListBox : ListBox setListBoxItems(String[][])
|
||||||
|
controlP5.ListBox : ListBox setWidth(int)
|
||||||
|
controlP5.ListBox : ListBox showScrollbar()
|
||||||
|
controlP5.ListBox : ListBox toUpperCase(boolean)
|
||||||
|
controlP5.ListBox : ListBoxItem addItem(String, int)
|
||||||
|
controlP5.ListBox : ListBoxItem getItem(Controller)
|
||||||
|
controlP5.ListBox : ListBoxItem getItem(String)
|
||||||
|
controlP5.ListBox : ListBoxItem getItem(int)
|
||||||
|
controlP5.ListBox : String[][] getListBoxItems()
|
||||||
|
controlP5.ListBox : boolean isScrollbarVisible()
|
||||||
|
java.lang.Object : String toString()
|
||||||
|
java.lang.Object : String toString()
|
||||||
|
java.lang.Object : boolean equals(Object)
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
268
examples/controllers/ControlP5matrix/ControlP5matrix.pde
Normal file
268
examples/controllers/ControlP5matrix/ControlP5matrix.pde
Normal file
@ -0,0 +1,268 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 Matrix
|
||||||
|
*
|
||||||
|
* A matrix can be used for example as a sequencer, a drum machine.
|
||||||
|
*
|
||||||
|
* find a list of public methods available for the Matrix Controller
|
||||||
|
* at the bottom of this sketch.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
Dong[][] d;
|
||||||
|
int nx = 10;
|
||||||
|
int ny = 10;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(700, 400);
|
||||||
|
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
|
||||||
|
cp5.addMatrix("myMatrix")
|
||||||
|
.setPosition(50, 100)
|
||||||
|
.setSize(200, 200)
|
||||||
|
.setGrid(nx, ny)
|
||||||
|
.setGap(10, 1)
|
||||||
|
.setInterval(200)
|
||||||
|
.setMode(ControlP5.MULTIPLES)
|
||||||
|
.setColorBackground(color(120))
|
||||||
|
.setBackground(color(40))
|
||||||
|
;
|
||||||
|
|
||||||
|
cp5.getController("myMatrix").getCaptionLabel().alignX(CENTER);
|
||||||
|
|
||||||
|
// use setMode to change the cell-activation which by
|
||||||
|
// default is ControlP5.SINGLE_ROW, 1 active cell per row,
|
||||||
|
// but can be changed to ControlP5.SINGLE_COLUMN or
|
||||||
|
// ControlP5.MULTIPLES
|
||||||
|
|
||||||
|
d = new Dong[nx][ny];
|
||||||
|
for (int x = 0;x<nx;x++) {
|
||||||
|
for (int y = 0;y<ny;y++) {
|
||||||
|
d[x][y] = new Dong();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
noStroke();
|
||||||
|
smooth();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(0);
|
||||||
|
fill(255, 100);
|
||||||
|
pushMatrix();
|
||||||
|
translate(width/2 + 150, height/2);
|
||||||
|
rotate(frameCount*0.001);
|
||||||
|
for (int x = 0;x<nx;x++) {
|
||||||
|
for (int y = 0;y<ny;y++) {
|
||||||
|
d[x][y].display();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
popMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void myMatrix(int theX, int theY) {
|
||||||
|
println("got it: "+theX+", "+theY);
|
||||||
|
d[theX][theY].update();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void keyPressed() {
|
||||||
|
if (key=='1') {
|
||||||
|
cp5.get(Matrix.class, "myMatrix").set(0, 0, true);
|
||||||
|
}
|
||||||
|
else if (key=='2') {
|
||||||
|
cp5.get(Matrix.class, "myMatrix").set(0, 1, true);
|
||||||
|
}
|
||||||
|
else if (key=='3') {
|
||||||
|
cp5.get(Matrix.class, "myMatrix").trigger(0);
|
||||||
|
}
|
||||||
|
else if (key=='p') {
|
||||||
|
if (cp5.get(Matrix.class, "myMatrix").isPlaying()) {
|
||||||
|
cp5.get(Matrix.class, "myMatrix").pause();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cp5.get(Matrix.class, "myMatrix").play();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (key=='0') {
|
||||||
|
cp5.get(Matrix.class, "myMatrix").clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void controlEvent(ControlEvent theEvent) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class Dong {
|
||||||
|
float x, y;
|
||||||
|
float s0, s1;
|
||||||
|
|
||||||
|
Dong() {
|
||||||
|
float f= random(-PI, PI);
|
||||||
|
x = cos(f)*random(100, 150);
|
||||||
|
y = sin(f)*random(100, 150);
|
||||||
|
s0 = random(2, 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
void display() {
|
||||||
|
s1 += (s0-s1)*0.1;
|
||||||
|
ellipse(x, y, s1, s1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void update() {
|
||||||
|
s1 = 50;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
a list of all methods available for the Matrix Controller
|
||||||
|
use ControlP5.printPublicMethodsFor(Matrix.class);
|
||||||
|
to print the following list into the console.
|
||||||
|
|
||||||
|
You can find further details about class Matrix in the javadoc.
|
||||||
|
|
||||||
|
Format:
|
||||||
|
ClassName : returnType methodName(parameter type)
|
||||||
|
|
||||||
|
controlP5.Matrix : Matrix clear()
|
||||||
|
controlP5.Matrix : Matrix isPlaying()
|
||||||
|
controlP5.Matrix : Matrix pause()
|
||||||
|
controlP5.Matrix : Matrix play()
|
||||||
|
controlP5.Matrix : Matrix plugTo(Object)
|
||||||
|
controlP5.Matrix : Matrix plugTo(Object, String)
|
||||||
|
controlP5.Matrix : Matrix set(int, int, boolean)
|
||||||
|
controlP5.Matrix : Matrix setCells(int[][])
|
||||||
|
controlP5.Matrix : Matrix setGap(int, int)
|
||||||
|
controlP5.Matrix : Matrix setGrid(int, int)
|
||||||
|
controlP5.Matrix : Matrix setInterval(int)
|
||||||
|
controlP5.Matrix : Matrix setMode(int)
|
||||||
|
controlP5.Matrix : Matrix setValue(float)
|
||||||
|
controlP5.Matrix : Matrix stop()
|
||||||
|
controlP5.Matrix : Matrix trigger(int)
|
||||||
|
controlP5.Matrix : Matrix update()
|
||||||
|
controlP5.Matrix : boolean get(int, int)
|
||||||
|
controlP5.Matrix : int getInterval()
|
||||||
|
controlP5.Matrix : int getMode()
|
||||||
|
controlP5.Matrix : int[][] getCells()
|
||||||
|
controlP5.Matrix : void remove()
|
||||||
|
controlP5.Controller : CColor getColor()
|
||||||
|
controlP5.Controller : ControlBehavior getBehavior()
|
||||||
|
controlP5.Controller : ControlWindow getControlWindow()
|
||||||
|
controlP5.Controller : ControlWindow getWindow()
|
||||||
|
controlP5.Controller : ControllerProperty getProperty(String)
|
||||||
|
controlP5.Controller : ControllerProperty getProperty(String, String)
|
||||||
|
controlP5.Controller : Label getCaptionLabel()
|
||||||
|
controlP5.Controller : Label getValueLabel()
|
||||||
|
controlP5.Controller : List getControllerPlugList()
|
||||||
|
controlP5.Controller : Matrix addCallback(CallbackListener)
|
||||||
|
controlP5.Controller : Matrix addListener(ControlListener)
|
||||||
|
controlP5.Controller : Matrix align(int, int, int, int)
|
||||||
|
controlP5.Controller : Matrix bringToFront()
|
||||||
|
controlP5.Controller : Matrix bringToFront(ControllerInterface)
|
||||||
|
controlP5.Controller : Matrix hide()
|
||||||
|
controlP5.Controller : Matrix linebreak()
|
||||||
|
controlP5.Controller : Matrix listen(boolean)
|
||||||
|
controlP5.Controller : Matrix lock()
|
||||||
|
controlP5.Controller : Matrix plugTo(Object)
|
||||||
|
controlP5.Controller : Matrix plugTo(Object, String)
|
||||||
|
controlP5.Controller : Matrix plugTo(Object[])
|
||||||
|
controlP5.Controller : Matrix plugTo(Object[], String)
|
||||||
|
controlP5.Controller : Matrix registerProperty(String)
|
||||||
|
controlP5.Controller : Matrix registerProperty(String, String)
|
||||||
|
controlP5.Controller : Matrix registerTooltip(String)
|
||||||
|
controlP5.Controller : Matrix removeBehavior()
|
||||||
|
controlP5.Controller : Matrix removeCallback()
|
||||||
|
controlP5.Controller : Matrix removeCallback(CallbackListener)
|
||||||
|
controlP5.Controller : Matrix removeListener(ControlListener)
|
||||||
|
controlP5.Controller : Matrix removeProperty(String)
|
||||||
|
controlP5.Controller : Matrix removeProperty(String, String)
|
||||||
|
controlP5.Controller : Matrix setArrayValue(float[])
|
||||||
|
controlP5.Controller : Matrix setArrayValue(int, float)
|
||||||
|
controlP5.Controller : Matrix setBehavior(ControlBehavior)
|
||||||
|
controlP5.Controller : Matrix setBroadcast(boolean)
|
||||||
|
controlP5.Controller : Matrix setCaptionLabel(String)
|
||||||
|
controlP5.Controller : Matrix setColor(CColor)
|
||||||
|
controlP5.Controller : Matrix setColorActive(int)
|
||||||
|
controlP5.Controller : Matrix setColorBackground(int)
|
||||||
|
controlP5.Controller : Matrix setColorCaptionLabel(int)
|
||||||
|
controlP5.Controller : Matrix setColorForeground(int)
|
||||||
|
controlP5.Controller : Matrix setColorValueLabel(int)
|
||||||
|
controlP5.Controller : Matrix setDecimalPrecision(int)
|
||||||
|
controlP5.Controller : Matrix setDefaultValue(float)
|
||||||
|
controlP5.Controller : Matrix setHeight(int)
|
||||||
|
controlP5.Controller : Matrix setId(int)
|
||||||
|
controlP5.Controller : Matrix setImage(PImage)
|
||||||
|
controlP5.Controller : Matrix setImage(PImage, int)
|
||||||
|
controlP5.Controller : Matrix setImages(PImage, PImage, PImage)
|
||||||
|
controlP5.Controller : Matrix setImages(PImage, PImage, PImage, PImage)
|
||||||
|
controlP5.Controller : Matrix setLabelVisible(boolean)
|
||||||
|
controlP5.Controller : Matrix setLock(boolean)
|
||||||
|
controlP5.Controller : Matrix setMax(float)
|
||||||
|
controlP5.Controller : Matrix setMin(float)
|
||||||
|
controlP5.Controller : Matrix setMouseOver(boolean)
|
||||||
|
controlP5.Controller : Matrix setMoveable(boolean)
|
||||||
|
controlP5.Controller : Matrix setPosition(PVector)
|
||||||
|
controlP5.Controller : Matrix setPosition(float, float)
|
||||||
|
controlP5.Controller : Matrix setSize(PImage)
|
||||||
|
controlP5.Controller : Matrix setSize(int, int)
|
||||||
|
controlP5.Controller : Matrix setStringValue(String)
|
||||||
|
controlP5.Controller : Matrix setUpdate(boolean)
|
||||||
|
controlP5.Controller : Matrix setValue(float)
|
||||||
|
controlP5.Controller : Matrix setValueLabel(String)
|
||||||
|
controlP5.Controller : Matrix setView(ControllerView)
|
||||||
|
controlP5.Controller : Matrix setVisible(boolean)
|
||||||
|
controlP5.Controller : Matrix setWidth(int)
|
||||||
|
controlP5.Controller : Matrix show()
|
||||||
|
controlP5.Controller : Matrix unlock()
|
||||||
|
controlP5.Controller : Matrix unplugFrom(Object)
|
||||||
|
controlP5.Controller : Matrix unplugFrom(Object[])
|
||||||
|
controlP5.Controller : Matrix unregisterTooltip()
|
||||||
|
controlP5.Controller : Matrix update()
|
||||||
|
controlP5.Controller : Matrix updateSize()
|
||||||
|
controlP5.Controller : PVector getAbsolutePosition()
|
||||||
|
controlP5.Controller : PVector getPosition()
|
||||||
|
controlP5.Controller : String getAddress()
|
||||||
|
controlP5.Controller : String getInfo()
|
||||||
|
controlP5.Controller : String getName()
|
||||||
|
controlP5.Controller : String getStringValue()
|
||||||
|
controlP5.Controller : String toString()
|
||||||
|
controlP5.Controller : Tab getTab()
|
||||||
|
controlP5.Controller : boolean isActive()
|
||||||
|
controlP5.Controller : boolean isBroadcast()
|
||||||
|
controlP5.Controller : boolean isInside()
|
||||||
|
controlP5.Controller : boolean isLabelVisible()
|
||||||
|
controlP5.Controller : boolean isListening()
|
||||||
|
controlP5.Controller : boolean isLock()
|
||||||
|
controlP5.Controller : boolean isMouseOver()
|
||||||
|
controlP5.Controller : boolean isMousePressed()
|
||||||
|
controlP5.Controller : boolean isMoveable()
|
||||||
|
controlP5.Controller : boolean isUpdate()
|
||||||
|
controlP5.Controller : boolean isVisible()
|
||||||
|
controlP5.Controller : float getArrayValue(int)
|
||||||
|
controlP5.Controller : float getDefaultValue()
|
||||||
|
controlP5.Controller : float getMax()
|
||||||
|
controlP5.Controller : float getMin()
|
||||||
|
controlP5.Controller : float getValue()
|
||||||
|
controlP5.Controller : float[] getArrayValue()
|
||||||
|
controlP5.Controller : int getDecimalPrecision()
|
||||||
|
controlP5.Controller : int getHeight()
|
||||||
|
controlP5.Controller : int getId()
|
||||||
|
controlP5.Controller : int getWidth()
|
||||||
|
controlP5.Controller : int listenerSize()
|
||||||
|
controlP5.Controller : void remove()
|
||||||
|
controlP5.Controller : void setView(ControllerView, int)
|
||||||
|
java.lang.Object : String toString()
|
||||||
|
java.lang.Object : boolean equals(Object)
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
101
examples/controllers/ControlP5multilist/ControlP5multiList.pde
Normal file
101
examples/controllers/ControlP5multilist/ControlP5multiList.pde
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 MultiList
|
||||||
|
* by andreas schlegel, 2009
|
||||||
|
*
|
||||||
|
* broken with version 2.2.1+
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 controlP5;
|
||||||
|
MultiList l;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(700,400);
|
||||||
|
frameRate(30);
|
||||||
|
controlP5 = new ControlP5(this);
|
||||||
|
|
||||||
|
// sorry, MultiList is currently broken.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// add a multiList to controlP5.
|
||||||
|
// elements of the list have default dimensions
|
||||||
|
// here, a width of 100 and a height of 12
|
||||||
|
l = controlP5.addMultiList("myList",20,20,100,12);
|
||||||
|
|
||||||
|
// create a multiListButton which we will use to
|
||||||
|
// add new buttons to the multilist
|
||||||
|
MultiListButton b;
|
||||||
|
b = l.add("level1",1);
|
||||||
|
|
||||||
|
// add items to a sublist of button "level1"
|
||||||
|
b.add("level11",11).setLabel("level1 item1");
|
||||||
|
b.add("level12",12).setLabel("level1 item2");
|
||||||
|
|
||||||
|
b = l.add("level2",2);
|
||||||
|
|
||||||
|
int cnt = 100;
|
||||||
|
|
||||||
|
// add some more sublists.
|
||||||
|
for(int i=0;i<10;i++) {
|
||||||
|
MultiListButton c = b.add("level2"+(i+1),20+i+1);
|
||||||
|
c.setLabel("level2 item"+(i+1));
|
||||||
|
c.setColorBackground(color(64 + 18*i,0,0));
|
||||||
|
|
||||||
|
if(i==4) {
|
||||||
|
// changing the width and the height of a button
|
||||||
|
// will be inherited by its sublists.
|
||||||
|
c.setWidth(100);
|
||||||
|
c.setHeight(20);
|
||||||
|
}
|
||||||
|
cnt++;
|
||||||
|
|
||||||
|
if(i==4) {
|
||||||
|
for(int j=0;j<10;j++) {
|
||||||
|
cnt++;
|
||||||
|
MultiListButton d;
|
||||||
|
d = c.add("level2"+i+""+j,250+j+1);
|
||||||
|
d.setLabel("level2 item"+(i+1)+" "+"item"+(j+1));
|
||||||
|
d.setColorBackground(color(64 + 18*j,(64 + 18*j)/2,0));
|
||||||
|
d.setId(cnt);
|
||||||
|
d.setWidth(200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MultiListButton cc = (MultiListButton)controlP5.getController("level21");
|
||||||
|
cc.setHeight(40);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void controlEvent(ControlEvent theEvent) {
|
||||||
|
println(theEvent.getController().getName()+" = "+theEvent.value());
|
||||||
|
// uncomment the line below to remove a multilist item when clicked.
|
||||||
|
// theEvent.controller().remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void keyPressed() {
|
||||||
|
if(controlP5.getController("level23")!=null) {
|
||||||
|
println("removing multilist button level23.");
|
||||||
|
controlP5.getController("level23").remove();
|
||||||
|
}
|
||||||
|
}
|
188
examples/controllers/ControlP5numberbox/ControlP5numberbox.pde
Normal file
188
examples/controllers/ControlP5numberbox/ControlP5numberbox.pde
Normal file
@ -0,0 +1,188 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 Numberbox
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* find a list of public methods available for the Numberbox Controller
|
||||||
|
* at the bottom of this sketch.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
int myColorBackground = color(0,0,0);
|
||||||
|
|
||||||
|
public float numberboxValue = 100;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(700,400);
|
||||||
|
noStroke();
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
|
||||||
|
cp5.addNumberbox("numberbox")
|
||||||
|
.setPosition(100,160)
|
||||||
|
.setSize(100,14)
|
||||||
|
.setScrollSensitivity(1.1)
|
||||||
|
.setValue(50)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
cp5.addNumberbox("numberboxValue")
|
||||||
|
.setPosition(100,200)
|
||||||
|
.setSize(100,14)
|
||||||
|
.setRange(0,200)
|
||||||
|
.setMultiplier(0.1) // set the sensitifity of the numberbox
|
||||||
|
.setDirection(Controller.HORIZONTAL) // change the control direction to left/right
|
||||||
|
.setValue(100)
|
||||||
|
;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(myColorBackground);
|
||||||
|
fill(numberboxValue);
|
||||||
|
rect(0,0,width,100);
|
||||||
|
}
|
||||||
|
|
||||||
|
void numberbox(int theColor) {
|
||||||
|
myColorBackground = color(theColor);
|
||||||
|
println("a numberbox event. setting background to "+theColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
a list of all methods available for the Numberbox Controller
|
||||||
|
use ControlP5.printPublicMethodsFor(Numberbox.class);
|
||||||
|
to print the following list into the console.
|
||||||
|
|
||||||
|
You can find further details about class Numberbox in the javadoc.
|
||||||
|
|
||||||
|
Format:
|
||||||
|
ClassName : returnType methodName(parameter type)
|
||||||
|
|
||||||
|
controlP5.Numberbox : Numberbox linebreak()
|
||||||
|
controlP5.Numberbox : Numberbox setDirection(int)
|
||||||
|
controlP5.Numberbox : Numberbox setMultiplier(float)
|
||||||
|
controlP5.Numberbox : Numberbox setRange(float, float)
|
||||||
|
controlP5.Numberbox : Numberbox setScrollSensitivity(float)
|
||||||
|
controlP5.Numberbox : Numberbox setValue(float)
|
||||||
|
controlP5.Numberbox : Numberbox shuffle()
|
||||||
|
controlP5.Numberbox : Numberbox update()
|
||||||
|
controlP5.Numberbox : float getMultiplier()
|
||||||
|
controlP5.Controller : CColor getColor()
|
||||||
|
controlP5.Controller : ControlBehavior getBehavior()
|
||||||
|
controlP5.Controller : ControlWindow getControlWindow()
|
||||||
|
controlP5.Controller : ControlWindow getWindow()
|
||||||
|
controlP5.Controller : ControllerProperty getProperty(String)
|
||||||
|
controlP5.Controller : ControllerProperty getProperty(String, String)
|
||||||
|
controlP5.Controller : Label getCaptionLabel()
|
||||||
|
controlP5.Controller : Label getValueLabel()
|
||||||
|
controlP5.Controller : List getControllerPlugList()
|
||||||
|
controlP5.Controller : Numberbox addCallback(CallbackListener)
|
||||||
|
controlP5.Controller : Numberbox addListener(ControlListener)
|
||||||
|
controlP5.Controller : Numberbox bringToFront()
|
||||||
|
controlP5.Controller : Numberbox bringToFront(ControllerInterface)
|
||||||
|
controlP5.Controller : Numberbox hide()
|
||||||
|
controlP5.Controller : Numberbox linebreak()
|
||||||
|
controlP5.Controller : Numberbox listen(boolean)
|
||||||
|
controlP5.Controller : Numberbox lock()
|
||||||
|
controlP5.Controller : Numberbox plugTo(Object)
|
||||||
|
controlP5.Controller : Numberbox plugTo(Object, String)
|
||||||
|
controlP5.Controller : Numberbox plugTo(Object[])
|
||||||
|
controlP5.Controller : Numberbox plugTo(Object[], String)
|
||||||
|
controlP5.Controller : Numberbox registerProperty(String)
|
||||||
|
controlP5.Controller : Numberbox registerProperty(String, String)
|
||||||
|
controlP5.Controller : Numberbox registerTooltip(String)
|
||||||
|
controlP5.Controller : Numberbox removeBehavior()
|
||||||
|
controlP5.Controller : Numberbox removeCallback()
|
||||||
|
controlP5.Controller : Numberbox removeCallback(CallbackListener)
|
||||||
|
controlP5.Controller : Numberbox removeListener(ControlListener)
|
||||||
|
controlP5.Controller : Numberbox removeProperty(String)
|
||||||
|
controlP5.Controller : Numberbox removeProperty(String, String)
|
||||||
|
controlP5.Controller : Numberbox setArrayValue(float[])
|
||||||
|
controlP5.Controller : Numberbox setArrayValue(int, float)
|
||||||
|
controlP5.Controller : Numberbox setBehavior(ControlBehavior)
|
||||||
|
controlP5.Controller : Numberbox setBroadcast(boolean)
|
||||||
|
controlP5.Controller : Numberbox setCaptionLabel(String)
|
||||||
|
controlP5.Controller : Numberbox setColor(CColor)
|
||||||
|
controlP5.Controller : Numberbox setColorActive(int)
|
||||||
|
controlP5.Controller : Numberbox setColorBackground(int)
|
||||||
|
controlP5.Controller : Numberbox setColorCaptionLabel(int)
|
||||||
|
controlP5.Controller : Numberbox setColorForeground(int)
|
||||||
|
controlP5.Controller : Numberbox setColorValueLabel(int)
|
||||||
|
controlP5.Controller : Numberbox setDecimalPrecision(int)
|
||||||
|
controlP5.Controller : Numberbox setDefaultValue(float)
|
||||||
|
controlP5.Controller : Numberbox setHeight(int)
|
||||||
|
controlP5.Controller : Numberbox setId(int)
|
||||||
|
controlP5.Controller : Numberbox setImages(PImage, PImage, PImage)
|
||||||
|
controlP5.Controller : Numberbox setImages(PImage, PImage, PImage, PImage)
|
||||||
|
controlP5.Controller : Numberbox setLabelVisible(boolean)
|
||||||
|
controlP5.Controller : Numberbox setLock(boolean)
|
||||||
|
controlP5.Controller : Numberbox setMax(float)
|
||||||
|
controlP5.Controller : Numberbox setMin(float)
|
||||||
|
controlP5.Controller : Numberbox setMouseOver(boolean)
|
||||||
|
controlP5.Controller : Numberbox setMoveable(boolean)
|
||||||
|
controlP5.Controller : Numberbox setPosition(PVector)
|
||||||
|
controlP5.Controller : Numberbox setPosition(float, float)
|
||||||
|
controlP5.Controller : Numberbox setSize(PImage)
|
||||||
|
controlP5.Controller : Numberbox setSize(int, int)
|
||||||
|
controlP5.Controller : Numberbox setStringValue(String)
|
||||||
|
controlP5.Controller : Numberbox setUpdate(boolean)
|
||||||
|
controlP5.Controller : Numberbox setValueLabel(String)
|
||||||
|
controlP5.Controller : Numberbox setView(ControllerView)
|
||||||
|
controlP5.Controller : Numberbox setVisible(boolean)
|
||||||
|
controlP5.Controller : Numberbox setWidth(int)
|
||||||
|
controlP5.Controller : Numberbox show()
|
||||||
|
controlP5.Controller : Numberbox unlock()
|
||||||
|
controlP5.Controller : Numberbox unplugFrom(Object)
|
||||||
|
controlP5.Controller : Numberbox unplugFrom(Object[])
|
||||||
|
controlP5.Controller : Numberbox unregisterTooltip()
|
||||||
|
controlP5.Controller : Numberbox update()
|
||||||
|
controlP5.Controller : Numberbox updateSize()
|
||||||
|
controlP5.Controller : PImage setImage(PImage)
|
||||||
|
controlP5.Controller : PImage setImage(PImage, int)
|
||||||
|
controlP5.Controller : PVector getAbsolutePosition()
|
||||||
|
controlP5.Controller : PVector getPosition()
|
||||||
|
controlP5.Controller : String getAddress()
|
||||||
|
controlP5.Controller : String getInfo()
|
||||||
|
controlP5.Controller : String getName()
|
||||||
|
controlP5.Controller : String getStringValue()
|
||||||
|
controlP5.Controller : String toString()
|
||||||
|
controlP5.Controller : Tab getTab()
|
||||||
|
controlP5.Controller : boolean isActive()
|
||||||
|
controlP5.Controller : boolean isBroadcast()
|
||||||
|
controlP5.Controller : boolean isInside()
|
||||||
|
controlP5.Controller : boolean isLabelVisible()
|
||||||
|
controlP5.Controller : boolean isListening()
|
||||||
|
controlP5.Controller : boolean isLock()
|
||||||
|
controlP5.Controller : boolean isMouseOver()
|
||||||
|
controlP5.Controller : boolean isMousePressed()
|
||||||
|
controlP5.Controller : boolean isMoveable()
|
||||||
|
controlP5.Controller : boolean isUpdate()
|
||||||
|
controlP5.Controller : boolean isVisible()
|
||||||
|
controlP5.Controller : float getArrayValue(int)
|
||||||
|
controlP5.Controller : float getDefaultValue()
|
||||||
|
controlP5.Controller : float getMax()
|
||||||
|
controlP5.Controller : float getMin()
|
||||||
|
controlP5.Controller : float getValue()
|
||||||
|
controlP5.Controller : float[] getArrayValue()
|
||||||
|
controlP5.Controller : int getDecimalPrecision()
|
||||||
|
controlP5.Controller : int getHeight()
|
||||||
|
controlP5.Controller : int getId()
|
||||||
|
controlP5.Controller : int getWidth()
|
||||||
|
controlP5.Controller : int listenerSize()
|
||||||
|
controlP5.Controller : void remove()
|
||||||
|
controlP5.Controller : void setView(ControllerView, int)
|
||||||
|
java.lang.Object : String toString()
|
||||||
|
java.lang.Object : boolean equals(Object)
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
163
examples/controllers/ControlP5properties/ControlP5properties.pde
Normal file
163
examples/controllers/ControlP5properties/ControlP5properties.pde
Normal file
@ -0,0 +1,163 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 Properties
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* saves controller values to a properties-file
|
||||||
|
* loads controller values from a properties-file
|
||||||
|
*
|
||||||
|
* Properties will only save values not the Controller itself.
|
||||||
|
*
|
||||||
|
* Also take a look at the use/ControlP5snapshot example to
|
||||||
|
* save controller values to memory.
|
||||||
|
*
|
||||||
|
* Use ControllerProperties to load and save serialized controller properties
|
||||||
|
* to a properties file.
|
||||||
|
* The controllers implementing save/load properties so far are
|
||||||
|
* Slider, Knob, Numberbox, Toggle, Checkbox, RadioButton, Textlabel,
|
||||||
|
* Matrix, Range, Textarea, ListBox, Dropdown, ColorPicker.
|
||||||
|
* Properties are currently saved in the java serialization format.
|
||||||
|
*
|
||||||
|
* saveProperties(String theFilename) and loadProperties(String theFilename)
|
||||||
|
* by default properties will be saved to your sketch folder as controlP5.ser
|
||||||
|
* if that file already exists it will be overwritten. for custom property files
|
||||||
|
* see the comments inside keyPressed() below.
|
||||||
|
*
|
||||||
|
* find a list of public methods available for the ControllerProperties class
|
||||||
|
* at the bottom of this sketch's source code
|
||||||
|
*
|
||||||
|
* default properties load/save key combinations are
|
||||||
|
* alt+shift+l to load properties
|
||||||
|
* alt+shift+s to save properties
|
||||||
|
*
|
||||||
|
* by andreas schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
public int myColor = color(0, 0, 0);
|
||||||
|
|
||||||
|
public int sliderValue = 100;
|
||||||
|
public int sliderTicks1 = 100;
|
||||||
|
public int sliderTicks2 = 30;
|
||||||
|
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(700, 400);
|
||||||
|
noStroke();
|
||||||
|
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
|
||||||
|
cp5.addSlider("slider")
|
||||||
|
.setBroadcast(false)
|
||||||
|
.setRange(0, 200)
|
||||||
|
.setPosition(20, 100)
|
||||||
|
.setSize(10, 100)
|
||||||
|
.setBroadcast(true)
|
||||||
|
.setValue(100)
|
||||||
|
;
|
||||||
|
|
||||||
|
cp5.addSlider("sliderTicks1")
|
||||||
|
.setRange(0, 255)
|
||||||
|
.setPosition(100, 100)
|
||||||
|
.setSize(10, 100)
|
||||||
|
.setNumberOfTickMarks(5)
|
||||||
|
;
|
||||||
|
|
||||||
|
cp5.addSlider("sliderValue")
|
||||||
|
.setRange(0, 255)
|
||||||
|
.setValue(128)
|
||||||
|
.setPosition(200, 180)
|
||||||
|
.setSize(100, 10)
|
||||||
|
;
|
||||||
|
|
||||||
|
cp5.addSlider("sliderTicks2")
|
||||||
|
.setRange(0, 255)
|
||||||
|
.setValue(128)
|
||||||
|
.setPosition(200, 220)
|
||||||
|
.setSize(100, 10)
|
||||||
|
.setNumberOfTickMarks(7)
|
||||||
|
.setSliderMode(Slider.FLEXIBLE)
|
||||||
|
;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(sliderTicks1);
|
||||||
|
|
||||||
|
fill(sliderValue);
|
||||||
|
rect(0, 0, width, 100);
|
||||||
|
|
||||||
|
fill(myColor);
|
||||||
|
rect(0, 300, width, 70);
|
||||||
|
|
||||||
|
fill(sliderTicks2);
|
||||||
|
rect(0, 370, width, 30);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void slider(float theColor) {
|
||||||
|
myColor = color(theColor);
|
||||||
|
println("a slider event. setting background to "+theColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
void keyPressed() {
|
||||||
|
// default properties load/save key combinations are
|
||||||
|
// alt+shift+l to load properties
|
||||||
|
// alt+shift+s to save properties
|
||||||
|
if (key=='1') {
|
||||||
|
cp5.saveProperties(("hello.properties"));
|
||||||
|
}
|
||||||
|
else if (key=='2') {
|
||||||
|
cp5.loadProperties(("hello.properties"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
a list of all methods available for the ControllerProperties Controller
|
||||||
|
use ControlP5.printPublicMethodsFor(ControllerProperties.class);
|
||||||
|
to print the following list into the console.
|
||||||
|
|
||||||
|
You can find further details about class ControllerProperties in the javadoc.
|
||||||
|
|
||||||
|
Format:
|
||||||
|
ClassName : returnType methodName(parameter type)
|
||||||
|
|
||||||
|
|
||||||
|
controlP5.ControllerProperties : ArrayList getSnapshotIndices()
|
||||||
|
controlP5.ControllerProperties : ControllerProperties addSet(String)
|
||||||
|
controlP5.ControllerProperties : ControllerProperties delete(ControllerProperty)
|
||||||
|
controlP5.ControllerProperties : ControllerProperties getSnapshot(String)
|
||||||
|
controlP5.ControllerProperties : ControllerProperties move(ControllerInterface, String, String)
|
||||||
|
controlP5.ControllerProperties : ControllerProperties move(ControllerProperty, String, String)
|
||||||
|
controlP5.ControllerProperties : ControllerProperties only(ControllerProperty, String)
|
||||||
|
controlP5.ControllerProperties : ControllerProperties print()
|
||||||
|
controlP5.ControllerProperties : ControllerProperties register(ControllerInterface, String)
|
||||||
|
controlP5.ControllerProperties : ControllerProperties remove(ControllerInterface)
|
||||||
|
controlP5.ControllerProperties : ControllerProperties remove(ControllerInterface, String)
|
||||||
|
controlP5.ControllerProperties : ControllerProperties remove(ControllerInterface, String, String)
|
||||||
|
controlP5.ControllerProperties : ControllerProperties removeSnapshot(String)
|
||||||
|
controlP5.ControllerProperties : ControllerProperties saveSnapshot(String)
|
||||||
|
controlP5.ControllerProperties : ControllerProperties saveSnapshotAs(String, String)
|
||||||
|
controlP5.ControllerProperties : ControllerProperties setSnapshot(String)
|
||||||
|
controlP5.ControllerProperties : ControllerProperties updateSnapshot(String)
|
||||||
|
controlP5.ControllerProperties : ControllerProperty getProperty(ControllerInterface, String)
|
||||||
|
controlP5.ControllerProperties : ControllerProperty getProperty(ControllerInterface, String, String)
|
||||||
|
controlP5.ControllerProperties : ControllerProperty register(ControllerInterface, String, String)
|
||||||
|
controlP5.ControllerProperties : HashSet getPropertySet(ControllerInterface)
|
||||||
|
controlP5.ControllerProperties : List get(ControllerInterface)
|
||||||
|
controlP5.ControllerProperties : Map get()
|
||||||
|
controlP5.ControllerProperties : String toString()
|
||||||
|
controlP5.ControllerProperties : boolean load()
|
||||||
|
controlP5.ControllerProperties : boolean load(String)
|
||||||
|
controlP5.ControllerProperties : boolean save()
|
||||||
|
controlP5.ControllerProperties : boolean saveAs(String)
|
||||||
|
controlP5.ControllerProperties : void setFormat(Format)
|
||||||
|
java.lang.Object : String toString()
|
||||||
|
java.lang.Object : boolean equals(Object)
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"/sliderValue": {
|
||||||
|
"min": 0,
|
||||||
|
"max": 255,
|
||||||
|
"value": 128
|
||||||
|
},
|
||||||
|
"/slider": {
|
||||||
|
"min": 0,
|
||||||
|
"max": 200,
|
||||||
|
"value": 100
|
||||||
|
},
|
||||||
|
"/sliderTicks1": {
|
||||||
|
"min": 0,
|
||||||
|
"max": 255,
|
||||||
|
"value": 127.5
|
||||||
|
},
|
||||||
|
"/sliderTicks2": {
|
||||||
|
"min": 0,
|
||||||
|
"max": 255,
|
||||||
|
"value": 127.5
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,216 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 RadioButton
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* find a list of public methods available for the RadioButton Controller
|
||||||
|
* at the bottom of this sketch.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
int myColorBackground = color(0,0,0);
|
||||||
|
|
||||||
|
RadioButton r;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(700,400);
|
||||||
|
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
r = cp5.addRadioButton("radioButton")
|
||||||
|
.setPosition(20,160)
|
||||||
|
.setSize(40,20)
|
||||||
|
.setColorForeground(color(120))
|
||||||
|
.setColorActive(color(255))
|
||||||
|
.setColorLabel(color(255))
|
||||||
|
.setItemsPerRow(5)
|
||||||
|
.setSpacingColumn(50)
|
||||||
|
.addItem("50",1)
|
||||||
|
.addItem("100",2)
|
||||||
|
.addItem("150",3)
|
||||||
|
.addItem("200",4)
|
||||||
|
.addItem("250",5)
|
||||||
|
;
|
||||||
|
|
||||||
|
for(Toggle t:r.getItems()) {
|
||||||
|
t.getCaptionLabel().setColorBackground(color(255,80));
|
||||||
|
t.getCaptionLabel().style().moveMargin(-7,0,0,-3);
|
||||||
|
t.getCaptionLabel().style().movePadding(7,0,0,3);
|
||||||
|
t.getCaptionLabel().style().backgroundWidth = 45;
|
||||||
|
t.getCaptionLabel().style().backgroundHeight = 13;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(myColorBackground);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void keyPressed() {
|
||||||
|
switch(key) {
|
||||||
|
case('0'): r.deactivateAll(); break;
|
||||||
|
case('1'): r.activate(0); break;
|
||||||
|
case('2'): r.activate(1); break;
|
||||||
|
case('3'): r.activate(2); break;
|
||||||
|
case('4'): r.activate(3); break;
|
||||||
|
case('5'): r.activate(4); break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void controlEvent(ControlEvent theEvent) {
|
||||||
|
if(theEvent.isFrom(r)) {
|
||||||
|
print("got an event from "+theEvent.getName()+"\t");
|
||||||
|
for(int i=0;i<theEvent.getGroup().getArrayValue().length;i++) {
|
||||||
|
print(int(theEvent.getGroup().getArrayValue()[i]));
|
||||||
|
}
|
||||||
|
println("\t "+theEvent.getValue());
|
||||||
|
myColorBackground = color(int(theEvent.getGroup().getValue()*50),0,0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void radioButton(int a) {
|
||||||
|
println("a radio Button event: "+a);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
a list of all methods available for the RadioButton Controller
|
||||||
|
use ControlP5.printPublicMethodsFor(RadioButton.class);
|
||||||
|
to print the following list into the console.
|
||||||
|
|
||||||
|
You can find further details about class RadioButton in the javadoc.
|
||||||
|
|
||||||
|
Format:
|
||||||
|
ClassName : returnType methodName(parameter type)
|
||||||
|
|
||||||
|
controlP5.RadioButton : List getItems()
|
||||||
|
controlP5.RadioButton : RadioButton activate(String)
|
||||||
|
controlP5.RadioButton : RadioButton activate(int)
|
||||||
|
controlP5.RadioButton : RadioButton addItem(String, float)
|
||||||
|
controlP5.RadioButton : RadioButton addItem(Toggle, float)
|
||||||
|
controlP5.RadioButton : RadioButton deactivate(String)
|
||||||
|
controlP5.RadioButton : RadioButton deactivate(int)
|
||||||
|
controlP5.RadioButton : RadioButton deactivateAll()
|
||||||
|
controlP5.RadioButton : RadioButton hideLabels()
|
||||||
|
controlP5.RadioButton : RadioButton removeItem(String)
|
||||||
|
controlP5.RadioButton : RadioButton setArrayValue(float[])
|
||||||
|
controlP5.RadioButton : RadioButton setColorLabels(int)
|
||||||
|
controlP5.RadioButton : RadioButton setImage(PImage)
|
||||||
|
controlP5.RadioButton : RadioButton setImage(PImage, int)
|
||||||
|
controlP5.RadioButton : RadioButton setImages(PImage, PImage, PImage)
|
||||||
|
controlP5.RadioButton : RadioButton setItemHeight(int)
|
||||||
|
controlP5.RadioButton : RadioButton setItemWidth(int)
|
||||||
|
controlP5.RadioButton : RadioButton setItemsPerRow(int)
|
||||||
|
controlP5.RadioButton : RadioButton setNoneSelectedAllowed(boolean)
|
||||||
|
controlP5.RadioButton : RadioButton setSize(PImage)
|
||||||
|
controlP5.RadioButton : RadioButton setSize(int, int)
|
||||||
|
controlP5.RadioButton : RadioButton setSpacingColumn(int)
|
||||||
|
controlP5.RadioButton : RadioButton setSpacingRow(int)
|
||||||
|
controlP5.RadioButton : RadioButton showLabels()
|
||||||
|
controlP5.RadioButton : RadioButton toUpperCase(boolean)
|
||||||
|
controlP5.RadioButton : RadioButton toggle(int)
|
||||||
|
controlP5.RadioButton : String getInfo()
|
||||||
|
controlP5.RadioButton : Toggle getItem(int)
|
||||||
|
controlP5.RadioButton : boolean getState(String)
|
||||||
|
controlP5.RadioButton : boolean getState(int)
|
||||||
|
controlP5.RadioButton : void updateLayout()
|
||||||
|
controlP5.ControlGroup : RadioButton activateEvent(boolean)
|
||||||
|
controlP5.ControlGroup : RadioButton addListener(ControlListener)
|
||||||
|
controlP5.ControlGroup : RadioButton hideBar()
|
||||||
|
controlP5.ControlGroup : RadioButton removeListener(ControlListener)
|
||||||
|
controlP5.ControlGroup : RadioButton setBackgroundColor(int)
|
||||||
|
controlP5.ControlGroup : RadioButton setBackgroundHeight(int)
|
||||||
|
controlP5.ControlGroup : RadioButton setBarHeight(int)
|
||||||
|
controlP5.ControlGroup : RadioButton showBar()
|
||||||
|
controlP5.ControlGroup : RadioButton updateInternalEvents(PApplet)
|
||||||
|
controlP5.ControlGroup : String getInfo()
|
||||||
|
controlP5.ControlGroup : String toString()
|
||||||
|
controlP5.ControlGroup : boolean isBarVisible()
|
||||||
|
controlP5.ControlGroup : int getBackgroundHeight()
|
||||||
|
controlP5.ControlGroup : int getBarHeight()
|
||||||
|
controlP5.ControlGroup : int listenerSize()
|
||||||
|
controlP5.ControllerGroup : CColor getColor()
|
||||||
|
controlP5.ControllerGroup : ControlWindow getWindow()
|
||||||
|
controlP5.ControllerGroup : ControlWindowCanvas addCanvas(ControlWindowCanvas)
|
||||||
|
controlP5.ControllerGroup : Controller getController(String)
|
||||||
|
controlP5.ControllerGroup : ControllerProperty getProperty(String)
|
||||||
|
controlP5.ControllerGroup : ControllerProperty getProperty(String, String)
|
||||||
|
controlP5.ControllerGroup : Label getCaptionLabel()
|
||||||
|
controlP5.ControllerGroup : Label getValueLabel()
|
||||||
|
controlP5.ControllerGroup : PVector getPosition()
|
||||||
|
controlP5.ControllerGroup : RadioButton add(ControllerInterface)
|
||||||
|
controlP5.ControllerGroup : RadioButton bringToFront()
|
||||||
|
controlP5.ControllerGroup : RadioButton bringToFront(ControllerInterface)
|
||||||
|
controlP5.ControllerGroup : RadioButton close()
|
||||||
|
controlP5.ControllerGroup : RadioButton disableCollapse()
|
||||||
|
controlP5.ControllerGroup : RadioButton enableCollapse()
|
||||||
|
controlP5.ControllerGroup : RadioButton hide()
|
||||||
|
controlP5.ControllerGroup : RadioButton moveTo(ControlWindow)
|
||||||
|
controlP5.ControllerGroup : RadioButton moveTo(PApplet)
|
||||||
|
controlP5.ControllerGroup : RadioButton open()
|
||||||
|
controlP5.ControllerGroup : RadioButton registerProperty(String)
|
||||||
|
controlP5.ControllerGroup : RadioButton registerProperty(String, String)
|
||||||
|
controlP5.ControllerGroup : RadioButton remove(CDrawable)
|
||||||
|
controlP5.ControllerGroup : RadioButton remove(ControllerInterface)
|
||||||
|
controlP5.ControllerGroup : RadioButton removeCanvas(ControlWindowCanvas)
|
||||||
|
controlP5.ControllerGroup : RadioButton removeProperty(String)
|
||||||
|
controlP5.ControllerGroup : RadioButton removeProperty(String, String)
|
||||||
|
controlP5.ControllerGroup : RadioButton setAddress(String)
|
||||||
|
controlP5.ControllerGroup : RadioButton setArrayValue(float[])
|
||||||
|
controlP5.ControllerGroup : RadioButton setColor(CColor)
|
||||||
|
controlP5.ControllerGroup : RadioButton setColorActive(int)
|
||||||
|
controlP5.ControllerGroup : RadioButton setColorBackground(int)
|
||||||
|
controlP5.ControllerGroup : RadioButton setColorForeground(int)
|
||||||
|
controlP5.ControllerGroup : RadioButton setColorLabel(int)
|
||||||
|
controlP5.ControllerGroup : RadioButton setColorValue(int)
|
||||||
|
controlP5.ControllerGroup : RadioButton setHeight(int)
|
||||||
|
controlP5.ControllerGroup : RadioButton setId(int)
|
||||||
|
controlP5.ControllerGroup : RadioButton setLabel(String)
|
||||||
|
controlP5.ControllerGroup : RadioButton setMouseOver(boolean)
|
||||||
|
controlP5.ControllerGroup : RadioButton setMoveable(boolean)
|
||||||
|
controlP5.ControllerGroup : RadioButton setOpen(boolean)
|
||||||
|
controlP5.ControllerGroup : RadioButton setPosition(PVector)
|
||||||
|
controlP5.ControllerGroup : RadioButton setPosition(float, float)
|
||||||
|
controlP5.ControllerGroup : RadioButton setStringValue(String)
|
||||||
|
controlP5.ControllerGroup : RadioButton setUpdate(boolean)
|
||||||
|
controlP5.ControllerGroup : RadioButton setValue(float)
|
||||||
|
controlP5.ControllerGroup : RadioButton setVisible(boolean)
|
||||||
|
controlP5.ControllerGroup : RadioButton setWidth(int)
|
||||||
|
controlP5.ControllerGroup : RadioButton show()
|
||||||
|
controlP5.ControllerGroup : RadioButton update()
|
||||||
|
controlP5.ControllerGroup : RadioButton updateAbsolutePosition()
|
||||||
|
controlP5.ControllerGroup : String getAddress()
|
||||||
|
controlP5.ControllerGroup : String getInfo()
|
||||||
|
controlP5.ControllerGroup : String getName()
|
||||||
|
controlP5.ControllerGroup : String getStringValue()
|
||||||
|
controlP5.ControllerGroup : String toString()
|
||||||
|
controlP5.ControllerGroup : Tab getTab()
|
||||||
|
controlP5.ControllerGroup : boolean isCollapse()
|
||||||
|
controlP5.ControllerGroup : boolean isMouseOver()
|
||||||
|
controlP5.ControllerGroup : boolean isMoveable()
|
||||||
|
controlP5.ControllerGroup : boolean isOpen()
|
||||||
|
controlP5.ControllerGroup : boolean isUpdate()
|
||||||
|
controlP5.ControllerGroup : boolean isVisible()
|
||||||
|
controlP5.ControllerGroup : boolean setMousePressed(boolean)
|
||||||
|
controlP5.ControllerGroup : float getValue()
|
||||||
|
controlP5.ControllerGroup : float[] getArrayValue()
|
||||||
|
controlP5.ControllerGroup : int getHeight()
|
||||||
|
controlP5.ControllerGroup : int getId()
|
||||||
|
controlP5.ControllerGroup : int getWidth()
|
||||||
|
controlP5.ControllerGroup : void remove()
|
||||||
|
java.lang.Object : String toString()
|
||||||
|
java.lang.Object : boolean equals(Object)
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
219
examples/controllers/ControlP5range/ControlP5range.pde
Normal file
219
examples/controllers/ControlP5range/ControlP5range.pde
Normal file
@ -0,0 +1,219 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 Range
|
||||||
|
*
|
||||||
|
* find a list of public methods available for the Range Controller
|
||||||
|
* at the bottom of this sketch.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
int myColorBackground = color(0,0,0);
|
||||||
|
|
||||||
|
int colorMin = 100;
|
||||||
|
|
||||||
|
int colorMax = 100;
|
||||||
|
|
||||||
|
Range range;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(700,400);
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
range = cp5.addRange("rangeController")
|
||||||
|
// disable broadcasting since setRange and setRangeValues will trigger an event
|
||||||
|
.setBroadcast(false)
|
||||||
|
.setPosition(50,50)
|
||||||
|
.setSize(400,40)
|
||||||
|
.setHandleSize(20)
|
||||||
|
.setRange(0,255)
|
||||||
|
.setRangeValues(50,100)
|
||||||
|
// after the initialization we turn broadcast back on again
|
||||||
|
.setBroadcast(true)
|
||||||
|
.setColorForeground(color(255,40))
|
||||||
|
.setColorBackground(color(255,40))
|
||||||
|
;
|
||||||
|
|
||||||
|
noStroke();
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(colorMax);
|
||||||
|
fill(colorMin);
|
||||||
|
rect(0,0,width,height/2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void controlEvent(ControlEvent theControlEvent) {
|
||||||
|
if(theControlEvent.isFrom("rangeController")) {
|
||||||
|
// min and max values are stored in an array.
|
||||||
|
// access this array with controller().arrayValue().
|
||||||
|
// min is at index 0, max is at index 1.
|
||||||
|
colorMin = int(theControlEvent.getController().getArrayValue(0));
|
||||||
|
colorMax = int(theControlEvent.getController().getArrayValue(1));
|
||||||
|
println("range update, done.");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void keyPressed() {
|
||||||
|
switch(key) {
|
||||||
|
case('1'):range.setLowValue(0);break;
|
||||||
|
case('2'):range.setLowValue(100);break;
|
||||||
|
case('3'):range.setHighValue(120);break;
|
||||||
|
case('4'):range.setHighValue(200);break;
|
||||||
|
case('5'):range.setRangeValues(40,60);break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
a list of all methods available for the Range Controller
|
||||||
|
use ControlP5.printPublicMethodsFor(Range.class);
|
||||||
|
to print the following list into the console.
|
||||||
|
|
||||||
|
You can find further details about class Range in the javadoc.
|
||||||
|
|
||||||
|
Format:
|
||||||
|
ClassName : returnType methodName(parameter type)
|
||||||
|
|
||||||
|
|
||||||
|
controlP5.Range : Range setArrayValue(float[])
|
||||||
|
controlP5.Range : Range setColorCaptionLabel(int)
|
||||||
|
controlP5.Range : Range setColorTickMark(int)
|
||||||
|
controlP5.Range : Range setColorValueLabel(int)
|
||||||
|
controlP5.Range : Range setHandleSize(int)
|
||||||
|
controlP5.Range : Range setHeight(int)
|
||||||
|
controlP5.Range : Range setHighValue(float)
|
||||||
|
controlP5.Range : Range setHighValueLabel(String)
|
||||||
|
controlP5.Range : Range setLowValue(float)
|
||||||
|
controlP5.Range : Range setLowValueLabel(String)
|
||||||
|
controlP5.Range : Range setMax(float)
|
||||||
|
controlP5.Range : Range setMin(float)
|
||||||
|
controlP5.Range : Range setNumberOfTickMarks(int)
|
||||||
|
controlP5.Range : Range setRange(float, float)
|
||||||
|
controlP5.Range : Range setRangeValues(float, float)
|
||||||
|
controlP5.Range : Range setWidth(int)
|
||||||
|
controlP5.Range : Range showTickMarks(boolean)
|
||||||
|
controlP5.Range : Range snapToTickMarks(boolean)
|
||||||
|
controlP5.Range : ArrayList getTickMarks()
|
||||||
|
controlP5.Range : float getHighValue()
|
||||||
|
controlP5.Range : float getLowValue()
|
||||||
|
controlP5.Range : float[] getArrayValue()
|
||||||
|
controlP5.Controller : CColor getColor()
|
||||||
|
controlP5.Controller : ControlBehavior getBehavior()
|
||||||
|
controlP5.Controller : ControlWindow getControlWindow()
|
||||||
|
controlP5.Controller : ControlWindow getWindow()
|
||||||
|
controlP5.Controller : ControllerProperty getProperty(String)
|
||||||
|
controlP5.Controller : ControllerProperty getProperty(String, String)
|
||||||
|
controlP5.Controller : Label getCaptionLabel()
|
||||||
|
controlP5.Controller : Label getValueLabel()
|
||||||
|
controlP5.Controller : List getControllerPlugList()
|
||||||
|
controlP5.Controller : PImage setImage(PImage)
|
||||||
|
controlP5.Controller : PImage setImage(PImage, int)
|
||||||
|
controlP5.Controller : PVector getAbsolutePosition()
|
||||||
|
controlP5.Controller : PVector getPosition()
|
||||||
|
controlP5.Controller : Range addCallback(CallbackListener)
|
||||||
|
controlP5.Controller : Range addListener(ControlListener)
|
||||||
|
controlP5.Controller : Range bringToFront()
|
||||||
|
controlP5.Controller : Range bringToFront(ControllerInterface)
|
||||||
|
controlP5.Controller : Range hide()
|
||||||
|
controlP5.Controller : Range linebreak()
|
||||||
|
controlP5.Controller : Range listen(boolean)
|
||||||
|
controlP5.Controller : Range lock()
|
||||||
|
controlP5.Controller : Range plugTo(Object)
|
||||||
|
controlP5.Controller : Range plugTo(Object, String)
|
||||||
|
controlP5.Controller : Range plugTo(Object[])
|
||||||
|
controlP5.Controller : Range plugTo(Object[], String)
|
||||||
|
controlP5.Controller : Range registerProperty(String)
|
||||||
|
controlP5.Controller : Range registerProperty(String, String)
|
||||||
|
controlP5.Controller : Range registerTooltip(String)
|
||||||
|
controlP5.Controller : Range removeBehavior()
|
||||||
|
controlP5.Controller : Range removeCallback()
|
||||||
|
controlP5.Controller : Range removeCallback(CallbackListener)
|
||||||
|
controlP5.Controller : Range removeListener(ControlListener)
|
||||||
|
controlP5.Controller : Range removeProperty(String)
|
||||||
|
controlP5.Controller : Range removeProperty(String, String)
|
||||||
|
controlP5.Controller : Range setArrayValue(float[])
|
||||||
|
controlP5.Controller : Range setArrayValue(int, float)
|
||||||
|
controlP5.Controller : Range setBehavior(ControlBehavior)
|
||||||
|
controlP5.Controller : Range setBroadcast(boolean)
|
||||||
|
controlP5.Controller : Range setCaptionLabel(String)
|
||||||
|
controlP5.Controller : Range setColor(CColor)
|
||||||
|
controlP5.Controller : Range setColorActive(int)
|
||||||
|
controlP5.Controller : Range setColorBackground(int)
|
||||||
|
controlP5.Controller : Range setColorCaptionLabel(int)
|
||||||
|
controlP5.Controller : Range setColorForeground(int)
|
||||||
|
controlP5.Controller : Range setColorValueLabel(int)
|
||||||
|
controlP5.Controller : Range setDecimalPrecision(int)
|
||||||
|
controlP5.Controller : Range setDefaultValue(float)
|
||||||
|
controlP5.Controller : Range setHeight(int)
|
||||||
|
controlP5.Controller : Range setId(int)
|
||||||
|
controlP5.Controller : Range setImages(PImage, PImage, PImage)
|
||||||
|
controlP5.Controller : Range setImages(PImage, PImage, PImage, PImage)
|
||||||
|
controlP5.Controller : Range setLabelVisible(boolean)
|
||||||
|
controlP5.Controller : Range setLock(boolean)
|
||||||
|
controlP5.Controller : Range setMax(float)
|
||||||
|
controlP5.Controller : Range setMin(float)
|
||||||
|
controlP5.Controller : Range setMouseOver(boolean)
|
||||||
|
controlP5.Controller : Range setMoveable(boolean)
|
||||||
|
controlP5.Controller : Range setPosition(PVector)
|
||||||
|
controlP5.Controller : Range setPosition(float, float)
|
||||||
|
controlP5.Controller : Range setSize(PImage)
|
||||||
|
controlP5.Controller : Range setSize(int, int)
|
||||||
|
controlP5.Controller : Range setStringValue(String)
|
||||||
|
controlP5.Controller : Range setUpdate(boolean)
|
||||||
|
controlP5.Controller : Range setValueLabel(String)
|
||||||
|
controlP5.Controller : Range setView(ControllerView)
|
||||||
|
controlP5.Controller : Range setVisible(boolean)
|
||||||
|
controlP5.Controller : Range setWidth(int)
|
||||||
|
controlP5.Controller : Range show()
|
||||||
|
controlP5.Controller : Range unlock()
|
||||||
|
controlP5.Controller : Range unplugFrom(Object)
|
||||||
|
controlP5.Controller : Range unplugFrom(Object[])
|
||||||
|
controlP5.Controller : Range unregisterTooltip()
|
||||||
|
controlP5.Controller : Range update()
|
||||||
|
controlP5.Controller : Range updateSize()
|
||||||
|
controlP5.Controller : String getAddress()
|
||||||
|
controlP5.Controller : String getInfo()
|
||||||
|
controlP5.Controller : String getName()
|
||||||
|
controlP5.Controller : String getStringValue()
|
||||||
|
controlP5.Controller : String toString()
|
||||||
|
controlP5.Controller : Tab getTab()
|
||||||
|
controlP5.Controller : boolean isActive()
|
||||||
|
controlP5.Controller : boolean isBroadcast()
|
||||||
|
controlP5.Controller : boolean isInside()
|
||||||
|
controlP5.Controller : boolean isLabelVisible()
|
||||||
|
controlP5.Controller : boolean isListening()
|
||||||
|
controlP5.Controller : boolean isLock()
|
||||||
|
controlP5.Controller : boolean isMouseOver()
|
||||||
|
controlP5.Controller : boolean isMousePressed()
|
||||||
|
controlP5.Controller : boolean isMoveable()
|
||||||
|
controlP5.Controller : boolean isUpdate()
|
||||||
|
controlP5.Controller : boolean isVisible()
|
||||||
|
controlP5.Controller : float getArrayValue(int)
|
||||||
|
controlP5.Controller : float getDefaultValue()
|
||||||
|
controlP5.Controller : float getMax()
|
||||||
|
controlP5.Controller : float getMin()
|
||||||
|
controlP5.Controller : float getValue()
|
||||||
|
controlP5.Controller : float[] getArrayValue()
|
||||||
|
controlP5.Controller : int getDecimalPrecision()
|
||||||
|
controlP5.Controller : int getHeight()
|
||||||
|
controlP5.Controller : int getId()
|
||||||
|
controlP5.Controller : int getWidth()
|
||||||
|
controlP5.Controller : int listenerSize()
|
||||||
|
controlP5.Controller : void remove()
|
||||||
|
controlP5.Controller : void setView(ControllerView, int)
|
||||||
|
java.lang.Object : String toString()
|
||||||
|
java.lang.Object : boolean equals(Object)
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,83 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 ScrollableList
|
||||||
|
*
|
||||||
|
* replaces DropdownList and and ListBox.
|
||||||
|
* List can be scrolled by dragging the list or using the scroll-wheel.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2014
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400, 400);
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
List l = Arrays.asList("a", "b", "c", "d", "e", "f", "g", "h");
|
||||||
|
/* add a ScrollableList, by default it behaves like a DropdownList */
|
||||||
|
cp5.addScrollableList("dropdown")
|
||||||
|
.setPosition(100, 100)
|
||||||
|
.setSize(200, 100)
|
||||||
|
.setBarHeight(20)
|
||||||
|
.setItemHeight(20)
|
||||||
|
.addItems(l)
|
||||||
|
// .setType(ScrollableList.LIST) // currently supported DROPDOWN and LIST
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(240);
|
||||||
|
}
|
||||||
|
|
||||||
|
void dropdown(int n) {
|
||||||
|
/* request the selected item based on index n */
|
||||||
|
println(n, cp5.get(ScrollableList.class, "dropdown").getItem(n));
|
||||||
|
|
||||||
|
/* here an item is stored as a Map with the following key-value pairs:
|
||||||
|
* name, the given name of the item
|
||||||
|
* text, the given text of the item by default the same as name
|
||||||
|
* value, the given value of the item, can be changed by using .getItem(n).put("value", "abc"); a value here is of type Object therefore can be anything
|
||||||
|
* color, the given color of the item, how to change, see below
|
||||||
|
* view, a customizable view, is of type CDrawable
|
||||||
|
*/
|
||||||
|
|
||||||
|
CColor c = new CColor();
|
||||||
|
c.setBackground(color(255,0,0));
|
||||||
|
cp5.get(ScrollableList.class, "dropdown").getItem(n).put("color", c);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void keyPressed() {
|
||||||
|
switch(key) {
|
||||||
|
case('1'):
|
||||||
|
/* make the ScrollableList behave like a ListBox */
|
||||||
|
cp5.get(ScrollableList.class, "dropdown").setType(ControlP5.LIST);
|
||||||
|
break;
|
||||||
|
case('2'):
|
||||||
|
/* make the ScrollableList behave like a DropdownList */
|
||||||
|
cp5.get(ScrollableList.class, "dropdown").setType(ControlP5.DROPDOWN);
|
||||||
|
break;
|
||||||
|
case('3'):
|
||||||
|
/*change content of the ScrollableList */
|
||||||
|
List l = Arrays.asList("a-1", "b-1", "c-1", "d-1", "e-1", "f-1", "g-1", "h-1", "i-1", "j-1", "k-1");
|
||||||
|
cp5.get(ScrollableList.class, "dropdown").setItems(l);
|
||||||
|
break;
|
||||||
|
case('4'):
|
||||||
|
/* remove an item from the ScrollableList */
|
||||||
|
cp5.get(ScrollableList.class, "dropdown").removeItem("k-1");
|
||||||
|
break;
|
||||||
|
case('5'):
|
||||||
|
/* clear the ScrollableList */
|
||||||
|
cp5.get(ScrollableList.class, "dropdown").clear();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
269
examples/controllers/ControlP5slider/ControlP5slider.pde
Normal file
269
examples/controllers/ControlP5slider/ControlP5slider.pde
Normal file
@ -0,0 +1,269 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 Slider. Horizontal and vertical sliders,
|
||||||
|
* with and without tick marks and snap-to-tick behavior.
|
||||||
|
* by andreas schlegel, 2010
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ControlP5 Slider
|
||||||
|
*
|
||||||
|
* Horizontal and vertical sliders,
|
||||||
|
* With and without tick marks and snap-to-tick behavior.
|
||||||
|
*
|
||||||
|
* find a list of public methods available for the Slider Controller
|
||||||
|
* at the bottom of this sketch.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
int myColor = color(0,0,0);
|
||||||
|
|
||||||
|
int sliderValue = 100;
|
||||||
|
int sliderTicks1 = 100;
|
||||||
|
int sliderTicks2 = 30;
|
||||||
|
Slider abc;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(700,400);
|
||||||
|
noStroke();
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
|
||||||
|
// add a horizontal sliders, the value of this slider will be linked
|
||||||
|
// to variable 'sliderValue'
|
||||||
|
cp5.addSlider("sliderValue")
|
||||||
|
.setPosition(100,50)
|
||||||
|
.setRange(0,255)
|
||||||
|
;
|
||||||
|
|
||||||
|
// create another slider with tick marks, now without
|
||||||
|
// default value, the initial value will be set according to
|
||||||
|
// the value of variable sliderTicks2 then.
|
||||||
|
cp5.addSlider("sliderTicks1")
|
||||||
|
.setPosition(100,140)
|
||||||
|
.setSize(20,100)
|
||||||
|
.setRange(0,255)
|
||||||
|
.setNumberOfTickMarks(5)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
// add a vertical slider
|
||||||
|
cp5.addSlider("slider")
|
||||||
|
.setPosition(100,305)
|
||||||
|
.setSize(200,20)
|
||||||
|
.setRange(0,200)
|
||||||
|
.setValue(128)
|
||||||
|
;
|
||||||
|
|
||||||
|
// reposition the Label for controller 'slider'
|
||||||
|
cp5.getController("slider").getValueLabel().align(ControlP5.LEFT, ControlP5.BOTTOM_OUTSIDE).setPaddingX(0);
|
||||||
|
cp5.getController("slider").getCaptionLabel().align(ControlP5.RIGHT, ControlP5.BOTTOM_OUTSIDE).setPaddingX(0);
|
||||||
|
|
||||||
|
|
||||||
|
cp5.addSlider("sliderTicks2")
|
||||||
|
.setPosition(100,370)
|
||||||
|
.setWidth(400)
|
||||||
|
.setRange(255,0) // values can range from big to small as well
|
||||||
|
.setValue(128)
|
||||||
|
.setNumberOfTickMarks(7)
|
||||||
|
.setSliderMode(Slider.FLEXIBLE)
|
||||||
|
;
|
||||||
|
// use Slider.FIX or Slider.FLEXIBLE to change the slider handle
|
||||||
|
// by default it is Slider.FIX
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(sliderTicks1);
|
||||||
|
|
||||||
|
fill(sliderValue);
|
||||||
|
rect(0,0,width,100);
|
||||||
|
|
||||||
|
fill(myColor);
|
||||||
|
rect(0,280,width,70);
|
||||||
|
|
||||||
|
fill(sliderTicks2);
|
||||||
|
rect(0,350,width,50);
|
||||||
|
}
|
||||||
|
|
||||||
|
void slider(float theColor) {
|
||||||
|
myColor = color(theColor);
|
||||||
|
println("a slider event. setting background to "+theColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ControlP5 Slider
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* find a list of public methods available for the Slider Controller
|
||||||
|
* at the bottom of this sketch.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
a list of all methods available for the Slider Controller
|
||||||
|
use ControlP5.printPublicMethodsFor(Slider.class);
|
||||||
|
to print the following list into the console.
|
||||||
|
|
||||||
|
You can find further details about class Slider in the javadoc.
|
||||||
|
|
||||||
|
Format:
|
||||||
|
ClassName : returnType methodName(parameter type)
|
||||||
|
|
||||||
|
controlP5.Slider : ArrayList getTickMarks()
|
||||||
|
controlP5.Slider : Slider setColorTickMark(int)
|
||||||
|
controlP5.Slider : Slider setHandleSize(int)
|
||||||
|
controlP5.Slider : Slider setHeight(int)
|
||||||
|
controlP5.Slider : Slider setMax(float)
|
||||||
|
controlP5.Slider : Slider setMin(float)
|
||||||
|
controlP5.Slider : Slider setNumberOfTickMarks(int)
|
||||||
|
controlP5.Slider : Slider setRange(float, float)
|
||||||
|
controlP5.Slider : Slider setScrollSensitivity(float)
|
||||||
|
controlP5.Slider : Slider setSize(int, int)
|
||||||
|
controlP5.Slider : Slider setSliderMode(int)
|
||||||
|
controlP5.Slider : Slider setTriggerEvent(int)
|
||||||
|
controlP5.Slider : Slider setValue(float)
|
||||||
|
controlP5.Slider : Slider setWidth(int)
|
||||||
|
controlP5.Slider : Slider showTickMarks(boolean)
|
||||||
|
controlP5.Slider : Slider shuffle()
|
||||||
|
controlP5.Slider : Slider snapToTickMarks(boolean)
|
||||||
|
controlP5.Slider : Slider update()
|
||||||
|
controlP5.Slider : TickMark getTickMark(int)
|
||||||
|
controlP5.Slider : float getValue()
|
||||||
|
controlP5.Slider : float getValuePosition()
|
||||||
|
controlP5.Slider : int getDirection()
|
||||||
|
controlP5.Slider : int getHandleSize()
|
||||||
|
controlP5.Slider : int getNumberOfTickMarks()
|
||||||
|
controlP5.Slider : int getSliderMode()
|
||||||
|
controlP5.Slider : int getTriggerEvent()
|
||||||
|
controlP5.Controller : CColor getColor()
|
||||||
|
controlP5.Controller : ControlBehavior getBehavior()
|
||||||
|
controlP5.Controller : ControlWindow getControlWindow()
|
||||||
|
controlP5.Controller : ControlWindow getWindow()
|
||||||
|
controlP5.Controller : ControllerProperty getProperty(String)
|
||||||
|
controlP5.Controller : ControllerProperty getProperty(String, String)
|
||||||
|
controlP5.Controller : Label getCaptionLabel()
|
||||||
|
controlP5.Controller : Label getValueLabel()
|
||||||
|
controlP5.Controller : List getControllerPlugList()
|
||||||
|
controlP5.Controller : PImage setImage(PImage)
|
||||||
|
controlP5.Controller : PImage setImage(PImage, int)
|
||||||
|
controlP5.Controller : PVector getAbsolutePosition()
|
||||||
|
controlP5.Controller : PVector getPosition()
|
||||||
|
controlP5.Controller : Slider addCallback(CallbackListener)
|
||||||
|
controlP5.Controller : Slider addListener(ControlListener)
|
||||||
|
controlP5.Controller : Slider bringToFront()
|
||||||
|
controlP5.Controller : Slider bringToFront(ControllerInterface)
|
||||||
|
controlP5.Controller : Slider hide()
|
||||||
|
controlP5.Controller : Slider linebreak()
|
||||||
|
controlP5.Controller : Slider listen(boolean)
|
||||||
|
controlP5.Controller : Slider lock()
|
||||||
|
controlP5.Controller : Slider plugTo(Object)
|
||||||
|
controlP5.Controller : Slider plugTo(Object, String)
|
||||||
|
controlP5.Controller : Slider plugTo(Object[])
|
||||||
|
controlP5.Controller : Slider plugTo(Object[], String)
|
||||||
|
controlP5.Controller : Slider registerProperty(String)
|
||||||
|
controlP5.Controller : Slider registerProperty(String, String)
|
||||||
|
controlP5.Controller : Slider registerTooltip(String)
|
||||||
|
controlP5.Controller : Slider removeBehavior()
|
||||||
|
controlP5.Controller : Slider removeCallback()
|
||||||
|
controlP5.Controller : Slider removeCallback(CallbackListener)
|
||||||
|
controlP5.Controller : Slider removeListener(ControlListener)
|
||||||
|
controlP5.Controller : Slider removeProperty(String)
|
||||||
|
controlP5.Controller : Slider removeProperty(String, String)
|
||||||
|
controlP5.Controller : Slider setArrayValue(float[])
|
||||||
|
controlP5.Controller : Slider setArrayValue(int, float)
|
||||||
|
controlP5.Controller : Slider setBehavior(ControlBehavior)
|
||||||
|
controlP5.Controller : Slider setBroadcast(boolean)
|
||||||
|
controlP5.Controller : Slider setCaptionLabel(String)
|
||||||
|
controlP5.Controller : Slider setColor(CColor)
|
||||||
|
controlP5.Controller : Slider setColorActive(int)
|
||||||
|
controlP5.Controller : Slider setColorBackground(int)
|
||||||
|
controlP5.Controller : Slider setColorCaptionLabel(int)
|
||||||
|
controlP5.Controller : Slider setColorForeground(int)
|
||||||
|
controlP5.Controller : Slider setColorValueLabel(int)
|
||||||
|
controlP5.Controller : Slider setDecimalPrecision(int)
|
||||||
|
controlP5.Controller : Slider setDefaultValue(float)
|
||||||
|
controlP5.Controller : Slider setHeight(int)
|
||||||
|
controlP5.Controller : Slider setId(int)
|
||||||
|
controlP5.Controller : Slider setImages(PImage, PImage, PImage)
|
||||||
|
controlP5.Controller : Slider setImages(PImage, PImage, PImage, PImage)
|
||||||
|
controlP5.Controller : Slider setLabelVisible(boolean)
|
||||||
|
controlP5.Controller : Slider setLock(boolean)
|
||||||
|
controlP5.Controller : Slider setMax(float)
|
||||||
|
controlP5.Controller : Slider setMin(float)
|
||||||
|
controlP5.Controller : Slider setMouseOver(boolean)
|
||||||
|
controlP5.Controller : Slider setMoveable(boolean)
|
||||||
|
controlP5.Controller : Slider setPosition(PVector)
|
||||||
|
controlP5.Controller : Slider setPosition(float, float)
|
||||||
|
controlP5.Controller : Slider setSize(PImage)
|
||||||
|
controlP5.Controller : Slider setSize(int, int)
|
||||||
|
controlP5.Controller : Slider setStringValue(String)
|
||||||
|
controlP5.Controller : Slider setUpdate(boolean)
|
||||||
|
controlP5.Controller : Slider setValueLabel(String)
|
||||||
|
controlP5.Controller : Slider setView(ControllerView)
|
||||||
|
controlP5.Controller : Slider setVisible(boolean)
|
||||||
|
controlP5.Controller : Slider setWidth(int)
|
||||||
|
controlP5.Controller : Slider show()
|
||||||
|
controlP5.Controller : Slider unlock()
|
||||||
|
controlP5.Controller : Slider unplugFrom(Object)
|
||||||
|
controlP5.Controller : Slider unplugFrom(Object[])
|
||||||
|
controlP5.Controller : Slider unregisterTooltip()
|
||||||
|
controlP5.Controller : Slider update()
|
||||||
|
controlP5.Controller : Slider updateSize()
|
||||||
|
controlP5.Controller : String getAddress()
|
||||||
|
controlP5.Controller : String getInfo()
|
||||||
|
controlP5.Controller : String getName()
|
||||||
|
controlP5.Controller : String getStringValue()
|
||||||
|
controlP5.Controller : String toString()
|
||||||
|
controlP5.Controller : Tab getTab()
|
||||||
|
controlP5.Controller : boolean isActive()
|
||||||
|
controlP5.Controller : boolean isBroadcast()
|
||||||
|
controlP5.Controller : boolean isInside()
|
||||||
|
controlP5.Controller : boolean isLabelVisible()
|
||||||
|
controlP5.Controller : boolean isListening()
|
||||||
|
controlP5.Controller : boolean isLock()
|
||||||
|
controlP5.Controller : boolean isMouseOver()
|
||||||
|
controlP5.Controller : boolean isMousePressed()
|
||||||
|
controlP5.Controller : boolean isMoveable()
|
||||||
|
controlP5.Controller : boolean isUpdate()
|
||||||
|
controlP5.Controller : boolean isVisible()
|
||||||
|
controlP5.Controller : float getArrayValue(int)
|
||||||
|
controlP5.Controller : float getDefaultValue()
|
||||||
|
controlP5.Controller : float getMax()
|
||||||
|
controlP5.Controller : float getMin()
|
||||||
|
controlP5.Controller : float getValue()
|
||||||
|
controlP5.Controller : float[] getArrayValue()
|
||||||
|
controlP5.Controller : int getDecimalPrecision()
|
||||||
|
controlP5.Controller : int getHeight()
|
||||||
|
controlP5.Controller : int getId()
|
||||||
|
controlP5.Controller : int getWidth()
|
||||||
|
controlP5.Controller : int listenerSize()
|
||||||
|
controlP5.Controller : void remove()
|
||||||
|
controlP5.Controller : void setView(ControllerView, int)
|
||||||
|
java.lang.Object : String toString()
|
||||||
|
java.lang.Object : boolean equals(Object)
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
207
examples/controllers/ControlP5slider2D/ControlP5slider2D.pde
Normal file
207
examples/controllers/ControlP5slider2D/ControlP5slider2D.pde
Normal file
@ -0,0 +1,207 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 Slider2D
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* find a list of public methods available for the Slider2D Controller
|
||||||
|
* at the bottom of this sketch.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
Slider2D s;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(700,400);
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
s = cp5.addSlider2D("wave")
|
||||||
|
.setPosition(30,40)
|
||||||
|
.setSize(100,100)
|
||||||
|
.setArrayValue(new float[] {50, 50})
|
||||||
|
//.disableCrosshair()
|
||||||
|
;
|
||||||
|
|
||||||
|
smooth();
|
||||||
|
}
|
||||||
|
|
||||||
|
float cnt;
|
||||||
|
void draw() {
|
||||||
|
background(0);
|
||||||
|
pushMatrix();
|
||||||
|
translate(160,140);
|
||||||
|
noStroke();
|
||||||
|
fill(50);
|
||||||
|
rect(0, -100, 400,200);
|
||||||
|
strokeWeight(1);
|
||||||
|
line(0,0,200, 0);
|
||||||
|
stroke(255);
|
||||||
|
|
||||||
|
for(int i=1;i<400;i++) {
|
||||||
|
float y0 = cos(map(i-1,0,s.getArrayValue()[0],-PI,PI)) * s.getArrayValue()[1];
|
||||||
|
float y1 = cos(map(i,0,s.getArrayValue()[0],-PI,PI)) * s.getArrayValue()[1];
|
||||||
|
line((i-1),y0,i,y1);
|
||||||
|
}
|
||||||
|
|
||||||
|
popMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
a list of all methods available for the Slider2D Controller
|
||||||
|
use ControlP5.printPublicMethodsFor(Slider2D.class);
|
||||||
|
to print the following list into the console.
|
||||||
|
|
||||||
|
You can find further details about class Slider2D in the javadoc.
|
||||||
|
|
||||||
|
Format:
|
||||||
|
ClassName : returnType methodName(parameter type)
|
||||||
|
|
||||||
|
controlP5.Slider2D : Slider2D enableCrosshair()
|
||||||
|
controlP5.Slider2D : Slider2D disableCrosshair()
|
||||||
|
controlP5.Slider2D : Slider2D setArrayValue(float[])
|
||||||
|
controlP5.Slider2D : Slider2D setMaxX(float)
|
||||||
|
controlP5.Slider2D : Slider2D setMaxY(float)
|
||||||
|
controlP5.Slider2D : Slider2D setMinX(float)
|
||||||
|
controlP5.Slider2D : Slider2D setMinY(float)
|
||||||
|
controlP5.Slider2D : Slider2D setValue(float)
|
||||||
|
controlP5.Slider2D : Slider2D shuffle()
|
||||||
|
controlP5.Slider2D : float getCursorHeight()
|
||||||
|
controlP5.Slider2D : float getCursorWidth()
|
||||||
|
controlP5.Slider2D : float getCursorX()
|
||||||
|
controlP5.Slider2D : float getCursorY()
|
||||||
|
controlP5.Slider2D : float getMaxX()
|
||||||
|
controlP5.Slider2D : float getMaxY()
|
||||||
|
controlP5.Slider2D : float getMinX()
|
||||||
|
controlP5.Slider2D : float getMinY()
|
||||||
|
controlP5.Slider2D : float[] getArrayValue()
|
||||||
|
controlP5.Slider2D : void setValueLabelSeparator(String)
|
||||||
|
controlP5.Controller : CColor getColor()
|
||||||
|
controlP5.Controller : ControlBehavior getBehavior()
|
||||||
|
controlP5.Controller : ControlWindow getControlWindow()
|
||||||
|
controlP5.Controller : ControlWindow getWindow()
|
||||||
|
controlP5.Controller : ControllerProperty getProperty(String)
|
||||||
|
controlP5.Controller : ControllerProperty getProperty(String, String)
|
||||||
|
controlP5.Controller : Label getCaptionLabel()
|
||||||
|
controlP5.Controller : Label getValueLabel()
|
||||||
|
controlP5.Controller : List getControllerPlugList()
|
||||||
|
controlP5.Controller : PImage setImage(PImage)
|
||||||
|
controlP5.Controller : PImage setImage(PImage, int)
|
||||||
|
controlP5.Controller : PVector getAbsolutePosition()
|
||||||
|
controlP5.Controller : PVector getPosition()
|
||||||
|
controlP5.Controller : Slider2D addCallback(CallbackListener)
|
||||||
|
controlP5.Controller : Slider2D addListener(ControlListener)
|
||||||
|
controlP5.Controller : Slider2D bringToFront()
|
||||||
|
controlP5.Controller : Slider2D bringToFront(ControllerInterface)
|
||||||
|
controlP5.Controller : Slider2D hide()
|
||||||
|
controlP5.Controller : Slider2D linebreak()
|
||||||
|
controlP5.Controller : Slider2D listen(boolean)
|
||||||
|
controlP5.Controller : Slider2D lock()
|
||||||
|
controlP5.Controller : Slider2D plugTo(Object)
|
||||||
|
controlP5.Controller : Slider2D plugTo(Object, String)
|
||||||
|
controlP5.Controller : Slider2D plugTo(Object[])
|
||||||
|
controlP5.Controller : Slider2D plugTo(Object[], String)
|
||||||
|
controlP5.Controller : Slider2D registerProperty(String)
|
||||||
|
controlP5.Controller : Slider2D registerProperty(String, String)
|
||||||
|
controlP5.Controller : Slider2D registerTooltip(String)
|
||||||
|
controlP5.Controller : Slider2D removeBehavior()
|
||||||
|
controlP5.Controller : Slider2D removeCallback()
|
||||||
|
controlP5.Controller : Slider2D removeCallback(CallbackListener)
|
||||||
|
controlP5.Controller : Slider2D removeListener(ControlListener)
|
||||||
|
controlP5.Controller : Slider2D removeProperty(String)
|
||||||
|
controlP5.Controller : Slider2D removeProperty(String, String)
|
||||||
|
controlP5.Controller : Slider2D setArrayValue(float[])
|
||||||
|
controlP5.Controller : Slider2D setArrayValue(int, float)
|
||||||
|
controlP5.Controller : Slider2D setBehavior(ControlBehavior)
|
||||||
|
controlP5.Controller : Slider2D setBroadcast(boolean)
|
||||||
|
controlP5.Controller : Slider2D setCaptionLabel(String)
|
||||||
|
controlP5.Controller : Slider2D setColor(CColor)
|
||||||
|
controlP5.Controller : Slider2D setColorActive(int)
|
||||||
|
controlP5.Controller : Slider2D setColorBackground(int)
|
||||||
|
controlP5.Controller : Slider2D setColorCaptionLabel(int)
|
||||||
|
controlP5.Controller : Slider2D setColorForeground(int)
|
||||||
|
controlP5.Controller : Slider2D setColorValueLabel(int)
|
||||||
|
controlP5.Controller : Slider2D setDecimalPrecision(int)
|
||||||
|
controlP5.Controller : Slider2D setDefaultValue(float)
|
||||||
|
controlP5.Controller : Slider2D setHeight(int)
|
||||||
|
controlP5.Controller : Slider2D setId(int)
|
||||||
|
controlP5.Controller : Slider2D setImages(PImage, PImage, PImage)
|
||||||
|
controlP5.Controller : Slider2D setImages(PImage, PImage, PImage, PImage)
|
||||||
|
controlP5.Controller : Slider2D setLabelVisible(boolean)
|
||||||
|
controlP5.Controller : Slider2D setLock(boolean)
|
||||||
|
controlP5.Controller : Slider2D setMax(float)
|
||||||
|
controlP5.Controller : Slider2D setMin(float)
|
||||||
|
controlP5.Controller : Slider2D setMouseOver(boolean)
|
||||||
|
controlP5.Controller : Slider2D setMoveable(boolean)
|
||||||
|
controlP5.Controller : Slider2D setPosition(PVector)
|
||||||
|
controlP5.Controller : Slider2D setPosition(float, float)
|
||||||
|
controlP5.Controller : Slider2D setSize(PImage)
|
||||||
|
controlP5.Controller : Slider2D setSize(int, int)
|
||||||
|
controlP5.Controller : Slider2D setStringValue(String)
|
||||||
|
controlP5.Controller : Slider2D setUpdate(boolean)
|
||||||
|
controlP5.Controller : Slider2D setValueLabel(String)
|
||||||
|
controlP5.Controller : Slider2D setView(ControllerView)
|
||||||
|
controlP5.Controller : Slider2D setVisible(boolean)
|
||||||
|
controlP5.Controller : Slider2D setWidth(int)
|
||||||
|
controlP5.Controller : Slider2D show()
|
||||||
|
controlP5.Controller : Slider2D unlock()
|
||||||
|
controlP5.Controller : Slider2D unplugFrom(Object)
|
||||||
|
controlP5.Controller : Slider2D unplugFrom(Object[])
|
||||||
|
controlP5.Controller : Slider2D unregisterTooltip()
|
||||||
|
controlP5.Controller : Slider2D update()
|
||||||
|
controlP5.Controller : Slider2D updateSize()
|
||||||
|
controlP5.Controller : String getAddress()
|
||||||
|
controlP5.Controller : String getInfo()
|
||||||
|
controlP5.Controller : String getName()
|
||||||
|
controlP5.Controller : String getStringValue()
|
||||||
|
controlP5.Controller : String toString()
|
||||||
|
controlP5.Controller : Tab getTab()
|
||||||
|
controlP5.Controller : boolean isActive()
|
||||||
|
controlP5.Controller : boolean isBroadcast()
|
||||||
|
controlP5.Controller : boolean isInside()
|
||||||
|
controlP5.Controller : boolean isLabelVisible()
|
||||||
|
controlP5.Controller : boolean isListening()
|
||||||
|
controlP5.Controller : boolean isLock()
|
||||||
|
controlP5.Controller : boolean isMouseOver()
|
||||||
|
controlP5.Controller : boolean isMousePressed()
|
||||||
|
controlP5.Controller : boolean isMoveable()
|
||||||
|
controlP5.Controller : boolean isUpdate()
|
||||||
|
controlP5.Controller : boolean isVisible()
|
||||||
|
controlP5.Controller : float getArrayValue(int)
|
||||||
|
controlP5.Controller : float getDefaultValue()
|
||||||
|
controlP5.Controller : float getMax()
|
||||||
|
controlP5.Controller : float getMin()
|
||||||
|
controlP5.Controller : float getValue()
|
||||||
|
controlP5.Controller : float[] getArrayValue()
|
||||||
|
controlP5.Controller : int getDecimalPrecision()
|
||||||
|
controlP5.Controller : int getHeight()
|
||||||
|
controlP5.Controller : int getId()
|
||||||
|
controlP5.Controller : int getWidth()
|
||||||
|
controlP5.Controller : int listenerSize()
|
||||||
|
controlP5.Controller : void remove()
|
||||||
|
controlP5.Controller : void setView(ControllerView, int)
|
||||||
|
java.lang.Object : String toString()
|
||||||
|
java.lang.Object : boolean equals(Object)
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
220
examples/controllers/ControlP5tab/ControlP5tab.pde
Normal file
220
examples/controllers/ControlP5tab/ControlP5tab.pde
Normal file
@ -0,0 +1,220 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 Tab
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* find a list of public methods available for the Tab Controller
|
||||||
|
* at the bottom of this sketch.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
int myColorBackground = color(128);
|
||||||
|
|
||||||
|
int sliderValue = 100;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(700,400);
|
||||||
|
noStroke();
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
|
||||||
|
// By default all controllers are stored inside Tab 'default'
|
||||||
|
// add a second tab with name 'extra'
|
||||||
|
|
||||||
|
cp5.addTab("extra")
|
||||||
|
.setColorBackground(color(0, 160, 100))
|
||||||
|
.setColorLabel(color(255))
|
||||||
|
.setColorActive(color(255,128,0))
|
||||||
|
;
|
||||||
|
|
||||||
|
// if you want to receive a controlEvent when
|
||||||
|
// a tab is clicked, use activeEvent(true)
|
||||||
|
|
||||||
|
cp5.getTab("default")
|
||||||
|
.activateEvent(true)
|
||||||
|
.setLabel("my default tab")
|
||||||
|
.setId(1)
|
||||||
|
;
|
||||||
|
|
||||||
|
cp5.getTab("extra")
|
||||||
|
.activateEvent(true)
|
||||||
|
.setId(2)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
// create a few controllers
|
||||||
|
|
||||||
|
cp5.addButton("button")
|
||||||
|
.setBroadcast(false)
|
||||||
|
.setPosition(100,100)
|
||||||
|
.setSize(80,40)
|
||||||
|
.setValue(1)
|
||||||
|
.setBroadcast(true)
|
||||||
|
.getCaptionLabel().align(CENTER,CENTER)
|
||||||
|
;
|
||||||
|
|
||||||
|
cp5.addButton("buttonValue")
|
||||||
|
.setBroadcast(false)
|
||||||
|
.setPosition(220,100)
|
||||||
|
.setSize(80,40)
|
||||||
|
.setValue(2)
|
||||||
|
.setBroadcast(true)
|
||||||
|
.getCaptionLabel().align(CENTER,CENTER)
|
||||||
|
;
|
||||||
|
|
||||||
|
cp5.addSlider("slider")
|
||||||
|
.setBroadcast(false)
|
||||||
|
.setRange(100,200)
|
||||||
|
.setValue(128)
|
||||||
|
.setPosition(100,160)
|
||||||
|
.setSize(200,20)
|
||||||
|
.setBroadcast(true)
|
||||||
|
;
|
||||||
|
|
||||||
|
cp5.addSlider("sliderValue")
|
||||||
|
.setBroadcast(false)
|
||||||
|
.setRange(0,255)
|
||||||
|
.setValue(128)
|
||||||
|
.setPosition(100,200)
|
||||||
|
.setSize(200,20)
|
||||||
|
.setBroadcast(true)
|
||||||
|
;
|
||||||
|
|
||||||
|
// arrange controller in separate tabs
|
||||||
|
|
||||||
|
cp5.getController("sliderValue").moveTo("extra");
|
||||||
|
cp5.getController("slider").moveTo("global");
|
||||||
|
|
||||||
|
// Tab 'global' is a tab that lies on top of any
|
||||||
|
// other tab and is always visible
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(myColorBackground);
|
||||||
|
fill(sliderValue);
|
||||||
|
rect(0,0,width,100);
|
||||||
|
}
|
||||||
|
|
||||||
|
void controlEvent(ControlEvent theControlEvent) {
|
||||||
|
if (theControlEvent.isTab()) {
|
||||||
|
println("got an event from tab : "+theControlEvent.getTab().getName()+" with id "+theControlEvent.getTab().getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void slider(int theColor) {
|
||||||
|
myColorBackground = color(theColor);
|
||||||
|
println("a slider event. setting background to "+theColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void keyPressed() {
|
||||||
|
if(keyCode==TAB) {
|
||||||
|
cp5.getTab("extra").bringToFront();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
a list of all methods available for the Tab Controller
|
||||||
|
use ControlP5.printPublicMethodsFor(Tab.class);
|
||||||
|
to print the following list into the console.
|
||||||
|
|
||||||
|
You can find further details about class Tab in the javadoc.
|
||||||
|
|
||||||
|
Format:
|
||||||
|
ClassName : returnType methodName(parameter type)
|
||||||
|
|
||||||
|
controlP5.Tab : String getStringValue()
|
||||||
|
controlP5.Tab : Tab activateEvent(boolean)
|
||||||
|
controlP5.Tab : Tab bringToFront()
|
||||||
|
controlP5.Tab : Tab moveTo(ControlWindow)
|
||||||
|
controlP5.Tab : Tab setActive(boolean)
|
||||||
|
controlP5.Tab : Tab setHeight(int)
|
||||||
|
controlP5.Tab : Tab setLabel(String)
|
||||||
|
controlP5.Tab : Tab setValue(float)
|
||||||
|
controlP5.Tab : Tab setWidth(int)
|
||||||
|
controlP5.Tab : float getValue()
|
||||||
|
controlP5.ControllerGroup : CColor getColor()
|
||||||
|
controlP5.ControllerGroup : ControlWindow getWindow()
|
||||||
|
controlP5.ControllerGroup : ControlWindowCanvas addCanvas(ControlWindowCanvas)
|
||||||
|
controlP5.ControllerGroup : Controller getController(String)
|
||||||
|
controlP5.ControllerGroup : ControllerProperty getProperty(String)
|
||||||
|
controlP5.ControllerGroup : ControllerProperty getProperty(String, String)
|
||||||
|
controlP5.ControllerGroup : Label getCaptionLabel()
|
||||||
|
controlP5.ControllerGroup : Label getValueLabel()
|
||||||
|
controlP5.ControllerGroup : PVector getPosition()
|
||||||
|
controlP5.ControllerGroup : String getAddress()
|
||||||
|
controlP5.ControllerGroup : String getInfo()
|
||||||
|
controlP5.ControllerGroup : String getName()
|
||||||
|
controlP5.ControllerGroup : String getStringValue()
|
||||||
|
controlP5.ControllerGroup : String toString()
|
||||||
|
controlP5.ControllerGroup : Tab add(ControllerInterface)
|
||||||
|
controlP5.ControllerGroup : Tab bringToFront()
|
||||||
|
controlP5.ControllerGroup : Tab bringToFront(ControllerInterface)
|
||||||
|
controlP5.ControllerGroup : Tab close()
|
||||||
|
controlP5.ControllerGroup : Tab disableCollapse()
|
||||||
|
controlP5.ControllerGroup : Tab enableCollapse()
|
||||||
|
controlP5.ControllerGroup : Tab getTab()
|
||||||
|
controlP5.ControllerGroup : Tab hide()
|
||||||
|
controlP5.ControllerGroup : Tab moveTo(ControlWindow)
|
||||||
|
controlP5.ControllerGroup : Tab moveTo(PApplet)
|
||||||
|
controlP5.ControllerGroup : Tab open()
|
||||||
|
controlP5.ControllerGroup : Tab registerProperty(String)
|
||||||
|
controlP5.ControllerGroup : Tab registerProperty(String, String)
|
||||||
|
controlP5.ControllerGroup : Tab remove(CDrawable)
|
||||||
|
controlP5.ControllerGroup : Tab remove(ControllerInterface)
|
||||||
|
controlP5.ControllerGroup : Tab removeCanvas(ControlWindowCanvas)
|
||||||
|
controlP5.ControllerGroup : Tab removeProperty(String)
|
||||||
|
controlP5.ControllerGroup : Tab removeProperty(String, String)
|
||||||
|
controlP5.ControllerGroup : Tab setAddress(String)
|
||||||
|
controlP5.ControllerGroup : Tab setArrayValue(float[])
|
||||||
|
controlP5.ControllerGroup : Tab setColor(CColor)
|
||||||
|
controlP5.ControllerGroup : Tab setColorActive(int)
|
||||||
|
controlP5.ControllerGroup : Tab setColorBackground(int)
|
||||||
|
controlP5.ControllerGroup : Tab setColorForeground(int)
|
||||||
|
controlP5.ControllerGroup : Tab setColorLabel(int)
|
||||||
|
controlP5.ControllerGroup : Tab setColorValue(int)
|
||||||
|
controlP5.ControllerGroup : Tab setHeight(int)
|
||||||
|
controlP5.ControllerGroup : Tab setId(int)
|
||||||
|
controlP5.ControllerGroup : Tab setLabel(String)
|
||||||
|
controlP5.ControllerGroup : Tab setMouseOver(boolean)
|
||||||
|
controlP5.ControllerGroup : Tab setMoveable(boolean)
|
||||||
|
controlP5.ControllerGroup : Tab setOpen(boolean)
|
||||||
|
controlP5.ControllerGroup : Tab setPosition(PVector)
|
||||||
|
controlP5.ControllerGroup : Tab setPosition(float, float)
|
||||||
|
controlP5.ControllerGroup : Tab setStringValue(String)
|
||||||
|
controlP5.ControllerGroup : Tab setUpdate(boolean)
|
||||||
|
controlP5.ControllerGroup : Tab setValue(float)
|
||||||
|
controlP5.ControllerGroup : Tab setVisible(boolean)
|
||||||
|
controlP5.ControllerGroup : Tab setWidth(int)
|
||||||
|
controlP5.ControllerGroup : Tab show()
|
||||||
|
controlP5.ControllerGroup : Tab update()
|
||||||
|
controlP5.ControllerGroup : Tab updateAbsolutePosition()
|
||||||
|
controlP5.ControllerGroup : boolean isCollapse()
|
||||||
|
controlP5.ControllerGroup : boolean isMouseOver()
|
||||||
|
controlP5.ControllerGroup : boolean isMoveable()
|
||||||
|
controlP5.ControllerGroup : boolean isOpen()
|
||||||
|
controlP5.ControllerGroup : boolean isUpdate()
|
||||||
|
controlP5.ControllerGroup : boolean isVisible()
|
||||||
|
controlP5.ControllerGroup : boolean setMousePressed(boolean)
|
||||||
|
controlP5.ControllerGroup : float getValue()
|
||||||
|
controlP5.ControllerGroup : float[] getArrayValue()
|
||||||
|
controlP5.ControllerGroup : int getHeight()
|
||||||
|
controlP5.ControllerGroup : int getId()
|
||||||
|
controlP5.ControllerGroup : int getWidth()
|
||||||
|
controlP5.ControllerGroup : void remove()
|
||||||
|
java.lang.Object : String toString()
|
||||||
|
java.lang.Object : boolean equals(Object)
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
211
examples/controllers/ControlP5textarea/ControlP5textarea.pde
Normal file
211
examples/controllers/ControlP5textarea/ControlP5textarea.pde
Normal file
@ -0,0 +1,211 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 Textarea
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* find a list of public methods available for the Textarea Controller
|
||||||
|
* at the bottom of this sketch.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
Textarea myTextarea;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(700,400);
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
|
||||||
|
myTextarea = cp5.addTextarea("txt")
|
||||||
|
.setPosition(100,100)
|
||||||
|
.setSize(200,200)
|
||||||
|
.setFont(createFont("arial",12))
|
||||||
|
.setLineHeight(14)
|
||||||
|
.setColor(color(128))
|
||||||
|
.setColorBackground(color(255,100))
|
||||||
|
.setColorForeground(color(255,100));
|
||||||
|
;
|
||||||
|
myTextarea.setText("Lorem Ipsum is simply dummy text of the printing and typesetting"
|
||||||
|
+" industry. Lorem Ipsum has been the industry's standard dummy text"
|
||||||
|
+" ever since the 1500s, when an unknown printer took a galley of type"
|
||||||
|
+" and scrambled it to make a type specimen book. It has survived not"
|
||||||
|
+" only five centuries, but also the leap into electronic typesetting,"
|
||||||
|
+" remaining essentially unchanged. It was popularised in the 1960s"
|
||||||
|
+" with the release of Letraset sheets containing Lorem Ipsum passages,"
|
||||||
|
+" and more recently with desktop publishing software like Aldus"
|
||||||
|
+" PageMaker including versions of Lorem Ipsum."
|
||||||
|
);
|
||||||
|
|
||||||
|
cp5.addSlider("changeWidth")
|
||||||
|
.setRange(100,400)
|
||||||
|
.setValue(200)
|
||||||
|
.setPosition(100,20)
|
||||||
|
.setSize(100,19)
|
||||||
|
;
|
||||||
|
|
||||||
|
cp5.addSlider("changeHeight")
|
||||||
|
.setRange(100,400)
|
||||||
|
.setValue(200)
|
||||||
|
.setPosition(100,40)
|
||||||
|
.setSize(100,19)
|
||||||
|
;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void keyPressed() {
|
||||||
|
if(key=='r') {
|
||||||
|
myTextarea.setText("Lorem ipsum dolor sit amet, consectetur adipiscing elit."
|
||||||
|
+" Quisque sed velit nec eros scelerisque adipiscing vitae eu sem."
|
||||||
|
+" Quisque malesuada interdum lectus. Pellentesque pellentesque molestie"
|
||||||
|
+" vestibulum. Maecenas ultricies, neque at porttitor lacinia, tellus enim"
|
||||||
|
+" suscipit tortor, ut dapibus orci lorem non ipsum. Mauris ut velit velit."
|
||||||
|
+" Fusce at purus in augue semper tincidunt imperdiet sit amet eros."
|
||||||
|
+" Vestibulum nunc diam, fringilla vitae tristique ut, viverra ut felis."
|
||||||
|
+" Proin aliquet turpis ornare leo aliquam dapibus. Integer dui nisi, condimentum"
|
||||||
|
+" ut sagittis non, fringilla vestibulum sapien. Sed ullamcorper libero et massa"
|
||||||
|
+" congue in facilisis mauris lobortis. Fusce cursus risus sit amet leo imperdiet"
|
||||||
|
+" lacinia faucibus turpis tempus. Pellentesque pellentesque augue sed purus varius"
|
||||||
|
+" sed volutpat dui rhoncus. Lorem ipsum dolor sit amet, consectetur adipiscing elit"
|
||||||
|
);
|
||||||
|
|
||||||
|
} else if(key=='c') {
|
||||||
|
myTextarea.setColor(0xffffffff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void draw() {
|
||||||
|
background(0);
|
||||||
|
if(keyPressed && key==' ') {
|
||||||
|
myTextarea.scroll((float)mouseX/(float)width);
|
||||||
|
}
|
||||||
|
if(keyPressed && key=='l') {
|
||||||
|
myTextarea.setLineHeight(mouseY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void changeWidth(int theValue) {
|
||||||
|
myTextarea.setWidth(theValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
void changeHeight(int theValue) {
|
||||||
|
myTextarea.setHeight(theValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
a list of all methods available for the Textarea Controller
|
||||||
|
use ControlP5.printPublicMethodsFor(Textarea.class);
|
||||||
|
to print the following list into the console.
|
||||||
|
|
||||||
|
You can find further details about class Textarea in the javadoc.
|
||||||
|
|
||||||
|
Format:
|
||||||
|
ClassName : returnType methodName(parameter type)
|
||||||
|
|
||||||
|
controlP5.Textarea : Label getValueLabel()
|
||||||
|
controlP5.Textarea : String getStringValue()
|
||||||
|
controlP5.Textarea : String getText()
|
||||||
|
controlP5.Textarea : Textarea disableColorBackground()
|
||||||
|
controlP5.Textarea : Textarea enableColorBackground()
|
||||||
|
controlP5.Textarea : Textarea hideScrollbar()
|
||||||
|
controlP5.Textarea : Textarea scroll(float)
|
||||||
|
controlP5.Textarea : Textarea setBorderColor(int)
|
||||||
|
controlP5.Textarea : Textarea setColor(int)
|
||||||
|
controlP5.Textarea : Textarea setColorBackground(int)
|
||||||
|
controlP5.Textarea : Textarea setFont(ControlFont)
|
||||||
|
controlP5.Textarea : Textarea setFont(PFont)
|
||||||
|
controlP5.Textarea : Textarea setFont(int)
|
||||||
|
controlP5.Textarea : Textarea setHeight(int)
|
||||||
|
controlP5.Textarea : Textarea setLineHeight(int)
|
||||||
|
controlP5.Textarea : Textarea setScrollActive(int)
|
||||||
|
controlP5.Textarea : Textarea setScrollBackground(int)
|
||||||
|
controlP5.Textarea : Textarea setScrollForeground(int)
|
||||||
|
controlP5.Textarea : Textarea setSize(int, int)
|
||||||
|
controlP5.Textarea : Textarea setText(String)
|
||||||
|
controlP5.Textarea : Textarea setWidth(int)
|
||||||
|
controlP5.Textarea : Textarea showScrollbar()
|
||||||
|
controlP5.Textarea : boolean isScrollable()
|
||||||
|
controlP5.Textarea : float getValue()
|
||||||
|
controlP5.Textarea : void controlEvent(ControlEvent)
|
||||||
|
controlP5.ControllerGroup : CColor getColor()
|
||||||
|
controlP5.ControllerGroup : ControlWindow getWindow()
|
||||||
|
controlP5.ControllerGroup : ControlWindowCanvas addCanvas(ControlWindowCanvas)
|
||||||
|
controlP5.ControllerGroup : Controller getController(String)
|
||||||
|
controlP5.ControllerGroup : ControllerProperty getProperty(String)
|
||||||
|
controlP5.ControllerGroup : ControllerProperty getProperty(String, String)
|
||||||
|
controlP5.ControllerGroup : Label getCaptionLabel()
|
||||||
|
controlP5.ControllerGroup : Label getValueLabel()
|
||||||
|
controlP5.ControllerGroup : PVector getPosition()
|
||||||
|
controlP5.ControllerGroup : String getAddress()
|
||||||
|
controlP5.ControllerGroup : String getInfo()
|
||||||
|
controlP5.ControllerGroup : String getName()
|
||||||
|
controlP5.ControllerGroup : String getStringValue()
|
||||||
|
controlP5.ControllerGroup : String toString()
|
||||||
|
controlP5.ControllerGroup : Tab getTab()
|
||||||
|
controlP5.ControllerGroup : Textarea add(ControllerInterface)
|
||||||
|
controlP5.ControllerGroup : Textarea bringToFront()
|
||||||
|
controlP5.ControllerGroup : Textarea bringToFront(ControllerInterface)
|
||||||
|
controlP5.ControllerGroup : Textarea close()
|
||||||
|
controlP5.ControllerGroup : Textarea disableCollapse()
|
||||||
|
controlP5.ControllerGroup : Textarea enableCollapse()
|
||||||
|
controlP5.ControllerGroup : Textarea hide()
|
||||||
|
controlP5.ControllerGroup : Textarea moveTo(ControlWindow)
|
||||||
|
controlP5.ControllerGroup : Textarea moveTo(PApplet)
|
||||||
|
controlP5.ControllerGroup : Textarea open()
|
||||||
|
controlP5.ControllerGroup : Textarea registerProperty(String)
|
||||||
|
controlP5.ControllerGroup : Textarea registerProperty(String, String)
|
||||||
|
controlP5.ControllerGroup : Textarea remove(CDrawable)
|
||||||
|
controlP5.ControllerGroup : Textarea remove(ControllerInterface)
|
||||||
|
controlP5.ControllerGroup : Textarea removeCanvas(ControlWindowCanvas)
|
||||||
|
controlP5.ControllerGroup : Textarea removeProperty(String)
|
||||||
|
controlP5.ControllerGroup : Textarea removeProperty(String, String)
|
||||||
|
controlP5.ControllerGroup : Textarea setAddress(String)
|
||||||
|
controlP5.ControllerGroup : Textarea setArrayValue(float[])
|
||||||
|
controlP5.ControllerGroup : Textarea setColor(CColor)
|
||||||
|
controlP5.ControllerGroup : Textarea setColorActive(int)
|
||||||
|
controlP5.ControllerGroup : Textarea setColorBackground(int)
|
||||||
|
controlP5.ControllerGroup : Textarea setColorForeground(int)
|
||||||
|
controlP5.ControllerGroup : Textarea setColorLabel(int)
|
||||||
|
controlP5.ControllerGroup : Textarea setColorValue(int)
|
||||||
|
controlP5.ControllerGroup : Textarea setHeight(int)
|
||||||
|
controlP5.ControllerGroup : Textarea setId(int)
|
||||||
|
controlP5.ControllerGroup : Textarea setLabel(String)
|
||||||
|
controlP5.ControllerGroup : Textarea setMouseOver(boolean)
|
||||||
|
controlP5.ControllerGroup : Textarea setMoveable(boolean)
|
||||||
|
controlP5.ControllerGroup : Textarea setOpen(boolean)
|
||||||
|
controlP5.ControllerGroup : Textarea setPosition(PVector)
|
||||||
|
controlP5.ControllerGroup : Textarea setPosition(float, float)
|
||||||
|
controlP5.ControllerGroup : Textarea setStringValue(String)
|
||||||
|
controlP5.ControllerGroup : Textarea setUpdate(boolean)
|
||||||
|
controlP5.ControllerGroup : Textarea setValue(float)
|
||||||
|
controlP5.ControllerGroup : Textarea setVisible(boolean)
|
||||||
|
controlP5.ControllerGroup : Textarea setWidth(int)
|
||||||
|
controlP5.ControllerGroup : Textarea show()
|
||||||
|
controlP5.ControllerGroup : Textarea update()
|
||||||
|
controlP5.ControllerGroup : Textarea updateAbsolutePosition()
|
||||||
|
controlP5.ControllerGroup : boolean isCollapse()
|
||||||
|
controlP5.ControllerGroup : boolean isMouseOver()
|
||||||
|
controlP5.ControllerGroup : boolean isMoveable()
|
||||||
|
controlP5.ControllerGroup : boolean isOpen()
|
||||||
|
controlP5.ControllerGroup : boolean isUpdate()
|
||||||
|
controlP5.ControllerGroup : boolean isVisible()
|
||||||
|
controlP5.ControllerGroup : boolean setMousePressed(boolean)
|
||||||
|
controlP5.ControllerGroup : float getValue()
|
||||||
|
controlP5.ControllerGroup : float[] getArrayValue()
|
||||||
|
controlP5.ControllerGroup : int getHeight()
|
||||||
|
controlP5.ControllerGroup : int getId()
|
||||||
|
controlP5.ControllerGroup : int getWidth()
|
||||||
|
controlP5.ControllerGroup : void remove()
|
||||||
|
java.lang.Object : String toString()
|
||||||
|
java.lang.Object : boolean equals(Object)
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
220
examples/controllers/ControlP5textfield/ControlP5textfield.pde
Normal file
220
examples/controllers/ControlP5textfield/ControlP5textfield.pde
Normal file
@ -0,0 +1,220 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 Textfield
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* find a list of public methods available for the Textfield Controller
|
||||||
|
* at the bottom of this sketch.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
String textValue = "";
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(700,400);
|
||||||
|
|
||||||
|
PFont font = createFont("arial",20);
|
||||||
|
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
|
||||||
|
cp5.addTextfield("input")
|
||||||
|
.setPosition(20,100)
|
||||||
|
.setSize(200,40)
|
||||||
|
.setFont(font)
|
||||||
|
.setFocus(true)
|
||||||
|
.setColor(color(255,0,0))
|
||||||
|
;
|
||||||
|
|
||||||
|
cp5.addTextfield("textValue")
|
||||||
|
.setPosition(20,170)
|
||||||
|
.setSize(200,40)
|
||||||
|
.setFont(createFont("arial",20))
|
||||||
|
.setAutoClear(false)
|
||||||
|
;
|
||||||
|
|
||||||
|
cp5.addBang("clear")
|
||||||
|
.setPosition(240,170)
|
||||||
|
.setSize(80,40)
|
||||||
|
.getCaptionLabel().align(ControlP5.CENTER, ControlP5.CENTER)
|
||||||
|
;
|
||||||
|
|
||||||
|
cp5.addTextfield("default")
|
||||||
|
.setPosition(20,350)
|
||||||
|
.setAutoClear(false)
|
||||||
|
;
|
||||||
|
|
||||||
|
textFont(font);
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(0);
|
||||||
|
fill(255);
|
||||||
|
text(cp5.get(Textfield.class,"input").getText(), 360,130);
|
||||||
|
text(textValue, 360,180);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
cp5.get(Textfield.class,"textValue").clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void controlEvent(ControlEvent theEvent) {
|
||||||
|
if(theEvent.isAssignableFrom(Textfield.class)) {
|
||||||
|
println("controlEvent: accessing a string from controller '"
|
||||||
|
+theEvent.getName()+"': "
|
||||||
|
+theEvent.getStringValue()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void input(String theText) {
|
||||||
|
// automatically receives results from controller input
|
||||||
|
println("a textfield event for controller 'input' : "+theText);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
a list of all methods available for the Textfield Controller
|
||||||
|
use ControlP5.printPublicMethodsFor(Textfield.class);
|
||||||
|
to print the following list into the console.
|
||||||
|
|
||||||
|
You can find further details about class Textfield in the javadoc.
|
||||||
|
|
||||||
|
Format:
|
||||||
|
ClassName : returnType methodName(parameter type)
|
||||||
|
|
||||||
|
controlP5.Textfield : String getText()
|
||||||
|
controlP5.Textfield : Textfield clear()
|
||||||
|
controlP5.Textfield : Textfield keepFocus(boolean)
|
||||||
|
controlP5.Textfield : Textfield setAutoClear(boolean)
|
||||||
|
controlP5.Textfield : Textfield setFocus(boolean)
|
||||||
|
controlP5.Textfield : Textfield setFont(ControlFont)
|
||||||
|
controlP5.Textfield : Textfield setFont(PFont)
|
||||||
|
controlP5.Textfield : Textfield setFont(int)
|
||||||
|
controlP5.Textfield : Textfield setText(String)
|
||||||
|
controlP5.Textfield : Textfield setValue(String)
|
||||||
|
controlP5.Textfield : Textfield setValue(float)
|
||||||
|
controlP5.Textfield : boolean isAutoClear()
|
||||||
|
controlP5.Textfield : int getIndex()
|
||||||
|
controlP5.Textfield : void draw(PApplet)
|
||||||
|
controlP5.Textfield : void keyEvent(KeyEvent)
|
||||||
|
controlP5.Textfield : void setInputFilter(int)
|
||||||
|
controlP5.Textfield : void setPasswordMode(boolean)
|
||||||
|
controlP5.Controller : CColor getColor()
|
||||||
|
controlP5.Controller : ControlBehavior getBehavior()
|
||||||
|
controlP5.Controller : ControlWindow getControlWindow()
|
||||||
|
controlP5.Controller : ControlWindow getWindow()
|
||||||
|
controlP5.Controller : ControllerProperty getProperty(String)
|
||||||
|
controlP5.Controller : ControllerProperty getProperty(String, String)
|
||||||
|
controlP5.Controller : Label getCaptionLabel()
|
||||||
|
controlP5.Controller : Label getValueLabel()
|
||||||
|
controlP5.Controller : List getControllerPlugList()
|
||||||
|
controlP5.Controller : PImage setImage(PImage)
|
||||||
|
controlP5.Controller : PImage setImage(PImage, int)
|
||||||
|
controlP5.Controller : PVector getAbsolutePosition()
|
||||||
|
controlP5.Controller : PVector getPosition()
|
||||||
|
controlP5.Controller : String getAddress()
|
||||||
|
controlP5.Controller : String getInfo()
|
||||||
|
controlP5.Controller : String getName()
|
||||||
|
controlP5.Controller : String getStringValue()
|
||||||
|
controlP5.Controller : String toString()
|
||||||
|
controlP5.Controller : Tab getTab()
|
||||||
|
controlP5.Controller : Textfield addCallback(CallbackListener)
|
||||||
|
controlP5.Controller : Textfield addListener(ControlListener)
|
||||||
|
controlP5.Controller : Textfield bringToFront()
|
||||||
|
controlP5.Controller : Textfield bringToFront(ControllerInterface)
|
||||||
|
controlP5.Controller : Textfield hide()
|
||||||
|
controlP5.Controller : Textfield linebreak()
|
||||||
|
controlP5.Controller : Textfield listen(boolean)
|
||||||
|
controlP5.Controller : Textfield lock()
|
||||||
|
controlP5.Controller : Textfield plugTo(Object)
|
||||||
|
controlP5.Controller : Textfield plugTo(Object, String)
|
||||||
|
controlP5.Controller : Textfield plugTo(Object[])
|
||||||
|
controlP5.Controller : Textfield plugTo(Object[], String)
|
||||||
|
controlP5.Controller : Textfield registerProperty(String)
|
||||||
|
controlP5.Controller : Textfield registerProperty(String, String)
|
||||||
|
controlP5.Controller : Textfield registerTooltip(String)
|
||||||
|
controlP5.Controller : Textfield removeBehavior()
|
||||||
|
controlP5.Controller : Textfield removeCallback()
|
||||||
|
controlP5.Controller : Textfield removeCallback(CallbackListener)
|
||||||
|
controlP5.Controller : Textfield removeListener(ControlListener)
|
||||||
|
controlP5.Controller : Textfield removeProperty(String)
|
||||||
|
controlP5.Controller : Textfield removeProperty(String, String)
|
||||||
|
controlP5.Controller : Textfield setArrayValue(float[])
|
||||||
|
controlP5.Controller : Textfield setArrayValue(int, float)
|
||||||
|
controlP5.Controller : Textfield setBehavior(ControlBehavior)
|
||||||
|
controlP5.Controller : Textfield setBroadcast(boolean)
|
||||||
|
controlP5.Controller : Textfield setCaptionLabel(String)
|
||||||
|
controlP5.Controller : Textfield setColor(CColor)
|
||||||
|
controlP5.Controller : Textfield setColorActive(int)
|
||||||
|
controlP5.Controller : Textfield setColorBackground(int)
|
||||||
|
controlP5.Controller : Textfield setColorCaptionLabel(int)
|
||||||
|
controlP5.Controller : Textfield setColorForeground(int)
|
||||||
|
controlP5.Controller : Textfield setColorValueLabel(int)
|
||||||
|
controlP5.Controller : Textfield setDecimalPrecision(int)
|
||||||
|
controlP5.Controller : Textfield setDefaultValue(float)
|
||||||
|
controlP5.Controller : Textfield setHeight(int)
|
||||||
|
controlP5.Controller : Textfield setId(int)
|
||||||
|
controlP5.Controller : Textfield setImages(PImage, PImage, PImage)
|
||||||
|
controlP5.Controller : Textfield setImages(PImage, PImage, PImage, PImage)
|
||||||
|
controlP5.Controller : Textfield setLabelVisible(boolean)
|
||||||
|
controlP5.Controller : Textfield setLock(boolean)
|
||||||
|
controlP5.Controller : Textfield setMax(float)
|
||||||
|
controlP5.Controller : Textfield setMin(float)
|
||||||
|
controlP5.Controller : Textfield setMouseOver(boolean)
|
||||||
|
controlP5.Controller : Textfield setMoveable(boolean)
|
||||||
|
controlP5.Controller : Textfield setPosition(PVector)
|
||||||
|
controlP5.Controller : Textfield setPosition(float, float)
|
||||||
|
controlP5.Controller : Textfield setSize(PImage)
|
||||||
|
controlP5.Controller : Textfield setSize(int, int)
|
||||||
|
controlP5.Controller : Textfield setStringValue(String)
|
||||||
|
controlP5.Controller : Textfield setUpdate(boolean)
|
||||||
|
controlP5.Controller : Textfield setValueLabel(String)
|
||||||
|
controlP5.Controller : Textfield setView(ControllerView)
|
||||||
|
controlP5.Controller : Textfield setVisible(boolean)
|
||||||
|
controlP5.Controller : Textfield setWidth(int)
|
||||||
|
controlP5.Controller : Textfield show()
|
||||||
|
controlP5.Controller : Textfield unlock()
|
||||||
|
controlP5.Controller : Textfield unplugFrom(Object)
|
||||||
|
controlP5.Controller : Textfield unplugFrom(Object[])
|
||||||
|
controlP5.Controller : Textfield unregisterTooltip()
|
||||||
|
controlP5.Controller : Textfield update()
|
||||||
|
controlP5.Controller : Textfield updateSize()
|
||||||
|
controlP5.Controller : boolean isActive()
|
||||||
|
controlP5.Controller : boolean isBroadcast()
|
||||||
|
controlP5.Controller : boolean isInside()
|
||||||
|
controlP5.Controller : boolean isLabelVisible()
|
||||||
|
controlP5.Controller : boolean isListening()
|
||||||
|
controlP5.Controller : boolean isLock()
|
||||||
|
controlP5.Controller : boolean isMouseOver()
|
||||||
|
controlP5.Controller : boolean isMousePressed()
|
||||||
|
controlP5.Controller : boolean isMoveable()
|
||||||
|
controlP5.Controller : boolean isUpdate()
|
||||||
|
controlP5.Controller : boolean isVisible()
|
||||||
|
controlP5.Controller : float getArrayValue(int)
|
||||||
|
controlP5.Controller : float getDefaultValue()
|
||||||
|
controlP5.Controller : float getMax()
|
||||||
|
controlP5.Controller : float getMin()
|
||||||
|
controlP5.Controller : float getValue()
|
||||||
|
controlP5.Controller : float[] getArrayValue()
|
||||||
|
controlP5.Controller : int getDecimalPrecision()
|
||||||
|
controlP5.Controller : int getHeight()
|
||||||
|
controlP5.Controller : int getId()
|
||||||
|
controlP5.Controller : int getWidth()
|
||||||
|
controlP5.Controller : int listenerSize()
|
||||||
|
controlP5.Controller : void remove()
|
||||||
|
controlP5.Controller : void setView(ControllerView, int)
|
||||||
|
java.lang.Object : String toString()
|
||||||
|
java.lang.Object : boolean equals(Object)
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
181
examples/controllers/ControlP5textlabel/ControlP5Textlabel.pde
Normal file
181
examples/controllers/ControlP5textlabel/ControlP5Textlabel.pde
Normal file
@ -0,0 +1,181 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 Textlabel
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* find a list of public methods available for the Textlabel Controller
|
||||||
|
* at the bottom of this sketch.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
Textlabel myTextlabelA;
|
||||||
|
Textlabel myTextlabelB;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(700,400);
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
|
||||||
|
myTextlabelA = cp5.addTextlabel("label")
|
||||||
|
.setText("A single ControlP5 textlabel, in yellow.")
|
||||||
|
.setPosition(100,50)
|
||||||
|
.setColorValue(0xffffff00)
|
||||||
|
.setFont(createFont("Georgia",20))
|
||||||
|
;
|
||||||
|
|
||||||
|
myTextlabelB = new Textlabel(cp5,"Another textlabel, not created through ControlP5 needs to be rendered separately by calling Textlabel.draw(PApplet).",100,100,400,200);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(0);
|
||||||
|
myTextlabelB.draw(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
a list of all methods available for the Textlabel Controller
|
||||||
|
use ControlP5.printPublicMethodsFor(Textlabel.class);
|
||||||
|
to print the following list into the console.
|
||||||
|
|
||||||
|
You can find further details about class Textlabel in the javadoc.
|
||||||
|
|
||||||
|
Format:
|
||||||
|
ClassName : returnType methodName(parameter type)
|
||||||
|
|
||||||
|
controlP5.Textlabel : Label get()
|
||||||
|
controlP5.Textlabel : Textlabel setColor(int)
|
||||||
|
controlP5.Textlabel : Textlabel setFont(ControlFont)
|
||||||
|
controlP5.Textlabel : Textlabel setFont(PFont)
|
||||||
|
controlP5.Textlabel : Textlabel setFont(int)
|
||||||
|
controlP5.Textlabel : Textlabel setHeight(int)
|
||||||
|
controlP5.Textlabel : Textlabel setLetterSpacing(int)
|
||||||
|
controlP5.Textlabel : Textlabel setMultiline(boolean)
|
||||||
|
controlP5.Textlabel : Textlabel setStringValue(String)
|
||||||
|
controlP5.Textlabel : Textlabel setText(String)
|
||||||
|
controlP5.Textlabel : Textlabel setValue(String)
|
||||||
|
controlP5.Textlabel : Textlabel setValue(float)
|
||||||
|
controlP5.Textlabel : Textlabel setWidth(int)
|
||||||
|
controlP5.Textlabel : void draw()
|
||||||
|
controlP5.Textlabel : void draw(PApplet)
|
||||||
|
controlP5.Textlabel : void draw(int, int)
|
||||||
|
controlP5.Controller : CColor getColor()
|
||||||
|
controlP5.Controller : ControlBehavior getBehavior()
|
||||||
|
controlP5.Controller : ControlWindow getControlWindow()
|
||||||
|
controlP5.Controller : ControlWindow getWindow()
|
||||||
|
controlP5.Controller : ControllerProperty getProperty(String)
|
||||||
|
controlP5.Controller : ControllerProperty getProperty(String, String)
|
||||||
|
controlP5.Controller : Label getCaptionLabel()
|
||||||
|
controlP5.Controller : Label getValueLabel()
|
||||||
|
controlP5.Controller : List getControllerPlugList()
|
||||||
|
controlP5.Controller : PImage setImage(PImage)
|
||||||
|
controlP5.Controller : PImage setImage(PImage, int)
|
||||||
|
controlP5.Controller : PVector getAbsolutePosition()
|
||||||
|
controlP5.Controller : PVector getPosition()
|
||||||
|
controlP5.Controller : String getAddress()
|
||||||
|
controlP5.Controller : String getInfo()
|
||||||
|
controlP5.Controller : String getName()
|
||||||
|
controlP5.Controller : String getStringValue()
|
||||||
|
controlP5.Controller : String toString()
|
||||||
|
controlP5.Controller : Tab getTab()
|
||||||
|
controlP5.Controller : Textlabel addCallback(CallbackListener)
|
||||||
|
controlP5.Controller : Textlabel addListener(ControlListener)
|
||||||
|
controlP5.Controller : Textlabel bringToFront()
|
||||||
|
controlP5.Controller : Textlabel bringToFront(ControllerInterface)
|
||||||
|
controlP5.Controller : Textlabel hide()
|
||||||
|
controlP5.Controller : Textlabel linebreak()
|
||||||
|
controlP5.Controller : Textlabel listen(boolean)
|
||||||
|
controlP5.Controller : Textlabel lock()
|
||||||
|
controlP5.Controller : Textlabel plugTo(Object)
|
||||||
|
controlP5.Controller : Textlabel plugTo(Object, String)
|
||||||
|
controlP5.Controller : Textlabel plugTo(Object[])
|
||||||
|
controlP5.Controller : Textlabel plugTo(Object[], String)
|
||||||
|
controlP5.Controller : Textlabel registerProperty(String)
|
||||||
|
controlP5.Controller : Textlabel registerProperty(String, String)
|
||||||
|
controlP5.Controller : Textlabel registerTooltip(String)
|
||||||
|
controlP5.Controller : Textlabel removeBehavior()
|
||||||
|
controlP5.Controller : Textlabel removeCallback()
|
||||||
|
controlP5.Controller : Textlabel removeCallback(CallbackListener)
|
||||||
|
controlP5.Controller : Textlabel removeListener(ControlListener)
|
||||||
|
controlP5.Controller : Textlabel removeProperty(String)
|
||||||
|
controlP5.Controller : Textlabel removeProperty(String, String)
|
||||||
|
controlP5.Controller : Textlabel setArrayValue(float[])
|
||||||
|
controlP5.Controller : Textlabel setArrayValue(int, float)
|
||||||
|
controlP5.Controller : Textlabel setBehavior(ControlBehavior)
|
||||||
|
controlP5.Controller : Textlabel setBroadcast(boolean)
|
||||||
|
controlP5.Controller : Textlabel setCaptionLabel(String)
|
||||||
|
controlP5.Controller : Textlabel setColor(CColor)
|
||||||
|
controlP5.Controller : Textlabel setColorActive(int)
|
||||||
|
controlP5.Controller : Textlabel setColorBackground(int)
|
||||||
|
controlP5.Controller : Textlabel setColorCaptionLabel(int)
|
||||||
|
controlP5.Controller : Textlabel setColorForeground(int)
|
||||||
|
controlP5.Controller : Textlabel setColorValueLabel(int)
|
||||||
|
controlP5.Controller : Textlabel setDecimalPrecision(int)
|
||||||
|
controlP5.Controller : Textlabel setDefaultValue(float)
|
||||||
|
controlP5.Controller : Textlabel setHeight(int)
|
||||||
|
controlP5.Controller : Textlabel setId(int)
|
||||||
|
controlP5.Controller : Textlabel setImages(PImage, PImage, PImage)
|
||||||
|
controlP5.Controller : Textlabel setImages(PImage, PImage, PImage, PImage)
|
||||||
|
controlP5.Controller : Textlabel setLabelVisible(boolean)
|
||||||
|
controlP5.Controller : Textlabel setLock(boolean)
|
||||||
|
controlP5.Controller : Textlabel setMax(float)
|
||||||
|
controlP5.Controller : Textlabel setMin(float)
|
||||||
|
controlP5.Controller : Textlabel setMouseOver(boolean)
|
||||||
|
controlP5.Controller : Textlabel setMoveable(boolean)
|
||||||
|
controlP5.Controller : Textlabel setPosition(PVector)
|
||||||
|
controlP5.Controller : Textlabel setPosition(float, float)
|
||||||
|
controlP5.Controller : Textlabel setSize(PImage)
|
||||||
|
controlP5.Controller : Textlabel setSize(int, int)
|
||||||
|
controlP5.Controller : Textlabel setStringValue(String)
|
||||||
|
controlP5.Controller : Textlabel setUpdate(boolean)
|
||||||
|
controlP5.Controller : Textlabel setValueLabel(String)
|
||||||
|
controlP5.Controller : Textlabel setView(ControllerView)
|
||||||
|
controlP5.Controller : Textlabel setVisible(boolean)
|
||||||
|
controlP5.Controller : Textlabel setWidth(int)
|
||||||
|
controlP5.Controller : Textlabel show()
|
||||||
|
controlP5.Controller : Textlabel unlock()
|
||||||
|
controlP5.Controller : Textlabel unplugFrom(Object)
|
||||||
|
controlP5.Controller : Textlabel unplugFrom(Object[])
|
||||||
|
controlP5.Controller : Textlabel unregisterTooltip()
|
||||||
|
controlP5.Controller : Textlabel update()
|
||||||
|
controlP5.Controller : Textlabel updateSize()
|
||||||
|
controlP5.Controller : boolean isActive()
|
||||||
|
controlP5.Controller : boolean isBroadcast()
|
||||||
|
controlP5.Controller : boolean isInside()
|
||||||
|
controlP5.Controller : boolean isLabelVisible()
|
||||||
|
controlP5.Controller : boolean isListening()
|
||||||
|
controlP5.Controller : boolean isLock()
|
||||||
|
controlP5.Controller : boolean isMouseOver()
|
||||||
|
controlP5.Controller : boolean isMousePressed()
|
||||||
|
controlP5.Controller : boolean isMoveable()
|
||||||
|
controlP5.Controller : boolean isUpdate()
|
||||||
|
controlP5.Controller : boolean isVisible()
|
||||||
|
controlP5.Controller : float getArrayValue(int)
|
||||||
|
controlP5.Controller : float getDefaultValue()
|
||||||
|
controlP5.Controller : float getMax()
|
||||||
|
controlP5.Controller : float getMin()
|
||||||
|
controlP5.Controller : float getValue()
|
||||||
|
controlP5.Controller : float[] getArrayValue()
|
||||||
|
controlP5.Controller : int getDecimalPrecision()
|
||||||
|
controlP5.Controller : int getHeight()
|
||||||
|
controlP5.Controller : int getId()
|
||||||
|
controlP5.Controller : int getWidth()
|
||||||
|
controlP5.Controller : int listenerSize()
|
||||||
|
controlP5.Controller : void remove()
|
||||||
|
controlP5.Controller : void setView(ControllerView, int)
|
||||||
|
java.lang.Object : String toString()
|
||||||
|
java.lang.Object : boolean equals(Object)
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
32
examples/controllers/ControlP5timer/ControlP5timer.pde
Normal file
32
examples/controllers/ControlP5timer/ControlP5timer.pde
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 Timer
|
||||||
|
* by andreas schlegel, 2009
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
ControlTimer c;
|
||||||
|
Textlabel t;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400,400);
|
||||||
|
frameRate(30);
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
c = new ControlTimer();
|
||||||
|
t = new Textlabel(cp5,"--",100,100);
|
||||||
|
c.setSpeedOfTime(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(0);
|
||||||
|
t.setValue(c.toString());
|
||||||
|
t.draw(this);
|
||||||
|
t.setPosition(mouseX, mouseY);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void mousePressed() {
|
||||||
|
c.reset();
|
||||||
|
}
|
206
examples/controllers/ControlP5toggle/ControlP5toggle.pde
Normal file
206
examples/controllers/ControlP5toggle/ControlP5toggle.pde
Normal file
@ -0,0 +1,206 @@
|
|||||||
|
|
||||||
|
/**
|
||||||
|
* ControlP5 Toggle
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* find a list of public methods available for the Toggle Controller
|
||||||
|
* at the bottom of this sketch.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2011
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
int col = color(255);
|
||||||
|
|
||||||
|
boolean toggleValue = false;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400,400);
|
||||||
|
smooth();
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
|
||||||
|
// create a toggle
|
||||||
|
cp5.addToggle("toggleValue")
|
||||||
|
.setPosition(40,100)
|
||||||
|
.setSize(50,20)
|
||||||
|
;
|
||||||
|
|
||||||
|
// create a toggle and change the default look to a (on/off) switch look
|
||||||
|
cp5.addToggle("toggle")
|
||||||
|
.setPosition(40,250)
|
||||||
|
.setSize(50,20)
|
||||||
|
.setValue(true)
|
||||||
|
.setMode(ControlP5.SWITCH)
|
||||||
|
;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(0);
|
||||||
|
|
||||||
|
pushMatrix();
|
||||||
|
|
||||||
|
if(toggleValue==true) {
|
||||||
|
fill(255,255,220);
|
||||||
|
} else {
|
||||||
|
fill(128,128,110);
|
||||||
|
}
|
||||||
|
translate(280,100);
|
||||||
|
ellipse(0,0,100,100);
|
||||||
|
|
||||||
|
|
||||||
|
translate(0,150);
|
||||||
|
fill(col);
|
||||||
|
ellipse(0,0,40,40);
|
||||||
|
|
||||||
|
popMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void toggle(boolean theFlag) {
|
||||||
|
if(theFlag==true) {
|
||||||
|
col = color(255);
|
||||||
|
} else {
|
||||||
|
col = color(100);
|
||||||
|
}
|
||||||
|
println("a toggle event.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
a list of all methods available for the Toggle Controller
|
||||||
|
use ControlP5.printPublicMethodsFor(Toggle.class);
|
||||||
|
to print the following list into the console.
|
||||||
|
|
||||||
|
You can find further details about class Toggle in the javadoc.
|
||||||
|
|
||||||
|
Format:
|
||||||
|
ClassName : returnType methodName(parameter type)
|
||||||
|
|
||||||
|
|
||||||
|
controlP5.Toggle : Toggle setMode(int)
|
||||||
|
controlP5.Toggle : Toggle setState(boolean)
|
||||||
|
controlP5.Toggle : Toggle setValue(boolean)
|
||||||
|
controlP5.Toggle : Toggle setValue(float)
|
||||||
|
controlP5.Toggle : Toggle toggle()
|
||||||
|
controlP5.Toggle : Toggle update()
|
||||||
|
controlP5.Toggle : boolean getState()
|
||||||
|
controlP5.Controller : CColor getColor()
|
||||||
|
controlP5.Controller : ControlBehavior getBehavior()
|
||||||
|
controlP5.Controller : ControlWindow getControlWindow()
|
||||||
|
controlP5.Controller : ControlWindow getWindow()
|
||||||
|
controlP5.Controller : Controller addCallback(CallbackListener)
|
||||||
|
controlP5.Controller : Controller addListener(ControlListener)
|
||||||
|
controlP5.Controller : Controller hide()
|
||||||
|
controlP5.Controller : Controller linebreak()
|
||||||
|
controlP5.Controller : Controller listen(boolean)
|
||||||
|
controlP5.Controller : Controller lock()
|
||||||
|
controlP5.Controller : Controller plugTo(Object)
|
||||||
|
controlP5.Controller : Controller plugTo(Object, String)
|
||||||
|
controlP5.Controller : Controller plugTo(Object[])
|
||||||
|
controlP5.Controller : Controller plugTo(Object[], String)
|
||||||
|
controlP5.Controller : Controller registerProperty(String)
|
||||||
|
controlP5.Controller : Controller registerProperty(String, String)
|
||||||
|
controlP5.Controller : Controller registerTooltip(String)
|
||||||
|
controlP5.Controller : Controller removeBehavior()
|
||||||
|
controlP5.Controller : Controller removeCallback()
|
||||||
|
controlP5.Controller : Controller removeCallback(CallbackListener)
|
||||||
|
controlP5.Controller : Controller removeListener(ControlListener)
|
||||||
|
controlP5.Controller : Controller removeProperty(String)
|
||||||
|
controlP5.Controller : Controller removeProperty(String, String)
|
||||||
|
controlP5.Controller : Controller setArrayValue(float[])
|
||||||
|
controlP5.Controller : Controller setArrayValue(int, float)
|
||||||
|
controlP5.Controller : Controller setBehavior(ControlBehavior)
|
||||||
|
controlP5.Controller : Controller setBroadcast(boolean)
|
||||||
|
controlP5.Controller : Controller setCaptionLabel(String)
|
||||||
|
controlP5.Controller : Controller setColor(CColor)
|
||||||
|
controlP5.Controller : Controller setColorActive(int)
|
||||||
|
controlP5.Controller : Controller setColorBackground(int)
|
||||||
|
controlP5.Controller : Controller setColorCaptionLabel(int)
|
||||||
|
controlP5.Controller : Controller setColorForeground(int)
|
||||||
|
controlP5.Controller : Controller setColorValueLabel(int)
|
||||||
|
controlP5.Controller : Controller setDecimalPrecision(int)
|
||||||
|
controlP5.Controller : Controller setDefaultValue(float)
|
||||||
|
controlP5.Controller : Controller setDisplay(ControllerDisplay)
|
||||||
|
controlP5.Controller : Controller setHeight(int)
|
||||||
|
controlP5.Controller : Controller setId(int)
|
||||||
|
controlP5.Controller : Controller setImages(PImage, PImage, PImage)
|
||||||
|
controlP5.Controller : Controller setImages(PImage, PImage, PImage, PImage)
|
||||||
|
controlP5.Controller : Controller setLabelVisible(boolean)
|
||||||
|
controlP5.Controller : Controller setLock(boolean)
|
||||||
|
controlP5.Controller : Controller setMax(float)
|
||||||
|
controlP5.Controller : Controller setMin(float)
|
||||||
|
controlP5.Controller : Controller setMoveable(boolean)
|
||||||
|
controlP5.Controller : Controller setPosition(PVector)
|
||||||
|
controlP5.Controller : Controller setPosition(float, float)
|
||||||
|
controlP5.Controller : Controller setSize(PImage)
|
||||||
|
controlP5.Controller : Controller setSize(int, int)
|
||||||
|
controlP5.Controller : Controller setStringValue(String)
|
||||||
|
controlP5.Controller : Controller setUpdate(boolean)
|
||||||
|
controlP5.Controller : Controller setValueLabel(String)
|
||||||
|
controlP5.Controller : Controller setVisible(boolean)
|
||||||
|
controlP5.Controller : Controller setWidth(int)
|
||||||
|
controlP5.Controller : Controller show()
|
||||||
|
controlP5.Controller : Controller unlock()
|
||||||
|
controlP5.Controller : Controller unplugFrom(Object)
|
||||||
|
controlP5.Controller : Controller unplugFrom(Object[])
|
||||||
|
controlP5.Controller : Controller unregisterTooltip()
|
||||||
|
controlP5.Controller : Controller update()
|
||||||
|
controlP5.Controller : Controller updateSize()
|
||||||
|
controlP5.Controller : ControllerProperty getProperty(String)
|
||||||
|
controlP5.Controller : ControllerProperty getProperty(String, String)
|
||||||
|
controlP5.Controller : Label getCaptionLabel()
|
||||||
|
controlP5.Controller : Label getValueLabel()
|
||||||
|
controlP5.Controller : List getControllerPlugList()
|
||||||
|
controlP5.Controller : PImage setImage(PImage)
|
||||||
|
controlP5.Controller : PImage setImage(PImage, int)
|
||||||
|
controlP5.Controller : PVector getAbsolutePosition()
|
||||||
|
controlP5.Controller : PVector getPosition()
|
||||||
|
controlP5.Controller : String getAddress()
|
||||||
|
controlP5.Controller : String getInfo()
|
||||||
|
controlP5.Controller : String getLabel()
|
||||||
|
controlP5.Controller : String getName()
|
||||||
|
controlP5.Controller : String getStringValue()
|
||||||
|
controlP5.Controller : String toString()
|
||||||
|
controlP5.Controller : Tab getTab()
|
||||||
|
controlP5.Controller : boolean isActive()
|
||||||
|
controlP5.Controller : boolean isBroadcast()
|
||||||
|
controlP5.Controller : boolean isInside()
|
||||||
|
controlP5.Controller : boolean isListening()
|
||||||
|
controlP5.Controller : boolean isLock()
|
||||||
|
controlP5.Controller : boolean isMouseOver()
|
||||||
|
controlP5.Controller : boolean isMousePressed()
|
||||||
|
controlP5.Controller : boolean isMoveable()
|
||||||
|
controlP5.Controller : boolean isUpdate()
|
||||||
|
controlP5.Controller : boolean isVisible()
|
||||||
|
controlP5.Controller : float getArrayValue(int)
|
||||||
|
controlP5.Controller : float getDefaultValue()
|
||||||
|
controlP5.Controller : float getMax()
|
||||||
|
controlP5.Controller : float getMin()
|
||||||
|
controlP5.Controller : float getValue()
|
||||||
|
controlP5.Controller : float[] getArrayValue()
|
||||||
|
controlP5.Controller : int getHeight()
|
||||||
|
controlP5.Controller : int getId()
|
||||||
|
controlP5.Controller : int getWidth()
|
||||||
|
controlP5.Controller : int listenerSize()
|
||||||
|
controlP5.Controller : void remove()
|
||||||
|
controlP5.Controller : void setDisplay(ControllerDisplay, int)
|
||||||
|
java.lang.Object : String toString()
|
||||||
|
java.lang.Object : boolean equals(Object)
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
112
examples/controllers/ControlP5tooltip/ControlP5tooltip.pde
Normal file
112
examples/controllers/ControlP5tooltip/ControlP5tooltip.pde
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 Tooltip
|
||||||
|
*
|
||||||
|
* add a tooltip to a controller.
|
||||||
|
* hover your mouse on top of a slider in the example and wait
|
||||||
|
* for 1 second for the tooltip to appear.
|
||||||
|
*
|
||||||
|
* find a list of public methods available for the Tooltip Controller
|
||||||
|
* at the bottom of this sketch.
|
||||||
|
*
|
||||||
|
* NOTE: currently does not work for custom PGraphics context
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2011
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
float s1 = 20, s2 = 100;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(700,400);
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// sorry, Tooltip is currently not working
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
cp5.begin(100,100);
|
||||||
|
cp5.addSlider("s1",10,200).linebreak();
|
||||||
|
cp5.addSlider("s2",0,150);
|
||||||
|
cp5.end();
|
||||||
|
|
||||||
|
cp5.getTooltip().setDelay(500);
|
||||||
|
cp5.getTooltip().register("s1","Changes the size of the ellipse.");
|
||||||
|
cp5.getTooltip().register("s2","Changes the Background");
|
||||||
|
|
||||||
|
smooth();
|
||||||
|
noStroke();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void keyPressed() {
|
||||||
|
println("unregistering the tooltip for s2");
|
||||||
|
cp5.getTooltip().unregister("s2");
|
||||||
|
}
|
||||||
|
void draw() {
|
||||||
|
background(s2);
|
||||||
|
fill(255,100);
|
||||||
|
ellipse(width/2, height/2, s1,s1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
a list of all methods available for the Tooltip Controller
|
||||||
|
use ControlP5.printPublicMethodsFor(Tooltip.class);
|
||||||
|
to print the following list into the console.
|
||||||
|
|
||||||
|
You can find further details about class Tooltip in the javadoc.
|
||||||
|
|
||||||
|
Format:
|
||||||
|
ClassName : returnType methodName(parameter type)
|
||||||
|
|
||||||
|
|
||||||
|
controlP5.Tooltip : Label getLabel()
|
||||||
|
controlP5.Tooltip : Tooltip disable()
|
||||||
|
controlP5.Tooltip : Tooltip enable()
|
||||||
|
controlP5.Tooltip : Tooltip register(Controller, String)
|
||||||
|
controlP5.Tooltip : Tooltip register(String, String)
|
||||||
|
controlP5.Tooltip : Tooltip setAlpha(int)
|
||||||
|
controlP5.Tooltip : Tooltip setBorder(int)
|
||||||
|
controlP5.Tooltip : Tooltip setColorBackground(int)
|
||||||
|
controlP5.Tooltip : Tooltip setColorLabel(int)
|
||||||
|
controlP5.Tooltip : Tooltip setDelay(long)
|
||||||
|
controlP5.Tooltip : Tooltip setDisplay(ControllerDisplay)
|
||||||
|
controlP5.Tooltip : Tooltip setHeight(int)
|
||||||
|
controlP5.Tooltip : Tooltip setLabel(Label)
|
||||||
|
controlP5.Tooltip : Tooltip setPositionOffset(float, float)
|
||||||
|
controlP5.Tooltip : Tooltip setWidth(int)
|
||||||
|
controlP5.Tooltip : Tooltip unregister(Controller)
|
||||||
|
controlP5.Tooltip : Tooltip unregister(String)
|
||||||
|
controlP5.Tooltip : boolean isEnabled()
|
||||||
|
controlP5.Tooltip : int getBorder()
|
||||||
|
java.lang.Object : String toString()
|
||||||
|
java.lang.Object : boolean equals(Object)
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
82
examples/controllers/ControlP5window/ControlP5window.pde
Normal file
82
examples/controllers/ControlP5window/ControlP5window.pde
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 ControlWindow
|
||||||
|
* by andreas schlegel, 2012
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
int myColorBackground = color(0, 0, 0);
|
||||||
|
|
||||||
|
ControlWindow controlWindow;
|
||||||
|
|
||||||
|
public int sliderValue = 40;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(700, 400);
|
||||||
|
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
|
||||||
|
|
||||||
|
// PLEASE READ
|
||||||
|
//
|
||||||
|
// With controlP5 2.0 the ControlWindow has been removed,
|
||||||
|
// please see the changelog.txt for details.
|
||||||
|
// Instead, see the extra/ControlP5frame example for
|
||||||
|
// a ControlWindow alternative.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// controlWindow = cp5.addControlWindow("controlP5window", 100, 100, 400, 200)
|
||||||
|
// .hideCoordinates()
|
||||||
|
// .setBackground(color(40))
|
||||||
|
// ;
|
||||||
|
|
||||||
|
cp5.addSlider("sliderValue")
|
||||||
|
.setRange(0, 255)
|
||||||
|
.setPosition(40, 40)
|
||||||
|
.setSize(200, 29)
|
||||||
|
//.moveTo(controlWindow)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(sliderValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
void myTextfield(String theValue) {
|
||||||
|
println(theValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
void myWindowTextfield(String theValue) {
|
||||||
|
println("from controlWindow: "+theValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
void keyPressed() {
|
||||||
|
// if (key==',') cp5.window("controlP5window").hide();
|
||||||
|
// if (key=='.') cp5.window("controlP5window").show();
|
||||||
|
// controlWindow = controlP5.addControlWindow("controlP5window2",600,100,400,200);
|
||||||
|
// controlP5.controller("sliderValue1").moveTo(controlWindow);
|
||||||
|
|
||||||
|
// if (key=='d') {
|
||||||
|
// if (controlWindow.isUndecorated()) {
|
||||||
|
// controlWindow.setUndecorated(false);
|
||||||
|
// } else {
|
||||||
|
// controlWindow.setUndecorated(true);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (key=='t') {
|
||||||
|
// controlWindow.toggleUndecorated();
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,99 @@
|
|||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400, 400);
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
int x = 20;
|
||||||
|
int y = 8;
|
||||||
|
// init our CustomMatrix
|
||||||
|
CustomMatrix m = new CustomMatrix(cp5, "matrix");
|
||||||
|
// set parameters for our CustomMatrix
|
||||||
|
m.setPosition(50, 100)
|
||||||
|
.setSize(200, 200)
|
||||||
|
.setInterval(200)
|
||||||
|
.setGrid(x,y)
|
||||||
|
.setMode(ControlP5.MULTIPLES)
|
||||||
|
.setColorBackground(color(120))
|
||||||
|
.setBackground(color(40));
|
||||||
|
|
||||||
|
// initialize the presets for the CustomMatrix
|
||||||
|
m.initPresets();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// function called by our CustomMatrix with name matrix
|
||||||
|
public void matrix(int x, int y) {
|
||||||
|
println("trigger", x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// extend the Matrix class since we need to override the Matrix's sequencer
|
||||||
|
class CustomMatrix extends Matrix {
|
||||||
|
|
||||||
|
// add a list to store some presets
|
||||||
|
ArrayList<int[][]> presets = new ArrayList<int[][]>();
|
||||||
|
int currentPreset = 0;
|
||||||
|
Thread update;
|
||||||
|
|
||||||
|
CustomMatrix(ControlP5 cp5, String theName) {
|
||||||
|
super(cp5, theName);
|
||||||
|
stop(); // stop the default sequencer and
|
||||||
|
// create our custom sequencer thread. Here we
|
||||||
|
// check if the sequencer has reached the end and if so
|
||||||
|
// we updated to the next preset.
|
||||||
|
update = new Thread(theName) {
|
||||||
|
public void run( ) {
|
||||||
|
while ( true ) {
|
||||||
|
cnt++;
|
||||||
|
cnt %= _myCellX;
|
||||||
|
if (cnt==0) {
|
||||||
|
// we reached the end and go back to start and
|
||||||
|
// update the preset
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
trigger(cnt);
|
||||||
|
try {
|
||||||
|
sleep( _myInterval );
|
||||||
|
}
|
||||||
|
catch ( InterruptedException e ) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
update.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void next() {
|
||||||
|
currentPreset++;
|
||||||
|
currentPreset %= presets.size();
|
||||||
|
setCells(presets.get(currentPreset));
|
||||||
|
}
|
||||||
|
|
||||||
|
// initialize some random presets.
|
||||||
|
void initPresets() {
|
||||||
|
for (int i=0;i<4;i++) {
|
||||||
|
presets.add(createPreset(_myCellX, _myCellY));
|
||||||
|
}
|
||||||
|
setCells(presets.get(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
// create a random preset
|
||||||
|
int[][] createPreset(int theX, int theY) {
|
||||||
|
int[][] preset = new int[theX][theY];
|
||||||
|
for (int x=0;x<theX;x++) {
|
||||||
|
for (int y=0;y<theY;y++) {
|
||||||
|
preset[x][y] = random(1)>0.5 ? 1:0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return preset;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
187
examples/experimental/ControlP5MenuList/ControlP5MenuList.pde
Normal file
187
examples/experimental/ControlP5MenuList/ControlP5MenuList.pde
Normal file
@ -0,0 +1,187 @@
|
|||||||
|
|
||||||
|
/**
|
||||||
|
* ControlP5 MenuList
|
||||||
|
*
|
||||||
|
* A custom Controller, a scrollable Menu List, using a PGraphics buffer.
|
||||||
|
* Allows custom designs for List Item.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2013
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
import static controlP5.ControlP5.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
PFont f1, f2;
|
||||||
|
void setup() {
|
||||||
|
size(800, 500, P3D );
|
||||||
|
f1 = createFont("Helvetica", 20);
|
||||||
|
f2 = createFont("Helvetica", 12);
|
||||||
|
|
||||||
|
cp5 = new ControlP5( this );
|
||||||
|
|
||||||
|
|
||||||
|
/* create a custom MenuList with name menu, notice that function
|
||||||
|
* menu will be called when a menu item has been clicked.
|
||||||
|
*/
|
||||||
|
MenuList m = new MenuList( cp5, "menu", 200, 368 );
|
||||||
|
|
||||||
|
m.setPosition(40, 40);
|
||||||
|
// add some items to our menuList
|
||||||
|
for (int i=0;i<100;i++) {
|
||||||
|
m.addItem(makeItem("headline-"+i, "subline", "some copy lorem ipsum ", createImage(50, 50, RGB)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* a convenience function to build a map that contains our key-value pairs which we will
|
||||||
|
* then use to render each item of the menuList.
|
||||||
|
*/
|
||||||
|
Map<String, Object> makeItem(String theHeadline, String theSubline, String theCopy, PImage theImage) {
|
||||||
|
Map m = new HashMap<String, Object>();
|
||||||
|
m.put("headline", theHeadline);
|
||||||
|
m.put("subline", theSubline);
|
||||||
|
m.put("copy", theCopy);
|
||||||
|
m.put("image", theImage);
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
void menu(int i) {
|
||||||
|
println("got some menu event from item with index "+i);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void controlEvent(ControlEvent theEvent) {
|
||||||
|
if(theEvent.isFrom("menu")){
|
||||||
|
Map m = ((MenuList)theEvent.getController()).getItem(int(theEvent.getValue()));
|
||||||
|
println("got a menu event from item : "+m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background( 40 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* A custom Controller that implements a scrollable menuList. Here the controller
|
||||||
|
* uses a PGraphics element to render customizable list items. The menuList can be scrolled
|
||||||
|
* using the scroll-wheel, touchpad, or mouse-drag. Items are triggered by a click. clicking
|
||||||
|
* the scrollbar to the right makes the list scroll to the item correspoinding to the
|
||||||
|
* click-location.
|
||||||
|
*/
|
||||||
|
class MenuList extends Controller<MenuList> {
|
||||||
|
|
||||||
|
float pos, npos;
|
||||||
|
int itemHeight = 100;
|
||||||
|
int scrollerLength = 40;
|
||||||
|
List< Map<String, Object>> items = new ArrayList< Map<String, Object>>();
|
||||||
|
PGraphics menu;
|
||||||
|
boolean updateMenu;
|
||||||
|
|
||||||
|
MenuList(ControlP5 c, String theName, int theWidth, int theHeight) {
|
||||||
|
super( c, theName, 0, 0, theWidth, theHeight );
|
||||||
|
c.register( this );
|
||||||
|
menu = createGraphics(getWidth(), getHeight() );
|
||||||
|
|
||||||
|
setView(new ControllerView<MenuList>() {
|
||||||
|
|
||||||
|
public void display(PGraphics pg, MenuList t ) {
|
||||||
|
if (updateMenu) {
|
||||||
|
updateMenu();
|
||||||
|
}
|
||||||
|
if (inside() ) {
|
||||||
|
menu.beginDraw();
|
||||||
|
int len = -(itemHeight * items.size()) + getHeight();
|
||||||
|
int ty = int(map(pos, len, 0, getHeight() - scrollerLength - 2, 2 ) );
|
||||||
|
menu.fill(255 );
|
||||||
|
menu.rect(getWidth()-4, ty, 4, scrollerLength );
|
||||||
|
menu.endDraw();
|
||||||
|
}
|
||||||
|
pg.image(menu, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
updateMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* only update the image buffer when necessary - to save some resources */
|
||||||
|
void updateMenu() {
|
||||||
|
int len = -(itemHeight * items.size()) + getHeight();
|
||||||
|
npos = constrain(npos, len, 0);
|
||||||
|
pos += (npos - pos) * 0.1;
|
||||||
|
menu.beginDraw();
|
||||||
|
menu.noStroke();
|
||||||
|
menu.background(255, 64 );
|
||||||
|
menu.textFont(cp5.getFont().getFont());
|
||||||
|
menu.pushMatrix();
|
||||||
|
menu.translate( 0, pos );
|
||||||
|
menu.pushMatrix();
|
||||||
|
|
||||||
|
int i0 = PApplet.max( 0, int(map(-pos, 0, itemHeight * items.size(), 0, items.size())));
|
||||||
|
int range = ceil((float(getHeight())/float(itemHeight))+1);
|
||||||
|
int i1 = PApplet.min( items.size(), i0 + range );
|
||||||
|
|
||||||
|
menu.translate(0, i0*itemHeight);
|
||||||
|
|
||||||
|
for (int i=i0;i<i1;i++) {
|
||||||
|
Map m = items.get(i);
|
||||||
|
menu.fill(255, 100);
|
||||||
|
menu.rect(0, 0, getWidth(), itemHeight-1 );
|
||||||
|
menu.fill(255);
|
||||||
|
menu.textFont(f1);
|
||||||
|
menu.text(m.get("headline").toString(), 10, 20 );
|
||||||
|
menu.textFont(f2);
|
||||||
|
menu.textLeading(12);
|
||||||
|
menu.text(m.get("subline").toString(), 10, 35 );
|
||||||
|
menu.text(m.get("copy").toString(), 10, 50, 120, 50 );
|
||||||
|
menu.image(((PImage)m.get("image")), 140, 10, 50, 50 );
|
||||||
|
menu.translate( 0, itemHeight );
|
||||||
|
}
|
||||||
|
menu.popMatrix();
|
||||||
|
menu.popMatrix();
|
||||||
|
menu.endDraw();
|
||||||
|
updateMenu = abs(npos-pos)>0.01 ? true:false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* when detecting a click, check if the click happend to the far right, if yes, scroll to that position,
|
||||||
|
* otherwise do whatever this item of the list is supposed to do.
|
||||||
|
*/
|
||||||
|
public void onClick() {
|
||||||
|
if (getPointer().x()>getWidth()-10) {
|
||||||
|
npos= -map(getPointer().y(), 0, getHeight(), 0, items.size()*itemHeight);
|
||||||
|
updateMenu = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
int len = itemHeight * items.size();
|
||||||
|
int index = int( map( getPointer().y() - pos, 0, len, 0, items.size() ) ) ;
|
||||||
|
setValue(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onMove() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onDrag() {
|
||||||
|
npos += getPointer().dy() * 2;
|
||||||
|
updateMenu = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onScroll(int n) {
|
||||||
|
npos += ( n * 4 );
|
||||||
|
updateMenu = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void addItem(Map<String, Object> m) {
|
||||||
|
items.add(m);
|
||||||
|
updateMenu = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String,Object> getItem(int theIndex) {
|
||||||
|
return items.get(theIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,257 @@
|
|||||||
|
|
||||||
|
/**
|
||||||
|
* ControlP5 SilderList
|
||||||
|
*
|
||||||
|
* A custom Controller, a scrollable Menu List, using a PGraphics buffer.
|
||||||
|
* Allows custom designs for List Item.
|
||||||
|
*
|
||||||
|
* you will need a controlP5 version >= 2.1.5
|
||||||
|
* you can download a copy from
|
||||||
|
* http://sojamo.de/files/archive/controlP5-2.1.5.zip
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2013
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
PFont f1;
|
||||||
|
int NUM = 100;
|
||||||
|
float[] rotation = new float[NUM];
|
||||||
|
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(800, 500 ,P3D);
|
||||||
|
f1 = createFont("Helvetica", 12);
|
||||||
|
|
||||||
|
cp5 = new ControlP5( this );
|
||||||
|
|
||||||
|
|
||||||
|
// create a custom SilderList with name menu, notice that function
|
||||||
|
// menu will be called when a menu item has been clicked.
|
||||||
|
|
||||||
|
SilderList m = new SilderList( cp5, "menu", 250, 350 );
|
||||||
|
|
||||||
|
m.setPosition(40, 40);
|
||||||
|
// add some items to our SilderList
|
||||||
|
for (int i=0;i<NUM;i++) {
|
||||||
|
m.addItem(makeItem("slider-"+i, 0, -PI, PI ));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// a convenience function to build a map that contains our key-value
|
||||||
|
// pairs which we will then use to render each item of the SilderList.
|
||||||
|
//
|
||||||
|
Map<String, Object> makeItem(String theLabel, float theValue, float theMin, float theMax) {
|
||||||
|
Map m = new HashMap<String, Object>();
|
||||||
|
m.put("label", theLabel);
|
||||||
|
m.put("sliderValue", theValue);
|
||||||
|
m.put("sliderValueMin", theMin);
|
||||||
|
m.put("sliderValueMax", theMax);
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
void menu(int i) {
|
||||||
|
println("got some slider-list event from item with index "+i);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void controlEvent(ControlEvent theEvent) {
|
||||||
|
if (theEvent.isFrom("menu")) {
|
||||||
|
int index = int(theEvent.getValue());
|
||||||
|
Map m = ((SilderList)theEvent.getController()).getItem(index);
|
||||||
|
println("got a slider event from item : "+m);
|
||||||
|
rotation[index] = f(m.get("sliderValue"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background( 255 );
|
||||||
|
fill(0, 128, 255);
|
||||||
|
noStroke();
|
||||||
|
pushMatrix();
|
||||||
|
translate(width/2, 50 );
|
||||||
|
for (int i=0;i<NUM;i++) {
|
||||||
|
pushMatrix();
|
||||||
|
translate((i%10)*35, int(i/10)*35);
|
||||||
|
rotate(rotation[i]);
|
||||||
|
rect(0, 0, 20, 20);
|
||||||
|
popMatrix();
|
||||||
|
}
|
||||||
|
popMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// A custom Controller that implements a scrollable SilderList.
|
||||||
|
// Here the controller uses a PGraphics element to render customizable
|
||||||
|
// list items. The SilderList can be scrolled using the scroll-wheel,
|
||||||
|
// touchpad, or mouse-drag. Slider are triggered by a press or drag.
|
||||||
|
// clicking the scrollbar to the right makes the list scroll to the item
|
||||||
|
// correspoinding to the click-location.
|
||||||
|
|
||||||
|
class SilderList extends Controller<SilderList> {
|
||||||
|
|
||||||
|
float pos, npos;
|
||||||
|
int itemHeight = 60;
|
||||||
|
int scrollerLength = 40;
|
||||||
|
int sliderWidth = 150;
|
||||||
|
int sliderHeight = 15;
|
||||||
|
int sliderX = 10;
|
||||||
|
int sliderY = 25;
|
||||||
|
|
||||||
|
int dragMode = 0;
|
||||||
|
int dragIndex = -1;
|
||||||
|
|
||||||
|
List< Map<String, Object>> items = new ArrayList< Map<String, Object>>();
|
||||||
|
PGraphics menu;
|
||||||
|
boolean updateMenu;
|
||||||
|
|
||||||
|
SilderList(ControlP5 c, String theName, int theWidth, int theHeight) {
|
||||||
|
super( c, theName, 0, 0, theWidth, theHeight );
|
||||||
|
c.register( this );
|
||||||
|
menu = createGraphics(getWidth(), getHeight());
|
||||||
|
|
||||||
|
setView(new ControllerView<SilderList>() {
|
||||||
|
|
||||||
|
public void display(PGraphics pg, SilderList t ) {
|
||||||
|
if (updateMenu) {
|
||||||
|
updateMenu();
|
||||||
|
}
|
||||||
|
if (inside() ) { // draw scrollbar
|
||||||
|
menu.beginDraw();
|
||||||
|
int len = -(itemHeight * items.size()) + getHeight();
|
||||||
|
int ty = int(map(pos, len, 0, getHeight() - scrollerLength - 2, 2 ) );
|
||||||
|
menu.fill( 128 );
|
||||||
|
menu.rect(getWidth()-6, ty, 4, scrollerLength );
|
||||||
|
menu.endDraw();
|
||||||
|
}
|
||||||
|
pg.image(menu, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
updateMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
// only update the image buffer when necessary - to save some resources
|
||||||
|
void updateMenu() {
|
||||||
|
int len = -(itemHeight * items.size()) + getHeight();
|
||||||
|
npos = constrain(npos, len, 0);
|
||||||
|
pos += (npos - pos) * 0.1;
|
||||||
|
|
||||||
|
/// draw the SliderList
|
||||||
|
menu.beginDraw();
|
||||||
|
menu.noStroke();
|
||||||
|
menu.background(240);
|
||||||
|
menu.textFont(cp5.getFont().getFont());
|
||||||
|
menu.pushMatrix();
|
||||||
|
menu.translate( 0, int(pos) );
|
||||||
|
menu.pushMatrix();
|
||||||
|
|
||||||
|
int i0 = PApplet.max( 0, int(map(-pos, 0, itemHeight * items.size(), 0, items.size())));
|
||||||
|
int range = ceil((float(getHeight())/float(itemHeight))+1);
|
||||||
|
int i1 = PApplet.min( items.size(), i0 + range );
|
||||||
|
|
||||||
|
menu.translate(0, i0*itemHeight);
|
||||||
|
|
||||||
|
for (int i=i0;i<i1;i++) {
|
||||||
|
Map m = items.get(i);
|
||||||
|
menu.noStroke();
|
||||||
|
menu.fill(200);
|
||||||
|
menu.rect(0, itemHeight-1, getWidth(), 1 );
|
||||||
|
menu.fill(150);
|
||||||
|
// uncomment the following line to use a different font than the default controlP5 font
|
||||||
|
//menu.textFont(f1);
|
||||||
|
String txt = String.format("%s %.2f", m.get("label").toString().toUpperCase(), f(items.get(i).get("sliderValue")));
|
||||||
|
menu.text(txt, 10, 20 );
|
||||||
|
menu.fill(255);
|
||||||
|
menu.rect(sliderX, sliderY, sliderWidth, sliderHeight);
|
||||||
|
menu.fill(100, 230, 128);
|
||||||
|
float min = f(items.get(i).get("sliderValueMin"));
|
||||||
|
float max = f(items.get(i).get("sliderValueMax"));
|
||||||
|
float val = f(items.get(i).get("sliderValue"));
|
||||||
|
menu.rect(sliderX, sliderY, map(val, min, max, 0, sliderWidth), sliderHeight);
|
||||||
|
menu.translate( 0, itemHeight );
|
||||||
|
}
|
||||||
|
menu.popMatrix();
|
||||||
|
menu.popMatrix();
|
||||||
|
menu.endDraw();
|
||||||
|
updateMenu = abs(npos-pos)>0.01 ? true:false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// when detecting a click, check if the click happend to the far right,
|
||||||
|
// if yes, scroll to that position, otherwise do whatever this item of
|
||||||
|
// the list is supposed to do.
|
||||||
|
public void onClick() {
|
||||||
|
if (getPointer().x()>getWidth()-10) {
|
||||||
|
npos= -map(getPointer().y(), 0, getHeight(), 0, items.size()*itemHeight);
|
||||||
|
updateMenu = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void onPress() {
|
||||||
|
int x = getPointer().x();
|
||||||
|
int y = (int)(getPointer().y()-pos)%itemHeight;
|
||||||
|
boolean withinSlider = within(x, y, sliderX, sliderY, sliderWidth, sliderHeight);
|
||||||
|
dragMode = withinSlider ? 2:1;
|
||||||
|
if (dragMode==2) {
|
||||||
|
dragIndex = getIndex();
|
||||||
|
float min = f(items.get(dragIndex).get("sliderValueMin"));
|
||||||
|
float max = f(items.get(dragIndex).get("sliderValueMax"));
|
||||||
|
float val = constrain(map(getPointer().x()-sliderX, 0, sliderWidth, min, max), min, max);
|
||||||
|
items.get(dragIndex).put("sliderValue", val);
|
||||||
|
setValue(dragIndex);
|
||||||
|
}
|
||||||
|
updateMenu = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onDrag() {
|
||||||
|
switch(dragMode) {
|
||||||
|
case(1): // drag and scroll the list
|
||||||
|
npos += getPointer().dy() * 2;
|
||||||
|
updateMenu = true;
|
||||||
|
break;
|
||||||
|
case(2): // drag slider
|
||||||
|
float min = f(items.get(dragIndex).get("sliderValueMin"));
|
||||||
|
float max = f(items.get(dragIndex).get("sliderValueMax"));
|
||||||
|
float val = constrain(map(getPointer().x()-sliderX, 0, sliderWidth, min, max), min, max);
|
||||||
|
items.get(dragIndex).put("sliderValue", val);
|
||||||
|
setValue(dragIndex);
|
||||||
|
updateMenu = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onScroll(int n) {
|
||||||
|
npos += ( n * 4 );
|
||||||
|
updateMenu = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void addItem(Map<String, Object> m) {
|
||||||
|
items.add(m);
|
||||||
|
updateMenu = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, Object> getItem(int theIndex) {
|
||||||
|
return items.get(theIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getIndex() {
|
||||||
|
int len = itemHeight * items.size();
|
||||||
|
int index = int( map( getPointer().y() - pos, 0, len, 0, items.size() ) ) ;
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float f( Object o ) {
|
||||||
|
return ( o instanceof Number ) ? ( ( Number ) o ).floatValue( ) : Float.MIN_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean within(int theX, int theY, int theX1, int theY1, int theW1, int theH1) {
|
||||||
|
return (theX>theX1 && theX<theX1+theW1 && theY>theY1 && theY<theY1+theH1);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,112 @@
|
|||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
// Editable Numberbox for ControlP5
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400, 400);
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
|
||||||
|
Numberbox n = cp5.addNumberbox("numbers")
|
||||||
|
.setSize(100, 20)
|
||||||
|
.setPosition(100, 100)
|
||||||
|
.setValue(0)
|
||||||
|
;
|
||||||
|
|
||||||
|
makeEditable( n );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// function that will be called when controller 'numbers' changes
|
||||||
|
public void numbers(float f) {
|
||||||
|
println("received "+f+" from Numberbox numbers ");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void makeEditable( Numberbox n ) {
|
||||||
|
// allows the user to click a numberbox and type in a number which is confirmed with RETURN
|
||||||
|
|
||||||
|
|
||||||
|
final NumberboxInput nin = new NumberboxInput( n ); // custom input handler for the numberbox
|
||||||
|
|
||||||
|
// control the active-status of the input handler when releasing the mouse button inside
|
||||||
|
// the numberbox. deactivate input handler when mouse leaves.
|
||||||
|
n.onClick(new CallbackListener() {
|
||||||
|
public void controlEvent(CallbackEvent theEvent) {
|
||||||
|
nin.setActive( true );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
).onLeave(new CallbackListener() {
|
||||||
|
public void controlEvent(CallbackEvent theEvent) {
|
||||||
|
nin.setActive( false ); nin.submit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// input handler for a Numberbox that allows the user to
|
||||||
|
// key in numbers with the keyboard to change the value of the numberbox
|
||||||
|
|
||||||
|
public class NumberboxInput {
|
||||||
|
|
||||||
|
String text = "";
|
||||||
|
|
||||||
|
Numberbox n;
|
||||||
|
|
||||||
|
boolean active;
|
||||||
|
|
||||||
|
|
||||||
|
NumberboxInput(Numberbox theNumberbox) {
|
||||||
|
n = theNumberbox;
|
||||||
|
registerMethod("keyEvent", this );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void keyEvent(KeyEvent k) {
|
||||||
|
// only process key event if input is active
|
||||||
|
if (k.getAction()==KeyEvent.PRESS && active) {
|
||||||
|
if (k.getKey()=='\n') { // confirm input with enter
|
||||||
|
submit();
|
||||||
|
return;
|
||||||
|
} else if(k.getKeyCode()==BACKSPACE) {
|
||||||
|
text = text.isEmpty() ? "":text.substring(0, text.length()-1);
|
||||||
|
//text = ""; // clear all text with backspace
|
||||||
|
}
|
||||||
|
else if(k.getKey()<255) {
|
||||||
|
// check if the input is a valid (decimal) number
|
||||||
|
final String regex = "\\d+([.]\\d{0,2})?";
|
||||||
|
String s = text + k.getKey();
|
||||||
|
if ( java.util.regex.Pattern.matches(regex, s ) ) {
|
||||||
|
text += k.getKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
n.getValueLabel().setText(this.text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActive(boolean b) {
|
||||||
|
active = b;
|
||||||
|
if(active) {
|
||||||
|
n.getValueLabel().setText("");
|
||||||
|
text = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void submit() {
|
||||||
|
if (!text.isEmpty()) {
|
||||||
|
n.setValue( float( text ) );
|
||||||
|
text = "";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
n.getValueLabel().setText(""+n.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,50 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 ControlP5graphics
|
||||||
|
*
|
||||||
|
* shows you how to render controlP5 instances into a PGraphics buffer.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 c1 , c2;
|
||||||
|
PGraphics panel1 , panel2;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size( 1024, 500 ,P3D );
|
||||||
|
|
||||||
|
/* create 2 buffers */
|
||||||
|
panel1 = createGraphics( 200 , height/2 );
|
||||||
|
panel2 = createGraphics( 200 , height/2 );
|
||||||
|
|
||||||
|
/* create the first instance of ControlP5 which will be rendered into panel1 */
|
||||||
|
c1 = new ControlP5( this );
|
||||||
|
c1.enableShortcuts();
|
||||||
|
c1.setBackground( color( 0 , 50 ) );
|
||||||
|
c1.addButton("hello").setSize(200,20).setPosition( 0 , 0 );
|
||||||
|
c1.addButton("world").setSize(200,100).setPosition( 0 , 70 );
|
||||||
|
c1.addSlider("slider").setSize(50,20).setPosition( 0 , 40 );
|
||||||
|
c1.setGraphics( panel1 , 0 , 0 );
|
||||||
|
|
||||||
|
/* create the second instance of ControlP5 which will be rendered into panel2 */
|
||||||
|
c2 = new ControlP5( this );
|
||||||
|
c2.enableShortcuts();
|
||||||
|
c2.setBackground( color( 0 , 50 ) );
|
||||||
|
c2.addButton("hello").setSize(200,20).setPosition( 0 , 0 );
|
||||||
|
c2.addButton("world").setSize(200,100).setPosition( 0 , 70 );
|
||||||
|
c2.addSlider("slider").setSize(50,20).setPosition( 0 , 40 );
|
||||||
|
c2.setGraphics( panel2 , 220 , 0 );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background( 100 , 0 , 0 );
|
||||||
|
/* to change location, un-comment line below */
|
||||||
|
// c1.setGraphics( panel1 , int(sin(frameCount*0.1) * 100) , 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void controlEvent( ControlEvent ce) {
|
||||||
|
println(ce);
|
||||||
|
}
|
123
examples/experimental/MidiMapper/MidiMapper.pde
Normal file
123
examples/experimental/MidiMapper/MidiMapper.pde
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ControlP5 MidiMapper
|
||||||
|
*
|
||||||
|
* Maps midi input to controlP5 controllers.
|
||||||
|
* This will eventually result in a library.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2013
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import controlP5.*;
|
||||||
|
import javax.sound.midi.Receiver;
|
||||||
|
import javax.sound.midi.MidiMessage;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
Map<String, String> midimapper = new HashMap<String, String>();
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
|
||||||
|
size( 600, 400 );
|
||||||
|
|
||||||
|
cp5 = new ControlP5( this );
|
||||||
|
|
||||||
|
cp5.begin(cp5.addTab("a"));
|
||||||
|
cp5.addSlider("a-1").setPosition(20, 120).setSize(200, 20);
|
||||||
|
cp5.addSlider("a-2").setPosition(20, 160).setSize(200, 20);
|
||||||
|
cp5.addSlider("a-3").setPosition(20, 200).setSize(200, 20);
|
||||||
|
cp5.addToggle("a-4").setPosition(280, 120).setSize(100, 20);
|
||||||
|
cp5.addButton("a-5").setPosition(280, 160).setSize(100, 20);
|
||||||
|
cp5.addBang("a-6").setPosition(280, 200).setSize(100, 20);
|
||||||
|
cp5.end();
|
||||||
|
|
||||||
|
cp5.begin(cp5.addTab("b"));
|
||||||
|
cp5.addSlider("b-1").setPosition(20, 120).setSize(200, 20);
|
||||||
|
cp5.addSlider("b-2").setPosition(20, 160).setSize(200, 20);
|
||||||
|
cp5.addSlider("b-3").setPosition(20, 200).setSize(200, 20);
|
||||||
|
cp5.end();
|
||||||
|
|
||||||
|
final String device = "SLIDER/KNOB";
|
||||||
|
|
||||||
|
//midimapper.clear();
|
||||||
|
|
||||||
|
midimapper.put( ref( device, 0 ), "a-1" );
|
||||||
|
midimapper.put( ref( device, 1 ), "a-2" );
|
||||||
|
midimapper.put( ref( device, 2 ), "a-3" );
|
||||||
|
midimapper.put( ref( device, 32 ), "a-4" );
|
||||||
|
midimapper.put( ref( device, 48 ), "a-5" );
|
||||||
|
midimapper.put( ref( device, 64 ), "a-6" );
|
||||||
|
|
||||||
|
midimapper.put( ref( device, 16 ), "b-1" );
|
||||||
|
midimapper.put( ref( device, 17 ), "b-2" );
|
||||||
|
midimapper.put( ref( device, 18 ), "b-3" );
|
||||||
|
|
||||||
|
boolean DEBUG = false;
|
||||||
|
|
||||||
|
if (DEBUG) {
|
||||||
|
new MidiSimple( device );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
new MidiSimple( device , new Receiver() {
|
||||||
|
|
||||||
|
@Override public void send( MidiMessage msg, long timeStamp ) {
|
||||||
|
|
||||||
|
byte[] b = msg.getMessage();
|
||||||
|
|
||||||
|
if ( b[ 0 ] != -48 ) {
|
||||||
|
|
||||||
|
Object index = ( midimapper.get( ref( device , b[ 1 ] ) ) );
|
||||||
|
|
||||||
|
if ( index != null ) {
|
||||||
|
|
||||||
|
Controller c = cp5.getController(index.toString());
|
||||||
|
if (c instanceof Slider ) {
|
||||||
|
float min = c.getMin();
|
||||||
|
float max = c.getMax();
|
||||||
|
c.setValue(map(b[ 2 ], 0, 127, min, max) );
|
||||||
|
} else if ( c instanceof Button ) {
|
||||||
|
if ( b[ 2 ] > 0 ) {
|
||||||
|
c.setValue( c.getValue( ) );
|
||||||
|
c.setColorBackground( 0xff08a2cf );
|
||||||
|
} else {
|
||||||
|
c.setColorBackground( 0xff003652 );
|
||||||
|
}
|
||||||
|
} else if ( c instanceof Bang ) {
|
||||||
|
if ( b[ 2 ] > 0 ) {
|
||||||
|
c.setValue( c.getValue( ) );
|
||||||
|
c.setColorForeground( 0xff08a2cf );
|
||||||
|
} else {
|
||||||
|
c.setColorForeground( 0xff00698c );
|
||||||
|
}
|
||||||
|
} else if ( c instanceof Toggle ) {
|
||||||
|
if ( b[ 2 ] > 0 ) {
|
||||||
|
( ( Toggle ) c ).toggle( );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public void close( ) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
String ref(String theDevice, int theIndex) {
|
||||||
|
return theDevice+"-"+theIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
107
examples/experimental/MidiMapper/MidiSimple.java
Normal file
107
examples/experimental/MidiMapper/MidiSimple.java
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.sound.midi.MidiDevice;
|
||||||
|
import javax.sound.midi.MidiMessage;
|
||||||
|
import javax.sound.midi.MidiSystem;
|
||||||
|
import javax.sound.midi.MidiUnavailableException;
|
||||||
|
import javax.sound.midi.Receiver;
|
||||||
|
import javax.sound.midi.Transmitter;
|
||||||
|
|
||||||
|
public class MidiSimple {
|
||||||
|
|
||||||
|
public MidiSimple( String theDeviceName , Receiver theReceiver ) {
|
||||||
|
|
||||||
|
MidiDevice.Info[] aInfos = MidiSystem.getMidiDeviceInfo();
|
||||||
|
for ( int i = 0; i < aInfos.length; i++ ) {
|
||||||
|
try {
|
||||||
|
MidiDevice device = MidiSystem.getMidiDevice( aInfos[ i ] );
|
||||||
|
boolean bAllowsInput = ( device.getMaxTransmitters() != 0 );
|
||||||
|
boolean bAllowsOutput = ( device.getMaxReceivers() != 0 );
|
||||||
|
System.out.println( "" + i + " " + ( bAllowsInput ? "IN " : " " ) + ( bAllowsOutput ? "OUT " : " " ) + aInfos[ i ].getName() + ", " + aInfos[ i ].getVendor() + ", "
|
||||||
|
+ aInfos[ i ].getVersion() + ", " + aInfos[ i ].getDescription() );
|
||||||
|
}
|
||||||
|
catch ( MidiUnavailableException e ) {
|
||||||
|
// device is obviously not available...
|
||||||
|
// out(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
MidiDevice device;
|
||||||
|
device = MidiSystem.getMidiDevice( getMidiDeviceInfo( theDeviceName, false ) );
|
||||||
|
device.open();
|
||||||
|
Transmitter conTrans = device.getTransmitter();
|
||||||
|
conTrans.setReceiver( theReceiver );
|
||||||
|
}
|
||||||
|
catch ( MidiUnavailableException e ) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
System.out.println("No Midi device ( "+theDeviceName+" ) is available.");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public MidiSimple( String theDeviceName ) {
|
||||||
|
new MidiSimple(theDeviceName , new MidiInputReceiver( theDeviceName ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public MidiDevice.Info getMidiDeviceInfo( String strDeviceName, boolean bForOutput ) {
|
||||||
|
MidiDevice.Info[] aInfos = MidiSystem.getMidiDeviceInfo();
|
||||||
|
for ( int i = 0; i < aInfos.length; i++ ) {
|
||||||
|
if ( aInfos[ i ].getName().equals( strDeviceName ) ) {
|
||||||
|
try {
|
||||||
|
MidiDevice device = MidiSystem.getMidiDevice( aInfos[ i ] );
|
||||||
|
boolean bAllowsInput = ( device.getMaxTransmitters() != 0 );
|
||||||
|
boolean bAllowsOutput = ( device.getMaxReceivers() != 0 );
|
||||||
|
if ( ( bAllowsOutput && bForOutput ) || ( bAllowsInput && !bForOutput ) ) {
|
||||||
|
return aInfos[ i ];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch ( MidiUnavailableException e ) {
|
||||||
|
// TODO:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
class MidiInputReceiver implements Receiver {
|
||||||
|
public String name;
|
||||||
|
Map< Byte, String > commandMap = new HashMap< Byte, String >();
|
||||||
|
|
||||||
|
public MidiInputReceiver( String name ) {
|
||||||
|
this.name = name;
|
||||||
|
commandMap.put( ( byte ) -112, "Note On" );
|
||||||
|
commandMap.put( ( byte ) -128, "Note Off" );
|
||||||
|
commandMap.put( ( byte ) -48, "Channel Pressure" );
|
||||||
|
commandMap.put( ( byte ) -80, "Continuous Controller" );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void send( MidiMessage msg, long timeStamp ) {
|
||||||
|
System.out.println( "midi received (" + name + ")" );
|
||||||
|
System.out.println( "Timestamp: " + timeStamp );
|
||||||
|
byte[] b = msg.getMessage();
|
||||||
|
|
||||||
|
if ( b[ 0 ] != -48 ) {
|
||||||
|
// System.out.println("Message length: " + msg.getLength());
|
||||||
|
System.out.println( "Note command: " + commandMap.get( b[ 0 ] ) );
|
||||||
|
System.out.println( "Which note: " + b[ 1 ] );
|
||||||
|
System.out.println( "Note pressure: " + b[ 2 ] );
|
||||||
|
System.out.println( "---------------------" );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// System.out.println("Message length: " + msg.getLength());
|
||||||
|
System.out.println( "Note command: " + commandMap.get( b[ 0 ] ) );
|
||||||
|
System.out.println( "Note Pressure: " + b[ 1 ] );
|
||||||
|
System.out.println( "---------------------" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void close( ) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,58 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 Autodetect Fields
|
||||||
|
*
|
||||||
|
* test sketch, controller values will automatically be set
|
||||||
|
* to its corresponding sketch fields.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2011
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
int s1 = 50;
|
||||||
|
int s2 = 50;
|
||||||
|
|
||||||
|
int nb1 = 50;
|
||||||
|
int nb2 = 50;
|
||||||
|
|
||||||
|
int k1 = 50;
|
||||||
|
int k2 = 50;
|
||||||
|
|
||||||
|
boolean t1 = false;
|
||||||
|
boolean t2 = false;
|
||||||
|
|
||||||
|
int r1 = 20;
|
||||||
|
int r2 = 50;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400,400);
|
||||||
|
ControlP5 cp5 = new ControlP5(this);
|
||||||
|
cp5.addSlider("s1",10,150,10,10,100,15).setLabel("50");
|
||||||
|
cp5.addSlider("s2",10,150,20,150,10,100,15).setLabel("20");
|
||||||
|
|
||||||
|
cp5.addNumberbox("nb1",10,50,100,15).setLabel("50");
|
||||||
|
cp5.addNumberbox("nb2",20,150,50,100,15).setLabel("20");
|
||||||
|
|
||||||
|
cp5.addKnob("k1",10,150,10,150,50).setLabel("50");
|
||||||
|
cp5.addKnob("k2",10,150,20,150,150,50).setLabel("20");
|
||||||
|
|
||||||
|
cp5.addToggle("t1",10,240,100,15).setLabel("false");
|
||||||
|
cp5.addToggle("t2",true,150,240,100,15).setLabel("true");
|
||||||
|
|
||||||
|
cp5.addButton("b1",50,10,280,100,15).setLabel("50");
|
||||||
|
cp5.addButton("b2",20,150,280,100,15).setLabel("20");
|
||||||
|
|
||||||
|
cp5.addRange("r1",10,150,r1,r2,10,320,100,15).setLabel("50");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void controlEvent(ControlEvent c) {
|
||||||
|
println(c.getValue());
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
Test t;
|
||||||
|
void setup() {
|
||||||
|
cp5 = new ControlP5( this );
|
||||||
|
t = new Test( "test" );
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
println( t.value );
|
||||||
|
}
|
||||||
|
|
||||||
|
class Test {
|
||||||
|
|
||||||
|
int value;
|
||||||
|
|
||||||
|
Test( String thePrefix ) {
|
||||||
|
cp5.addSlider( "value-"+thePrefix )
|
||||||
|
.setRange( 0, 255 )
|
||||||
|
.plugTo( this, "setValue" )
|
||||||
|
.setValue( 127 )
|
||||||
|
.setLabel("value")
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setValue(int theValue) {
|
||||||
|
value = theValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,72 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 DrawIntoCanvas
|
||||||
|
*
|
||||||
|
* this example demonstrates how to draw into a Canvas.
|
||||||
|
* Click and drag the mouse to show and draw into the Canvas.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2011
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
Canvas cc;
|
||||||
|
|
||||||
|
// your controlWindowCanvas class
|
||||||
|
class MyCanvas extends Canvas {
|
||||||
|
|
||||||
|
boolean mousePressed;
|
||||||
|
int mouseX, mouseY;
|
||||||
|
public void update(PApplet theApplet) {
|
||||||
|
mousePressed = theApplet.mousePressed;
|
||||||
|
mouseX = theApplet.mouseX;
|
||||||
|
mouseY = theApplet.mouseY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void draw(PGraphics theApplet) {
|
||||||
|
theApplet.background(255);
|
||||||
|
// a rectangle will be drawn if the mouse has been
|
||||||
|
// pressed inside the main sketch window.
|
||||||
|
// mousePressed here refers to the mousePressed
|
||||||
|
// variable of your main sketch
|
||||||
|
if(mousePressed) {
|
||||||
|
theApplet.fill(255,0,0);
|
||||||
|
theApplet.rect(10,10,100,100);
|
||||||
|
theApplet.fill(0);
|
||||||
|
theApplet.ellipse(mouseX,mouseY,20,20);
|
||||||
|
}
|
||||||
|
// will draw a rectangle into the controlWindow
|
||||||
|
// if the mouse has been pressed inside the controlWindow itself.
|
||||||
|
// theApplet.mousePressed here refers to the
|
||||||
|
// mousePressed variable of the controlWindow.
|
||||||
|
if(mousePressed) {
|
||||||
|
theApplet.fill(0);
|
||||||
|
theApplet.rect(10,10,100,100);
|
||||||
|
theApplet.fill(255,0,0);
|
||||||
|
theApplet.ellipse(mouseX,mouseY,20,20);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400,400);
|
||||||
|
frameRate(30);
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
|
||||||
|
cc = new MyCanvas();
|
||||||
|
cc.pre();
|
||||||
|
cp5.addCanvas(cc);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw(){
|
||||||
|
background(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
71
examples/extra/ControlP5console/ControlP5console.pde
Normal file
71
examples/extra/ControlP5console/ControlP5console.pde
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 Println
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* a console like textarea which captures the output from the System.out stream
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
Textarea myTextarea;
|
||||||
|
|
||||||
|
int c = 0;
|
||||||
|
|
||||||
|
Println console;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(700, 400);
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
cp5.enableShortcuts();
|
||||||
|
frameRate(50);
|
||||||
|
myTextarea = cp5.addTextarea("txt")
|
||||||
|
.setPosition(100, 100)
|
||||||
|
.setSize(200, 200)
|
||||||
|
.setFont(createFont("", 10))
|
||||||
|
.setLineHeight(14)
|
||||||
|
.setColor(color(200))
|
||||||
|
.setColorBackground(color(0, 100))
|
||||||
|
.setColorForeground(color(255, 100));
|
||||||
|
;
|
||||||
|
|
||||||
|
console = cp5.addConsole(myTextarea);//
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(128);
|
||||||
|
noStroke();
|
||||||
|
ellipseMode(CENTER);
|
||||||
|
float n = sin(frameCount*0.01)*300;
|
||||||
|
fill(110, 255,220);
|
||||||
|
ellipse(width/2, height/2, n , n);
|
||||||
|
|
||||||
|
println(frameCount+"\t"+String.format("%.2f", frameRate)+"\t"+String.format("%.2f", n));
|
||||||
|
}
|
||||||
|
|
||||||
|
void keyPressed() {
|
||||||
|
switch(key) {
|
||||||
|
case('1'):
|
||||||
|
console.pause();
|
||||||
|
break;
|
||||||
|
case('2'):
|
||||||
|
console.play();
|
||||||
|
break;
|
||||||
|
case('3'):
|
||||||
|
console.setMax(8);
|
||||||
|
break;
|
||||||
|
case('4'):
|
||||||
|
console.setMax(-1);
|
||||||
|
break;
|
||||||
|
case('5'):
|
||||||
|
console.clear();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,148 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 Controller on top of 3D
|
||||||
|
* demonstrates how to use controlP5 controllers on top of a
|
||||||
|
* OpenGL 3D scene.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2011
|
||||||
|
* www.sojamo.de/libraries/controlP5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
import processing.opengl.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
ControlGroup messageBox;
|
||||||
|
int messageBoxResult = -1;
|
||||||
|
String messageBoxString = "";
|
||||||
|
float t;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(640,480,P3D);
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
noStroke();
|
||||||
|
createMessageBox();
|
||||||
|
Button b = cp5.addButton("toggleBox",1,20,20,100,20);
|
||||||
|
b.setLabel("Toggle Box");
|
||||||
|
textFont(createFont("",30));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
hint(ENABLE_DEPTH_TEST);
|
||||||
|
pushMatrix();
|
||||||
|
if(messageBox.isVisible()) {
|
||||||
|
background(128);
|
||||||
|
} else {
|
||||||
|
background(0);
|
||||||
|
fill(255);
|
||||||
|
text(messageBoxString,20,height-40);
|
||||||
|
}
|
||||||
|
|
||||||
|
translate(width/2,height/2,mouseX);
|
||||||
|
rotateY(t+=0.1);
|
||||||
|
fill(255);
|
||||||
|
rect(-50,-50,100,100);
|
||||||
|
popMatrix();
|
||||||
|
hint(DISABLE_DEPTH_TEST);
|
||||||
|
// in case yo uare using the camera or you have
|
||||||
|
// changed the default camera setting, reset the camera
|
||||||
|
// to default by uncommenting the following line.
|
||||||
|
// camera();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void toggleBox(int theValue) {
|
||||||
|
if(messageBox.isVisible()) {
|
||||||
|
messageBox.hide();
|
||||||
|
} else {
|
||||||
|
messageBox.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void createMessageBox() {
|
||||||
|
// create a group to store the messageBox elements
|
||||||
|
messageBox = cp5.addGroup("messageBox",width/2 - 150,100,300);
|
||||||
|
messageBox.setBackgroundHeight(120);
|
||||||
|
messageBox.setBackgroundColor(color(0,100));
|
||||||
|
messageBox.hideBar();
|
||||||
|
|
||||||
|
// add a TextLabel to the messageBox.
|
||||||
|
Textlabel l = cp5.addTextlabel("messageBoxLabel","Some MessageBox text goes here.",20,20);
|
||||||
|
l.moveTo(messageBox);
|
||||||
|
|
||||||
|
// add a textfield-controller with named-id inputbox
|
||||||
|
// this controller will be linked to function inputbox() below.
|
||||||
|
Textfield f = cp5.addTextfield("inputbox",20,36,260,20);
|
||||||
|
f.getCaptionLabel().setVisible(false);
|
||||||
|
f.moveTo(messageBox);
|
||||||
|
f.setColorForeground(color(20));
|
||||||
|
f.setColorBackground(color(20));
|
||||||
|
f.setColorActive(color(100));
|
||||||
|
// add the OK button to the messageBox.
|
||||||
|
// the name of the button corresponds to function buttonOK
|
||||||
|
// below and will be triggered when pressing the button.
|
||||||
|
Button b1 = cp5.addButton("buttonOK",0,65,80,80,24);
|
||||||
|
b1.moveTo(messageBox);
|
||||||
|
b1.setColorBackground(color(40));
|
||||||
|
b1.setColorActive(color(20));
|
||||||
|
// by default setValue would trigger function buttonOK,
|
||||||
|
// therefore we disable the broadcasting before setting
|
||||||
|
// the value and enable broadcasting again afterwards.
|
||||||
|
// same applies to the cancel button below.
|
||||||
|
b1.setBroadcast(false);
|
||||||
|
b1.setValue(1);
|
||||||
|
b1.setBroadcast(true);
|
||||||
|
b1.setCaptionLabel("OK");
|
||||||
|
// centering of a label needs to be done manually
|
||||||
|
// with marginTop and marginLeft
|
||||||
|
//b1.captionLabel().style().marginTop = -2;
|
||||||
|
//b1.captionLabel().style().marginLeft = 26;
|
||||||
|
|
||||||
|
// add the Cancel button to the messageBox.
|
||||||
|
// the name of the button corresponds to function buttonCancel
|
||||||
|
// below and will be triggered when pressing the button.
|
||||||
|
Button b2 = cp5.addButton("buttonCancel",0,155,80,80,24);
|
||||||
|
b2.moveTo(messageBox);
|
||||||
|
b2.setBroadcast(false);
|
||||||
|
b2.setValue(0);
|
||||||
|
b2.setBroadcast(true);
|
||||||
|
b2.setCaptionLabel("Cancel");
|
||||||
|
b2.setColorBackground(color(40));
|
||||||
|
b2.setColorActive(color(20));
|
||||||
|
//b2.captionLabel().toUpperCase(false);
|
||||||
|
// centering of a label needs to be done manually
|
||||||
|
// with marginTop and marginLeft
|
||||||
|
//b2.captionLabel().style().marginTop = -2;
|
||||||
|
//b2.captionLabel().style().marginLeft = 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
// function buttonOK will be triggered when pressing
|
||||||
|
// the OK button of the messageBox.
|
||||||
|
void buttonOK(int theValue) {
|
||||||
|
println("a button event from button OK.");
|
||||||
|
messageBoxString = ((Textfield)cp5.getController("inputbox")).getText();
|
||||||
|
messageBoxResult = theValue;
|
||||||
|
messageBox.hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// function buttonCancel will be triggered when pressing
|
||||||
|
// the Cancel button of the messageBox.
|
||||||
|
void buttonCancel(int theValue) {
|
||||||
|
println("a button event from button Cancel.");
|
||||||
|
messageBoxResult = theValue;
|
||||||
|
messageBox.hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
// inputbox is called whenever RETURN has been pressed
|
||||||
|
// in textfield-controller inputbox
|
||||||
|
void inputbox(String theString) {
|
||||||
|
println("got something from the inputbox : "+theString);
|
||||||
|
messageBoxString = theString;
|
||||||
|
messageBox.hide();
|
||||||
|
}
|
98
examples/extra/ControlP5frame/ControlP5frame.pde
Normal file
98
examples/extra/ControlP5frame/ControlP5frame.pde
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 Controlframe
|
||||||
|
* with controlP5 2.0 all java.awt dependencies have been removed
|
||||||
|
* as a consequence the option to display controllers in a separate
|
||||||
|
* window had to be removed as well.
|
||||||
|
* this example shows you how to create a java.awt.frame and use controlP5
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.awt.Frame;
|
||||||
|
import java.awt.BorderLayout;
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
private ControlP5 cp5;
|
||||||
|
|
||||||
|
ControlFrame cf;
|
||||||
|
|
||||||
|
int def;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400, 400);
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
|
||||||
|
// by calling function addControlFrame() a
|
||||||
|
// new frame is created and an instance of class
|
||||||
|
// ControlFrame is instanziated.
|
||||||
|
cf = addControlFrame("extra", 200,200);
|
||||||
|
|
||||||
|
// add Controllers to the 'extra' Frame inside
|
||||||
|
// the ControlFrame class setup() method below.
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(def);
|
||||||
|
}
|
||||||
|
|
||||||
|
ControlFrame addControlFrame(String theName, int theWidth, int theHeight) {
|
||||||
|
Frame f = new Frame(theName);
|
||||||
|
ControlFrame p = new ControlFrame(this, theWidth, theHeight);
|
||||||
|
f.add(p);
|
||||||
|
p.init();
|
||||||
|
f.setTitle(theName);
|
||||||
|
f.setSize(p.w, p.h);
|
||||||
|
f.setLocation(100, 100);
|
||||||
|
f.setResizable(false);
|
||||||
|
f.setVisible(true);
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// the ControlFrame class extends PApplet, so we
|
||||||
|
// are creating a new processing applet inside a
|
||||||
|
// new frame with a controlP5 object loaded
|
||||||
|
public class ControlFrame extends PApplet {
|
||||||
|
|
||||||
|
int w, h;
|
||||||
|
|
||||||
|
int abc = 100;
|
||||||
|
|
||||||
|
public void setup() {
|
||||||
|
size(w, h);
|
||||||
|
frameRate(25);
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
cp5.addSlider("abc").setRange(0, 255).setPosition(10,10);
|
||||||
|
cp5.addSlider("def").plugTo(parent,"def").setRange(0, 255).setPosition(10,30);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void draw() {
|
||||||
|
background(abc);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ControlFrame() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public ControlFrame(Object theParent, int theWidth, int theHeight) {
|
||||||
|
parent = theParent;
|
||||||
|
w = theWidth;
|
||||||
|
h = theHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ControlP5 control() {
|
||||||
|
return cp5;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
Object parent;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
28
examples/extra/ControlP5frameRate/ControlP5frameRate.pde
Normal file
28
examples/extra/ControlP5frameRate/ControlP5frameRate.pde
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 FrameRate
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* uses a textlabel to display the current or average
|
||||||
|
* framerate of the sketch.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400,500);
|
||||||
|
frameRate(60);
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
cp5.addFrameRate().setInterval(10).setPosition(0,height - 10);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(129);
|
||||||
|
}
|
134
examples/extra/ControlP5frames/ControlP5frames.pde
Normal file
134
examples/extra/ControlP5frames/ControlP5frames.pde
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.*;
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
private ControlP5 cp5;
|
||||||
|
|
||||||
|
ControlFrame cf1, cf2;
|
||||||
|
|
||||||
|
int bgColor;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400, 400 ,P3D );
|
||||||
|
/* add a controlP5 instance for the main sketch window (not required for other ControlFrames to work) */
|
||||||
|
cp5 = new ControlP5( this );
|
||||||
|
cp5.addSlider( "s2" );
|
||||||
|
|
||||||
|
|
||||||
|
/* Add a controlframe */
|
||||||
|
|
||||||
|
cf1 = addControlFrame( "hello", 200, 200, 20, 20, color( 100 ) );
|
||||||
|
|
||||||
|
// add a slider with an EventListener. When dragging the slider,
|
||||||
|
// variable bgColor will change accordingly.
|
||||||
|
cf1.control().addSlider( "s1" ).setRange( 0, 255 ).addListener( new ControlListener() {
|
||||||
|
public void controlEvent( ControlEvent ev ) {
|
||||||
|
bgColor = color( ev.getValue() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/* Add a second controlframe */
|
||||||
|
|
||||||
|
cf2 = addControlFrame( "world", 200, 200, 20, 240, color( 100 ) );
|
||||||
|
|
||||||
|
// add a button with an EventListener. When releasing the button,
|
||||||
|
// variable bgColor will change to color( 255 );
|
||||||
|
cf2.control().addButton( "b1" ).addListener( new ControlListener() {
|
||||||
|
public void controlEvent( ControlEvent ev ) {
|
||||||
|
bgColor = color( 255 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
cf2.control().addButton( "b2" ).addListener( new ControlListener() {
|
||||||
|
public void controlEvent(ControlEvent ev) {
|
||||||
|
bgColor = color( random( 255 ), random( 255 ), random( 255 ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background( bgColor );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* no changes required below */
|
||||||
|
|
||||||
|
|
||||||
|
ControlFrame addControlFrame(String theName, int theWidth, int theHeight) {
|
||||||
|
return addControlFrame(theName, theWidth, theHeight, 100, 100, color( 0 ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
ControlFrame addControlFrame(String theName, int theWidth, int theHeight, int theX, int theY, int theColor ) {
|
||||||
|
final Frame f = new Frame( theName );
|
||||||
|
final ControlFrame p = new ControlFrame( this, theWidth, theHeight, theColor );
|
||||||
|
|
||||||
|
f.add( p );
|
||||||
|
p.init();
|
||||||
|
f.setTitle(theName);
|
||||||
|
f.setSize( p.w, p.h );
|
||||||
|
f.setLocation( theX, theY );
|
||||||
|
f.addWindowListener( new WindowAdapter() {
|
||||||
|
@Override
|
||||||
|
public void windowClosing(WindowEvent we) {
|
||||||
|
p.dispose();
|
||||||
|
f.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
f.setResizable( false );
|
||||||
|
f.setVisible( true );
|
||||||
|
// sleep a little bit to allow p to call setup.
|
||||||
|
// otherwise a nullpointerexception might be caused.
|
||||||
|
try {
|
||||||
|
Thread.sleep( 100 );
|
||||||
|
}
|
||||||
|
catch(Exception e) {
|
||||||
|
}
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// the ControlFrame class extends PApplet, so we
|
||||||
|
// are creating a new processing applet inside a
|
||||||
|
// new frame with a controlP5 object loaded
|
||||||
|
public class ControlFrame extends PApplet {
|
||||||
|
|
||||||
|
int w, h;
|
||||||
|
|
||||||
|
int bg;
|
||||||
|
|
||||||
|
public void setup() {
|
||||||
|
size(w, h);
|
||||||
|
frameRate(25);
|
||||||
|
cp5 = new ControlP5( this );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void draw() {
|
||||||
|
background( bg );
|
||||||
|
}
|
||||||
|
|
||||||
|
private ControlFrame() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public ControlFrame(Object theParent, int theWidth, int theHeight, int theColor) {
|
||||||
|
parent = theParent;
|
||||||
|
w = theWidth;
|
||||||
|
h = theHeight;
|
||||||
|
bg = theColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ControlP5 control() {
|
||||||
|
return this.cp5;
|
||||||
|
}
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
Object parent;
|
||||||
|
}
|
||||||
|
|
51
examples/extra/ControlP5groupCanvas/ControlP5groupCanvas.pde
Normal file
51
examples/extra/ControlP5groupCanvas/ControlP5groupCanvas.pde
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 Canvas
|
||||||
|
*
|
||||||
|
* by andreas schlegel, 2011
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400,600);
|
||||||
|
smooth();
|
||||||
|
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
cp5.addGroup("myGroup")
|
||||||
|
.setLabel("Testing Canvas")
|
||||||
|
.setPosition(100,200)
|
||||||
|
.setWidth(200)
|
||||||
|
.addCanvas(new TestCanvas())
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class TestCanvas extends Canvas {
|
||||||
|
|
||||||
|
float n;
|
||||||
|
float a;
|
||||||
|
|
||||||
|
public void setup(PGraphics pg) {
|
||||||
|
println("starting a test canvas.");
|
||||||
|
n = 1;
|
||||||
|
}
|
||||||
|
public void draw(PGraphics pg) {
|
||||||
|
n += 0.01;
|
||||||
|
pg.ellipseMode(CENTER);
|
||||||
|
pg.fill(lerpColor(color(0,100,200),color(0,200,100),map(sin(n),-1,1,0,1)));
|
||||||
|
pg.rect(0,0,200,200);
|
||||||
|
pg.fill(255,150);
|
||||||
|
a+=0.01;
|
||||||
|
ellipse(100,100,abs(sin(a)*150),abs(sin(a)*150));
|
||||||
|
ellipse(40,40,abs(sin(a+0.5)*50),abs(sin(a+0.5)*50));
|
||||||
|
ellipse(60,140,abs(cos(a)*80),abs(cos(a)*80));
|
||||||
|
}
|
||||||
|
}
|
38
examples/extra/ControlP5imageButton/ControlP5imageButton.pde
Normal file
38
examples/extra/ControlP5imageButton/ControlP5imageButton.pde
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
int myColor = color(0);
|
||||||
|
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400,600);
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
|
||||||
|
// replace the default controlP5 button with an image.
|
||||||
|
// button.setImages(defaultImage, rolloverImage, pressedImage);
|
||||||
|
// use button.updateSize() to adjust the size of the button and
|
||||||
|
// resize to the dimensions of the defaultImage
|
||||||
|
|
||||||
|
cp5.addButton("buttonA")
|
||||||
|
.setPosition(175,275)
|
||||||
|
.setImages(loadImage("Arrow-Left.png"), loadImage("Arrow-Right.png"), loadImage("Refresh.png"))
|
||||||
|
.updateSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(myColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void controlEvent(ControlEvent theEvent) {
|
||||||
|
println(theEvent.getController().getName());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// function buttonA will receive changes from
|
||||||
|
// controller with name buttonA
|
||||||
|
public void buttonA(int theValue) {
|
||||||
|
println("a button event from buttonA: "+theValue);
|
||||||
|
myColor = color(128);
|
||||||
|
}
|
||||||
|
|
BIN
examples/extra/ControlP5imageButton/data/Arrow-Left.png
Executable file
BIN
examples/extra/ControlP5imageButton/data/Arrow-Left.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
BIN
examples/extra/ControlP5imageButton/data/Arrow-Right.png
Executable file
BIN
examples/extra/ControlP5imageButton/data/Arrow-Right.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
BIN
examples/extra/ControlP5imageButton/data/Refresh.png
Executable file
BIN
examples/extra/ControlP5imageButton/data/Refresh.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
50
examples/extra/ControlP5key/ControlP5key.pde
Normal file
50
examples/extra/ControlP5key/ControlP5key.pde
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 ControlKey
|
||||||
|
* use ControlKeys to map key combinations to particular events.
|
||||||
|
* multi-keypress supported.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
int col;
|
||||||
|
int colEllipse;
|
||||||
|
boolean visible;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400, 600);
|
||||||
|
smooth();
|
||||||
|
noStroke();
|
||||||
|
col = color(0);
|
||||||
|
colEllipse = color(0,255,90);
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
|
||||||
|
// press key 1 to change background to white
|
||||||
|
cp5.mapKeyFor(new ControlKey() {public void keyEvent() {col = color(255);}}, '1');
|
||||||
|
|
||||||
|
// press key 2 to change background to black
|
||||||
|
cp5.mapKeyFor(new ControlKey() {public void keyEvent() {col = color(0);}}, '2');
|
||||||
|
|
||||||
|
// press key 1 and ALT to make circles visible
|
||||||
|
cp5.mapKeyFor(new ControlKey() {public void keyEvent() {visible = true;}}, ALT,'1');
|
||||||
|
|
||||||
|
// press key 2 and ALT to hide circles
|
||||||
|
cp5.mapKeyFor(new ControlKey() {public void keyEvent() {visible = false;}}, ALT,'2');
|
||||||
|
|
||||||
|
// press key 1 and ALT and SHIFT to change the color of circles
|
||||||
|
cp5.mapKeyFor(new ControlKey() {public void keyEvent() {colEllipse = color(random(255));}}, ALT,'1',SHIFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(col);
|
||||||
|
if(visible) {
|
||||||
|
fill(colEllipse);
|
||||||
|
ellipse(100,100,50,50);
|
||||||
|
ellipse(150,400,200,200);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,74 @@
|
|||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
String[][] s = new String[3][];
|
||||||
|
ControlP5 controlP5;
|
||||||
|
ListBox l;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400,400);
|
||||||
|
controlP5 = new ControlP5(this);
|
||||||
|
l = controlP5.addListBox("myList",100,100,120,150);
|
||||||
|
// l.actAsPulldownMenu(true);
|
||||||
|
l.setItemHeight(23);
|
||||||
|
|
||||||
|
|
||||||
|
s[0] = new String[] {
|
||||||
|
"a","b","c","d"
|
||||||
|
};
|
||||||
|
s[1] = new String[] {
|
||||||
|
"a","b","c","d","e","f","g","h","i","j","k","l","m","n"
|
||||||
|
};
|
||||||
|
s[2] = new String[] {
|
||||||
|
"l","m","n"
|
||||||
|
};
|
||||||
|
|
||||||
|
for(int i=0;i<s[1].length;i++) {
|
||||||
|
l.addItem(s[1][i],i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void keyPressed() {
|
||||||
|
|
||||||
|
switch(key) {
|
||||||
|
case('1'):
|
||||||
|
println("changing list to items of group 1");
|
||||||
|
l.clear();
|
||||||
|
for(int i=0;i<s[0].length;i++) {
|
||||||
|
// using bit shifting to store 2 values in 1 int
|
||||||
|
int n = 0;
|
||||||
|
n = n | 1 << 8;
|
||||||
|
n = n | i << 0;
|
||||||
|
l.addItem("1-"+s[0][i],n);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case('2'):
|
||||||
|
println("changing list to items of group 2");
|
||||||
|
l.clear();
|
||||||
|
for(int i=0;i<s[1].length;i++) {
|
||||||
|
// useing bit shifting to store 2 values in 1 int
|
||||||
|
int n = 0;
|
||||||
|
n = n | 2 << 8;
|
||||||
|
n = n | i << 0;
|
||||||
|
l.addItem("2-"+s[1][i],n);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void myList(int theValue) {
|
||||||
|
println("from myList "+theValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void controlEvent(ControlEvent theEvent) {
|
||||||
|
if(theEvent.isGroup()) {
|
||||||
|
print("> "+theEvent.getGroup().getValue());
|
||||||
|
int n = int(theEvent.getGroup().getValue());
|
||||||
|
println("\t\t group:"+(n >> 8 & 0xff)+", item:"+(n >> 0 & 0xff));
|
||||||
|
}
|
||||||
|
}
|
94
examples/extra/ControlP5mouseWheel/ControlP5mouseWheel.pde
Normal file
94
examples/extra/ControlP5mouseWheel/ControlP5mouseWheel.pde
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 KeyEventAndWheel
|
||||||
|
*
|
||||||
|
* with controlP5 2.0 all java.awt dependencies have been removed
|
||||||
|
* as a consequence the option to use the MouseWheel for some controllers
|
||||||
|
* has been removed. But the following example shows how to manually add
|
||||||
|
* the mouseWheel support.
|
||||||
|
*
|
||||||
|
* With early versions of the processing 2.0 beta releases the keyEvent forwarding
|
||||||
|
* does not work as expected and needs to be forwarded manually.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(700, 300);
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
|
||||||
|
|
||||||
|
cp5.addNumberbox("numberbox")
|
||||||
|
.setPosition(20, 20)
|
||||||
|
.setSize(100, 20)
|
||||||
|
;
|
||||||
|
|
||||||
|
cp5.addSlider("slider")
|
||||||
|
.setPosition(20, 70)
|
||||||
|
.setSize(200, 20)
|
||||||
|
;
|
||||||
|
|
||||||
|
cp5.addKnob("knob")
|
||||||
|
.setPosition(20, 120)
|
||||||
|
.setRadius(50)
|
||||||
|
;
|
||||||
|
|
||||||
|
List<String> drops = new ArrayList<String>();
|
||||||
|
for(int i=0;i<100;i++) {
|
||||||
|
drops.add("item "+i);
|
||||||
|
}
|
||||||
|
|
||||||
|
cp5.addDropdownList("drop")
|
||||||
|
.setPosition(300, 30)
|
||||||
|
.setWidth(200)
|
||||||
|
.addItems(drops)
|
||||||
|
;
|
||||||
|
|
||||||
|
cp5.addListBox("list")
|
||||||
|
.setPosition(520, 30)
|
||||||
|
.setSize(150,200)
|
||||||
|
.addItems(drops)
|
||||||
|
;
|
||||||
|
|
||||||
|
cp5.addTextarea("area")
|
||||||
|
.setPosition(300, 150)
|
||||||
|
.setSize(200,100)
|
||||||
|
.setLineHeight(10)
|
||||||
|
.setText("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam feugiat porttitor tempus. Donec hendrerit aliquam mauris, a interdum ante pellentesque et. In dui erat, condimentum et sodales eget, scelerisque quis libero. Nam non nibh vitae enim auctor fringilla sit amet quis magna. Quisque ultricies mi at arcu vulputate imperdiet tristique purus adipiscing. Maecenas pretium odio ac leo aliquam id commodo nulla eleifend. Aenean in pharetra mauris. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla suscipit, nisl vitae eleifend tincidunt, dolor justo sollicitudin nunc, sit amet rhoncus odio purus eu purus. Cras bibendum placerat elementum. Donec in lorem libero. Praesent auctor, felis quis volutpat facilisis, neque turpis tempor nisi, interdum viverra enim purus vel mi. Nam faucibus accumsan lorem, convallis consectetur elit vulputate ut.");
|
||||||
|
;
|
||||||
|
// add mousewheel support, now hover the slide with your mouse
|
||||||
|
// and use the mousewheel (or trackpad on a macbook) to change the
|
||||||
|
// value of the slider.
|
||||||
|
addMouseWheelListener();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void controlEvent(ControlEvent event) {
|
||||||
|
println(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
// When working in desktop mode, you can add mousewheel support for
|
||||||
|
// controlP5 by using java.awt.event.MouseWheelListener and
|
||||||
|
// java.awt.event.MouseWheelEvent
|
||||||
|
|
||||||
|
void addMouseWheelListener() {
|
||||||
|
frame.addMouseWheelListener(new java.awt.event.MouseWheelListener() {
|
||||||
|
public void mouseWheelMoved(java.awt.event.MouseWheelEvent e) {
|
||||||
|
cp5.setMouseWheelRotation(e.getWheelRotation());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
57
examples/extra/ControlP5pointer/ControlP5pointer.pde
Normal file
57
examples/extra/ControlP5pointer/ControlP5pointer.pde
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 Pointer
|
||||||
|
*
|
||||||
|
* Default mouse actions use the Pointer class to trigger events.
|
||||||
|
* you can manipulate the x and y fields of the Pointer class
|
||||||
|
* for customizing input events for example when using a
|
||||||
|
* different input than the mouse.
|
||||||
|
* Here in this example the mouse coordiates are reveresed.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400, 600);
|
||||||
|
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
// disable outodraw because we want to draw our
|
||||||
|
// custom cursor on to of controlP5
|
||||||
|
cp5.setAutoDraw(false);
|
||||||
|
|
||||||
|
cp5.addSlider("hello", 0, 100, 50, 40, 40, 100, 20);
|
||||||
|
|
||||||
|
// enable the pointer (and disable the mouse as input)
|
||||||
|
cp5.getPointer().enable();
|
||||||
|
cp5.getPointer().set(width/2, height/2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(cp5.get("hello").getValue());
|
||||||
|
// first draw controlP5
|
||||||
|
cp5.draw();
|
||||||
|
|
||||||
|
// the draw our pointer
|
||||||
|
cp5.getPointer().set(width - mouseX, height - mouseY);
|
||||||
|
pushMatrix();
|
||||||
|
translate(cp5.getPointer().getX(), cp5.getPointer().getY());
|
||||||
|
stroke(255);
|
||||||
|
line(-10,0,10,0);
|
||||||
|
line(0,-10,0,10);
|
||||||
|
popMatrix();
|
||||||
|
println(cp5.isMouseOver());
|
||||||
|
}
|
||||||
|
|
||||||
|
void mousePressed() {
|
||||||
|
cp5.getPointer().pressed();
|
||||||
|
}
|
||||||
|
|
||||||
|
void mouseReleased() {
|
||||||
|
cp5.getPointer().released();
|
||||||
|
}
|
@ -0,0 +1,134 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 properties sets.
|
||||||
|
*
|
||||||
|
* saves/loads controller values into/from properties-file.
|
||||||
|
* this example shows how to make property sets of controllers that can be loaded and
|
||||||
|
* saved individually. By default property files come in a serialized format
|
||||||
|
* with a .ser extension.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* default properties load/save key combinations are
|
||||||
|
* alt+shift+l to load properties
|
||||||
|
* alt+shift+s to save properties
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* find a list of public methods available for the ControllerPropererties Controller
|
||||||
|
* at the bottom of this sketch's source code
|
||||||
|
*
|
||||||
|
* by andreas schlegel, 2011
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
public int slider1 = 32;
|
||||||
|
public int slider2 = 64;
|
||||||
|
public int slider3 = 128;
|
||||||
|
public int slider4 = 255;
|
||||||
|
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400, 600);
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
|
||||||
|
// add a vertical slider
|
||||||
|
cp5.addSlider("slider1", 0, 255, 20, 100, 128, 20);
|
||||||
|
cp5.addSlider("slider2", 0, 255, 20, 150, 128, 20);
|
||||||
|
cp5.addSlider("slider3", 0, 255, 20, 200, 128, 20);
|
||||||
|
cp5.addSlider("slider4", 0, 255, 20, 250, 128, 20);
|
||||||
|
|
||||||
|
cp5.addButton("b1", 0, 20, 350, 80, 12).setCaptionLabel("save setA");
|
||||||
|
cp5.addButton("b2", 0, 101, 350, 80, 12).setCaptionLabel("load setA").setColorBackground(color(0, 100, 50));
|
||||||
|
|
||||||
|
cp5.addButton("b3", 0, 200, 350, 80, 12).setCaptionLabel("save default");
|
||||||
|
cp5.addButton("b4", 0, 281, 350, 80, 12).setCaptionLabel("load default").setColorBackground(color(0, 100, 50));
|
||||||
|
|
||||||
|
|
||||||
|
// add a new properties set 'setA'
|
||||||
|
cp5.getProperties().addSet("setA");
|
||||||
|
|
||||||
|
// move controller 'slider' from the default set to setA
|
||||||
|
// the 3 parameters read like this: move controller(1) from set(2) to set(3)
|
||||||
|
cp5.getProperties().move(cp5.getController("slider1"), "default", "setA");
|
||||||
|
// use copy instead of move to register 'slider' with both sets (default and setA)
|
||||||
|
|
||||||
|
// prints the current list of properties registered and the set(s) they belong to
|
||||||
|
cp5.getProperties().print();
|
||||||
|
|
||||||
|
/* by default properties are saved in JSON format, if you want to change to the old default (java's serialized format), un-comment line below*/
|
||||||
|
// cp5.getProperties().setFormat(ControlP5.SERIALIZED);
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(0);
|
||||||
|
|
||||||
|
fill(slider1);
|
||||||
|
rect(250, 100, 100, 20);
|
||||||
|
|
||||||
|
fill(slider2);
|
||||||
|
rect(250, 150, 100, 20);
|
||||||
|
|
||||||
|
fill(slider3);
|
||||||
|
rect(250, 200, 100, 20);
|
||||||
|
|
||||||
|
fill(slider4);
|
||||||
|
rect(250, 250, 100, 20);
|
||||||
|
}
|
||||||
|
|
||||||
|
void b1(float v) {
|
||||||
|
cp5.saveProperties("setA", "setA");
|
||||||
|
}
|
||||||
|
|
||||||
|
void b2(float v) {
|
||||||
|
cp5.loadProperties(("setA"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void b3(float v) {
|
||||||
|
cp5.saveProperties("default", "default");
|
||||||
|
}
|
||||||
|
|
||||||
|
void b4(float v) {
|
||||||
|
cp5.loadProperties(("default.json"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
a list of all methods available for the ControllerProperties class
|
||||||
|
use ControlP5.printPublicMethodsFor(ControllerProperties.class);
|
||||||
|
to print the following list into the console.
|
||||||
|
|
||||||
|
You can find further details about class ControllerProperties in the javadoc.
|
||||||
|
|
||||||
|
Format:
|
||||||
|
ClassName : returnType methodName(parameter type)
|
||||||
|
|
||||||
|
controlP5.ControllerProperties : ControllerProperties remove(ControllerInterface)
|
||||||
|
controlP5.ControllerProperties : ControllerProperties remove(ControllerInterface, String)
|
||||||
|
controlP5.ControllerProperties : ControllerProperties remove(ControllerInterface, String, String)
|
||||||
|
controlP5.ControllerProperties : ControllerProperty getProperty(ControllerInterface, String)
|
||||||
|
controlP5.ControllerProperties : ControllerProperty getProperty(ControllerInterface, String, String)
|
||||||
|
controlP5.ControllerProperties : ControllerProperty register(ControllerInterface, String)
|
||||||
|
controlP5.ControllerProperties : ControllerProperty register(ControllerInterface, String, String)
|
||||||
|
controlP5.ControllerProperties : HashSet addSet(String)
|
||||||
|
controlP5.ControllerProperties : HashSet getPropertySet(ControllerInterface)
|
||||||
|
controlP5.ControllerProperties : List get(ControllerInterface)
|
||||||
|
controlP5.ControllerProperties : Map get()
|
||||||
|
controlP5.ControllerProperties : String toString()
|
||||||
|
controlP5.ControllerProperties : boolean load()
|
||||||
|
controlP5.ControllerProperties : boolean load(String)
|
||||||
|
controlP5.ControllerProperties : void delete(ControllerProperty)
|
||||||
|
controlP5.ControllerProperties : void move(ControllerInterface, String, String)
|
||||||
|
controlP5.ControllerProperties : void move(ControllerProperty, String, String)
|
||||||
|
controlP5.ControllerProperties : void only(ControllerProperty, String)
|
||||||
|
controlP5.ControllerProperties : void print()
|
||||||
|
controlP5.ControllerProperties : void setFormat(Format)
|
||||||
|
java.lang.Object : String toString()
|
||||||
|
java.lang.Object : boolean equals(Object)
|
||||||
|
*/
|
17
examples/extra/ControlP5propertiesSets/default.json
Normal file
17
examples/extra/ControlP5propertiesSets/default.json
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"/slider3": {
|
||||||
|
"min": 0,
|
||||||
|
"max": 255,
|
||||||
|
"value": 0
|
||||||
|
},
|
||||||
|
"/slider2": {
|
||||||
|
"min": 0,
|
||||||
|
"max": 255,
|
||||||
|
"value": 0
|
||||||
|
},
|
||||||
|
"/slider4": {
|
||||||
|
"min": 0,
|
||||||
|
"max": 255,
|
||||||
|
"value": 0
|
||||||
|
}
|
||||||
|
}
|
5
examples/extra/ControlP5propertiesSets/setA.json
Normal file
5
examples/extra/ControlP5propertiesSets/setA.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{"/slider1": {
|
||||||
|
"min": 0,
|
||||||
|
"max": 255,
|
||||||
|
"value": 255
|
||||||
|
}}
|
@ -0,0 +1,51 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 RenderIntoPGraphics
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* experimental
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2013
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 c1 , c2;
|
||||||
|
PGraphics panel1 , panel2;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size( 1024, 500 , P3D ); //
|
||||||
|
panel1 = createGraphics( 200 , height/2 );
|
||||||
|
panel2 = createGraphics( 200 , height/2 );
|
||||||
|
c1 = new ControlP5( this );
|
||||||
|
c1.enableShortcuts();
|
||||||
|
c1.setBackground( color( 0 , 50 ) );
|
||||||
|
c1.addButton("hello").setSize(200,20).setPosition( 0 , 0 );
|
||||||
|
c1.addButton("world").setSize(200,100).setPosition( 0 , 70 );
|
||||||
|
c1.addSlider("slider").setSize(50,20).setPosition( 0 , 40 );
|
||||||
|
c1.setGraphics( panel1 , 0 , 0 );
|
||||||
|
|
||||||
|
c2 = new ControlP5( this );
|
||||||
|
c2.enableShortcuts();
|
||||||
|
c2.setBackground( color( 0 , 50 ) );
|
||||||
|
c2.addButton("hello").setSize(200,20).setPosition( 0 , 0 );
|
||||||
|
c2.addButton("world").setSize(200,100).setPosition( 0 , 70 );
|
||||||
|
c2.addSlider("slider").setSize(50,20).setPosition( 0 , 40 );
|
||||||
|
c2.setGraphics( panel2 , 220 , 0 );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background( 100 , 0 , 0 );
|
||||||
|
|
||||||
|
/* TODO update mouseevent when using setGraphics */
|
||||||
|
c1.setGraphics( panel1 , 100 + int(sin(frameCount*0.1) * 100) , 250 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void controlEvent( ControlEvent ce) {
|
||||||
|
println(ce);
|
||||||
|
}
|
110
examples/extra/ControlP5style/ControlP5style.pde
Normal file
110
examples/extra/ControlP5style/ControlP5style.pde
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 ControllerStyle
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* find a list of public methods available for the ControllerStyle Controller
|
||||||
|
* at the bottom of this sketch.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2011
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
float v1 = 50, v2 = 100, v3 = 100, v4 = 100;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400,600);
|
||||||
|
smooth();
|
||||||
|
noStroke();
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
|
||||||
|
cp5.begin(100,100);
|
||||||
|
cp5.addSlider("v1",0,255).linebreak();
|
||||||
|
cp5.addSlider("v2",0,200).linebreak();
|
||||||
|
cp5.addSlider("v3",0,300).linebreak();
|
||||||
|
cp5.addSlider("v4",0,400);
|
||||||
|
cp5.end();
|
||||||
|
|
||||||
|
// change the caption label for controller v1 and apply styles
|
||||||
|
cp5.getController("v1").setCaptionLabel("Background");
|
||||||
|
style("v1");
|
||||||
|
|
||||||
|
// change the caption label for controller v2 and apply styles
|
||||||
|
cp5.getController("v2").setCaptionLabel("Ellipse A");
|
||||||
|
style("v2");
|
||||||
|
|
||||||
|
// change the caption label for controller v3 and apply styles
|
||||||
|
cp5.getController("v3").setCaptionLabel("Ellipse B");
|
||||||
|
style("v3");
|
||||||
|
|
||||||
|
// change the caption label for controller v3 and apply styles
|
||||||
|
cp5.getController("v4").setCaptionLabel("Ellipse C");
|
||||||
|
style("v4");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void style(String theControllerName) {
|
||||||
|
Controller c = cp5.getController(theControllerName);
|
||||||
|
// adjust the height of the controller
|
||||||
|
c.setHeight(15);
|
||||||
|
|
||||||
|
// add some padding to the caption label background
|
||||||
|
c.getCaptionLabel().getStyle().setPadding(4,4,3,4);
|
||||||
|
|
||||||
|
// shift the caption label up by 4px
|
||||||
|
c.getCaptionLabel().getStyle().setMargin(-4,0,0,0);
|
||||||
|
|
||||||
|
// set the background color of the caption label
|
||||||
|
c.getCaptionLabel().setColorBackground(color(10,20,30,140));
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(v1);
|
||||||
|
fill(255,255,220,100);
|
||||||
|
ellipse(width/2-100, height/2-100,v2 + 50,v2 + 50);
|
||||||
|
ellipse(width/2+100, height/2,v3,v3);
|
||||||
|
ellipse(width/2, height/2+100,v4,v4);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
a list of all methods available for the ControllerStyle Controller
|
||||||
|
use ControlP5.printPublicMethodsFor(ControllerStyle.class);
|
||||||
|
to print the following list into the console.
|
||||||
|
|
||||||
|
You can find further details about class ControllerStyle in the javadoc.
|
||||||
|
|
||||||
|
Format:
|
||||||
|
ClassName : returnType methodName(parameter type)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
controlP5.ControllerStyle : ControllerStyle margin(int)
|
||||||
|
controlP5.ControllerStyle : ControllerStyle margin(int, int, int, int)
|
||||||
|
controlP5.ControllerStyle : ControllerStyle moveMargin(int, int, int, int)
|
||||||
|
controlP5.ControllerStyle : ControllerStyle movePadding(int, int, int, int)
|
||||||
|
controlP5.ControllerStyle : ControllerStyle padding(int)
|
||||||
|
controlP5.ControllerStyle : ControllerStyle padding(int, int, int, int)
|
||||||
|
controlP5.ControllerStyle : ControllerStyle setMargin(int, int, int, int)
|
||||||
|
controlP5.ControllerStyle : ControllerStyle setMarginBottom(int)
|
||||||
|
controlP5.ControllerStyle : ControllerStyle setMarginLeft(int)
|
||||||
|
controlP5.ControllerStyle : ControllerStyle setMarginRight(int)
|
||||||
|
controlP5.ControllerStyle : ControllerStyle setMarginTop(int)
|
||||||
|
controlP5.ControllerStyle : ControllerStyle setPadding(int, int, int, int)
|
||||||
|
controlP5.ControllerStyle : ControllerStyle setPaddingBottom(int)
|
||||||
|
controlP5.ControllerStyle : ControllerStyle setPaddingLeft(int)
|
||||||
|
controlP5.ControllerStyle : ControllerStyle setPaddingRight(int)
|
||||||
|
controlP5.ControllerStyle : ControllerStyle setPaddingTop(int)
|
||||||
|
java.lang.Object : String toString()
|
||||||
|
java.lang.Object : boolean equals(Object)
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,114 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 textfield (advanced)
|
||||||
|
*
|
||||||
|
* demonstrates how to use keepFocus, setText, getText, getTextList,
|
||||||
|
* clear, setAutoClear, isAutoClear and submit.
|
||||||
|
*
|
||||||
|
* by andreas schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
String textValue = "";
|
||||||
|
|
||||||
|
Textfield myTextfield;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400, 600);
|
||||||
|
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
myTextfield = cp5.addTextfield("textinput")
|
||||||
|
.setPosition(100, 200)
|
||||||
|
.setSize(200, 20)
|
||||||
|
.setFocus(true)
|
||||||
|
;
|
||||||
|
|
||||||
|
cp5.addTextfield("textValue")
|
||||||
|
.setPosition(100, 300)
|
||||||
|
.setSize(200, 20)
|
||||||
|
;
|
||||||
|
|
||||||
|
// use setAutoClear(true/false) to clear a textfield or keep text displayed in
|
||||||
|
// a textfield after pressing return.
|
||||||
|
myTextfield.setAutoClear(true).keepFocus(true);
|
||||||
|
|
||||||
|
cp5.addButton("clear", 0, 20, 200, 70, 20);
|
||||||
|
cp5.addButton("submit", 0, 310, 200, 60, 20);
|
||||||
|
cp5.addButton("performTextfieldActions", 0, 20, 100, 150, 20);
|
||||||
|
cp5.addToggle("toggleAutoClear", true, 180, 100, 90, 20).setCaptionLabel("Auto Clear");
|
||||||
|
cp5.addToggle("toggleKeepFocus", true, 280, 100, 90, 20).setCaptionLabel("Keep Focus");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void toggleAutoClear(boolean theFlag) {
|
||||||
|
myTextfield.setAutoClear(theFlag);
|
||||||
|
}
|
||||||
|
|
||||||
|
void toggleKeepFocus(boolean theFlag) {
|
||||||
|
myTextfield.keepFocus(theFlag);
|
||||||
|
}
|
||||||
|
|
||||||
|
void clear(int theValue) {
|
||||||
|
myTextfield.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void submit(int theValue) {
|
||||||
|
myTextfield.submit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void controlEvent(ControlEvent theEvent) {
|
||||||
|
if (theEvent.isAssignableFrom(Textfield.class)) {
|
||||||
|
Textfield t = (Textfield)theEvent.getController();
|
||||||
|
|
||||||
|
println("controlEvent: accessing a string from controller '"
|
||||||
|
+t.getName()+"': "+t.getStringValue()
|
||||||
|
);
|
||||||
|
|
||||||
|
// Textfield.isAutoClear() must be true
|
||||||
|
print("controlEvent: trying to setText, ");
|
||||||
|
|
||||||
|
t.setText("controlEvent: changing text.");
|
||||||
|
if (t.isAutoClear()==false) {
|
||||||
|
println(" success!");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
println(" but Textfield.isAutoClear() is false, could not setText here.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void performTextfieldActions() {
|
||||||
|
println("\n");
|
||||||
|
// Textfield.getText();
|
||||||
|
println("the current text of myTextfield: "+myTextfield.getText());
|
||||||
|
println("the current value of textValue: "+textValue);
|
||||||
|
// Textfield.setText();
|
||||||
|
myTextfield.setText("changed the text of a textfield");
|
||||||
|
println("changing text of myTextfield to: "+myTextfield.getText());
|
||||||
|
// Textfield.getTextList();
|
||||||
|
println("the textlist of myTextfield has "+myTextfield.getTextList().length+" items.");
|
||||||
|
for (int i=0;i<myTextfield.getTextList().length;i++) {
|
||||||
|
println("\t"+myTextfield.getTextList()[i]);
|
||||||
|
}
|
||||||
|
println("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void textinput(String theText) {
|
||||||
|
// receiving text from controller textinput
|
||||||
|
println("a textfield event for controller 'textinput': "+theText);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,58 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 with PeasyCam support. tested with peasy 0.8.2
|
||||||
|
*
|
||||||
|
* by jeffg 2011
|
||||||
|
*/
|
||||||
|
|
||||||
|
import peasy.*;
|
||||||
|
import controlP5.*;
|
||||||
|
import processing.opengl.*;
|
||||||
|
|
||||||
|
PeasyCam cam;
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
int buttonValue = 1;
|
||||||
|
|
||||||
|
int myColor = color(255, 0, 0);
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400, 400, OPENGL);
|
||||||
|
cam = new PeasyCam(this, 100);
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
cp5.addButton("button", 10, 100, 60, 80, 20).setId(1);
|
||||||
|
cp5.addButton("buttonValue", 4, 100, 90, 80, 20).setId(2);
|
||||||
|
cp5.setAutoDraw(false);
|
||||||
|
}
|
||||||
|
void draw() {
|
||||||
|
|
||||||
|
background(0);
|
||||||
|
fill(myColor);
|
||||||
|
box(30);
|
||||||
|
pushMatrix();
|
||||||
|
translate(0, 0, 20);
|
||||||
|
fill(0, 0, 255);
|
||||||
|
box(5);
|
||||||
|
popMatrix();
|
||||||
|
// makes the gui stay on top of elements
|
||||||
|
// drawn before.
|
||||||
|
|
||||||
|
gui();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void gui() {
|
||||||
|
hint(DISABLE_DEPTH_TEST);
|
||||||
|
cam.beginHUD();
|
||||||
|
cp5.draw();
|
||||||
|
cam.endHUD();
|
||||||
|
hint(ENABLE_DEPTH_TEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
void controlEvent(ControlEvent theEvent) {
|
||||||
|
println(theEvent.getController().getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
void button(float theValue) {
|
||||||
|
myColor = color(random(255), random(255), random(255));
|
||||||
|
println("a button event. "+theValue);
|
||||||
|
}
|
166
examples/use/ControlP5annotation/ControlP5annotation.pde
Normal file
166
examples/use/ControlP5annotation/ControlP5annotation.pde
Normal file
@ -0,0 +1,166 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 Annotation
|
||||||
|
*
|
||||||
|
* Lately annotation support has been added to processing.
|
||||||
|
* Making use of annotations to create controllers is a great strategy i learned
|
||||||
|
* from Karsten Schmidt's (toxi) cp5magic library.
|
||||||
|
* Loving the simplicity of annotations and how it is aplied with cp5magic,
|
||||||
|
* i had to include it into controlp5 and the following example
|
||||||
|
* shows how to use annotations with controlp5.
|
||||||
|
*
|
||||||
|
* Annotations can be applied to variables and functions of the main program
|
||||||
|
* as well as individual classes. More details are included in the comments below.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
TestControl tc1, tc2;
|
||||||
|
|
||||||
|
Tab extraTab;
|
||||||
|
|
||||||
|
// create controllers using the ControlElement annotation
|
||||||
|
// by default a slider is created for int and float
|
||||||
|
// values will range from 0-100 by default
|
||||||
|
// default attributes are x,y and label
|
||||||
|
@ControlElement (x=10, y=80)
|
||||||
|
int n = 20;
|
||||||
|
|
||||||
|
// to customize a controller with a CoontrolElement use the
|
||||||
|
// properties attribute. values passed using properties have a key and a value
|
||||||
|
// here the key corresponds with a function found within a controller which
|
||||||
|
// starts with set followed by the name of the key. the value is then applied accordingly.
|
||||||
|
// e.g. min=10 will translate to controller.setMin(10)
|
||||||
|
@ControlElement (properties = { "min=0", "max=255", "type=numberbox", "height=10", "width=50"} , x=10, y=40, label="Change Background")
|
||||||
|
float m = 40;
|
||||||
|
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(600, 400);
|
||||||
|
noStroke();
|
||||||
|
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
|
||||||
|
// Annotations:
|
||||||
|
// addControllersFor(PApplet) checks the main sketch for
|
||||||
|
// annotations and adds controllers accordingly.
|
||||||
|
cp5.addControllersFor(this);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
extraTab = cp5.addTab("extra");
|
||||||
|
|
||||||
|
// create an instance of class testControl
|
||||||
|
tc1 = new TestControl();
|
||||||
|
|
||||||
|
// addControllersFor cycles throught object tc1
|
||||||
|
// and assigns controllers according to available annotations.
|
||||||
|
// an address will be assigned to these controllers, in the example
|
||||||
|
// below the address is /world and the individual controllers can be
|
||||||
|
// accessed adding a / and the controller's name
|
||||||
|
// e.g. variable x
|
||||||
|
// /world/x
|
||||||
|
cp5.addControllersFor("world", tc1);
|
||||||
|
|
||||||
|
// set the Position of controllers contained within object tc1
|
||||||
|
cp5.setPosition(10, 150, tc1);
|
||||||
|
|
||||||
|
|
||||||
|
// a more advanced example of using functions with ControllerObjects
|
||||||
|
tc2 = new TestControl();
|
||||||
|
CColor col = new CColor();
|
||||||
|
col.setActive(color(0, 200, 100));
|
||||||
|
|
||||||
|
cp5.addControllersFor("hello", tc2)
|
||||||
|
.setPosition(200, 150, tc2)
|
||||||
|
.moveTo(extraTab, tc2)
|
||||||
|
.setColor(col, tc2);
|
||||||
|
|
||||||
|
cp5.getController("s", tc2)
|
||||||
|
.setStringValue("Second Control");
|
||||||
|
|
||||||
|
// with listening turned on, a controller can listen to changes made to its connected variable
|
||||||
|
// here the controller will listen to variable x of object tc2
|
||||||
|
cp5.getController("x", tc2).listen(true);
|
||||||
|
|
||||||
|
|
||||||
|
// (uncomment line below) print the a map of all available controller addresses
|
||||||
|
// cp5.printControllerMap();
|
||||||
|
|
||||||
|
// (uncomment line below) access a controller via its address:
|
||||||
|
// println(cp5.getController("/world/x").getInfo());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(m);
|
||||||
|
|
||||||
|
pushMatrix();
|
||||||
|
if (tc1.b) {
|
||||||
|
fill(tc1.x);
|
||||||
|
translate(10, tc1.y);
|
||||||
|
rect(0, 300, 100, 20);
|
||||||
|
}
|
||||||
|
popMatrix();
|
||||||
|
fill(255);
|
||||||
|
text(tc1.in,400,100,150,300);
|
||||||
|
|
||||||
|
|
||||||
|
pushMatrix();
|
||||||
|
if (tc2.b) {
|
||||||
|
fill(tc2.x);
|
||||||
|
translate(200, tc2.y);
|
||||||
|
for (int i=0;i<1;i++) {
|
||||||
|
rect(0, 300, 100, 20);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
popMatrix();
|
||||||
|
fill(255);
|
||||||
|
text(tc2.in,400,300,150,300);
|
||||||
|
|
||||||
|
// the variable x of object tt is controlled by the main program,
|
||||||
|
// the matching controller will update accordingly since it is
|
||||||
|
// listening for changes.
|
||||||
|
tc2.x = (int)random(100);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class TestControl {
|
||||||
|
|
||||||
|
@ControlElement (properties = { "min=0", "max=255" }, x=0, y=0, label="Brightness")
|
||||||
|
public int x = 100;
|
||||||
|
|
||||||
|
@ControlElement (x=0, y=14, label="Y-Position")
|
||||||
|
public float y = 0;
|
||||||
|
|
||||||
|
@ControlElement (x=0, y=40, label="show")
|
||||||
|
public boolean b = true;
|
||||||
|
|
||||||
|
@ControlElement (x=50, y=40)
|
||||||
|
public void toggle(boolean b) {
|
||||||
|
println("hello world");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ControlElement (x=0, y=-20, label="Control", properties = { "type=textlabel"})
|
||||||
|
String s;
|
||||||
|
|
||||||
|
@ControlElement (x=0, y=100, label="Type here")
|
||||||
|
String in = "";
|
||||||
|
|
||||||
|
@ControlElement (x=200, y=25, properties = {"type=list", "items=hello, world, how are you"}, label="Sample-list")
|
||||||
|
public void a(int val) {
|
||||||
|
println(val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
92
examples/use/ControlP5basics/ControlP5basics.pde
Normal file
92
examples/use/ControlP5basics/ControlP5basics.pde
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 Basics
|
||||||
|
*
|
||||||
|
* The following example demonstrates the basic use of controlP5.<br />
|
||||||
|
* After initializing controlP5 you can add controllers to controlP5.
|
||||||
|
* Here we use three numberboxes, one slider and one textfield.
|
||||||
|
* The numberbox with name numberboxC will trigger function numberboxC()
|
||||||
|
* in the example below. Whenever controlP5 detects a function in your
|
||||||
|
* sketch that corresponds to the name of a controller, it will forward
|
||||||
|
* an event to that function. Any event triggered by a controller
|
||||||
|
* will be forwarded to function controlEvent in your sketch.
|
||||||
|
* related examples ControlP5numberbox, ControlP5slider, ControlP5textfield
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2011
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
public int myColorRect = 200;
|
||||||
|
public int myColorBackground = 100;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400, 400);
|
||||||
|
noStroke();
|
||||||
|
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
|
||||||
|
// create a slider
|
||||||
|
// parameters:
|
||||||
|
// name, minValue, maxValue, defaultValue, x, y, width, height
|
||||||
|
cp5.addSlider("sliderA", 100, 200, 100, 100, 260, 100, 14);
|
||||||
|
|
||||||
|
|
||||||
|
// create 3 numberboxes and assign an id for each
|
||||||
|
cp5.addNumberbox("numberboxA", myColorRect, 100, 140, 100, 14).setId(1);
|
||||||
|
cp5.addNumberbox("numberboxB", myColorBackground, 100, 180, 100, 14).setId(2);
|
||||||
|
cp5.addNumberbox("numberboxC", 0, 100, 220, 100, 14).setId(3);
|
||||||
|
|
||||||
|
|
||||||
|
// create a texfield
|
||||||
|
cp5.addTextfield("textA", 100, 290, 100, 20);
|
||||||
|
|
||||||
|
// change individual settings for a controller
|
||||||
|
cp5.getController("numberboxA").setMax(255);
|
||||||
|
cp5.getController("numberboxA").setMin(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(myColorBackground);
|
||||||
|
fill(myColorRect);
|
||||||
|
rect(0, 0, width, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// events from controller numberboxC are received here
|
||||||
|
public void numberboxC(int theValue) {
|
||||||
|
println("### got an event from numberboxC : "+theValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// an event from slider sliderA will change the value of textfield textA here
|
||||||
|
public void sliderA(int theValue) {
|
||||||
|
Textfield txt = ((Textfield)cp5.getController("textA"));
|
||||||
|
txt.setValue(""+theValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// for every change (a textfield event confirmed with a return) in textfield textA,
|
||||||
|
// function textA will be invoked
|
||||||
|
public void textA(String theValue) {
|
||||||
|
println("### got an event from textA : "+theValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// function controlEvent will be invoked with every value change
|
||||||
|
// in any registered controller
|
||||||
|
public void controlEvent(ControlEvent theEvent) {
|
||||||
|
println("got a control event from controller with id "+theEvent.getId());
|
||||||
|
switch(theEvent.getId()) {
|
||||||
|
case(1): // numberboxA is registered with id 1
|
||||||
|
myColorRect = (int)(theEvent.getController().getValue());
|
||||||
|
break;
|
||||||
|
case(2): // numberboxB is registered with id 2
|
||||||
|
myColorBackground = (int)(theEvent.getController().getValue());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
1
examples/use/ControlP5beginEnd/ControlP5beginEnd.pde
Normal file
1
examples/use/ControlP5beginEnd/ControlP5beginEnd.pde
Normal file
@ -0,0 +1 @@
|
|||||||
|
// TBD
|
125
examples/use/ControlP5behavior/ControlP5behavior.pde
Normal file
125
examples/use/ControlP5behavior/ControlP5behavior.pde
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 Behavior
|
||||||
|
* ControlBehavior is an abstract class that can be extended using your
|
||||||
|
* custom control behaviors. What is a control behavior? Control Behaviors
|
||||||
|
* allow you to automate and dynamically change the state or value of a
|
||||||
|
* controller. One behavior per controller is currently supported. i case you
|
||||||
|
* need to use more that one bahavior, the implementation has to happen
|
||||||
|
* on your side - inside your control behavior.
|
||||||
|
*
|
||||||
|
* find a list of public methods available for the ControlBehavior Controller
|
||||||
|
* at the bottom of this sketch.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
int myColorBackground = color(0, 0, 0);
|
||||||
|
|
||||||
|
public int sliderValue = 100;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400, 400);
|
||||||
|
noStroke();
|
||||||
|
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
cp5.addSlider("sliderValue")
|
||||||
|
.setRange(0,255)
|
||||||
|
.setValue(128)
|
||||||
|
.setPosition(100, 50 + height/2)
|
||||||
|
.setSize(40, 100);
|
||||||
|
|
||||||
|
cp5.addSlider("slider")
|
||||||
|
.setRange(100, 255)
|
||||||
|
.setValue(128)
|
||||||
|
.setPosition(100, 50)
|
||||||
|
.setSize(100, 40);
|
||||||
|
|
||||||
|
|
||||||
|
cp5.addBang("bang")
|
||||||
|
.setPosition(40, 50 + height/2)
|
||||||
|
.setSize(40, 40);
|
||||||
|
|
||||||
|
// add a custom ControlBehavior to controller bang,
|
||||||
|
// class TimerEvent is included in this sketch at the bottom
|
||||||
|
// and extends abstract class ControlBehavior.
|
||||||
|
cp5.getController("bang").setBehavior(new TimedEvent());
|
||||||
|
|
||||||
|
// use an anonymous class of type ControlBehavior.
|
||||||
|
cp5.getController("slider").setBehavior(new ControlBehavior() {
|
||||||
|
float a = 0;
|
||||||
|
public void update() {
|
||||||
|
setValue(sin(a += 0.1) * 50 + 150);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(myColorBackground);
|
||||||
|
fill(sliderValue);
|
||||||
|
rect(0, 0, width, height/2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void slider(float theColor) {
|
||||||
|
myColorBackground = color(theColor);
|
||||||
|
println("# a slider event. setting background to "+theColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void bang() {
|
||||||
|
println("# an event received from controller bang.");
|
||||||
|
// a bang will set the value of controller sliderValue
|
||||||
|
// to a random number between 0 and 255.
|
||||||
|
cp5.getController("sliderValue").setValue(random(0, 255));
|
||||||
|
}
|
||||||
|
|
||||||
|
// custom ControlBehavior
|
||||||
|
class TimedEvent extends ControlBehavior {
|
||||||
|
long myTime;
|
||||||
|
int interval = 200;
|
||||||
|
|
||||||
|
public TimedEvent() {
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
void reset() {
|
||||||
|
myTime = millis() + interval;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update() {
|
||||||
|
if (millis()>myTime) {
|
||||||
|
setValue(1);
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
a list of all methods available for the ControlBehavior Controller
|
||||||
|
use ControlP5.printPublicMethodsFor(ControlBehavior.class);
|
||||||
|
to print the following list into the console.
|
||||||
|
|
||||||
|
You can find further details about class ControlBehavior in the javadoc.
|
||||||
|
|
||||||
|
Format:
|
||||||
|
ClassName : returnType methodName(parameter type)
|
||||||
|
|
||||||
|
|
||||||
|
controlP5.ControlBehavior : Controller controller()
|
||||||
|
controlP5.ControlBehavior : boolean isActive()
|
||||||
|
controlP5.ControlBehavior : void setActive(boolean)
|
||||||
|
controlP5.ControlBehavior : void setValue(float)
|
||||||
|
java.lang.Object : String toString()
|
||||||
|
java.lang.Object : boolean equals(Object)
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
191
examples/use/ControlP5callback/ControlP5callback.pde
Normal file
191
examples/use/ControlP5callback/ControlP5callback.pde
Normal file
@ -0,0 +1,191 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 Callback
|
||||||
|
*
|
||||||
|
* The following example demonstrates the CallbackListener and CallbackEvent.
|
||||||
|
* Here additional information about each available slider will be show when
|
||||||
|
* hovering the controller with the mouse. The info will fade out when leaving
|
||||||
|
* the controller.
|
||||||
|
*
|
||||||
|
* When hovering a controller, the mouse pointer will change as well.
|
||||||
|
*
|
||||||
|
* find a list of public methods available for the CallbackEvent Controller
|
||||||
|
* at the bottom of this sketch.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
Slider s1, s2;
|
||||||
|
Info info;
|
||||||
|
CallbackListener cb;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(800, 400);
|
||||||
|
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
|
||||||
|
|
||||||
|
// create a new instance of class Info
|
||||||
|
// info will be used to display a controller's information and
|
||||||
|
// will fade in when a CallbackEvent is invoked.
|
||||||
|
info = new Info();
|
||||||
|
|
||||||
|
|
||||||
|
// add 2 sliders
|
||||||
|
s1 = cp5.addSlider("hello")
|
||||||
|
.setRange(0, 100)
|
||||||
|
.setValue(50)
|
||||||
|
.setPosition(40, 40)
|
||||||
|
.setSize(100, 20);
|
||||||
|
|
||||||
|
s2 = cp5.addSlider("world")
|
||||||
|
.setRange(0, 100)
|
||||||
|
.setValue(10)
|
||||||
|
.setPosition(40, 70)
|
||||||
|
.setSize(100, 20);
|
||||||
|
|
||||||
|
|
||||||
|
// the following CallbackListener will listen to any controlP5
|
||||||
|
// action such as enter, leave, pressed, released, releasedoutside, broadcast
|
||||||
|
// see static variables starting with ACTION_ inside class controlP5.ControlP5Constants
|
||||||
|
|
||||||
|
cb = new CallbackListener() {
|
||||||
|
public void controlEvent(CallbackEvent theEvent) {
|
||||||
|
switch(theEvent.getAction()) {
|
||||||
|
case(ControlP5.ACTION_ENTER):
|
||||||
|
info.n = 1;
|
||||||
|
info.label.setText(theEvent.getController().getInfo());
|
||||||
|
cursor(HAND);
|
||||||
|
break;
|
||||||
|
case(ControlP5.ACTION_LEAVE):
|
||||||
|
case(ControlP5.ACTION_RELEASEDOUTSIDE):
|
||||||
|
info.n = 0;
|
||||||
|
cursor(ARROW);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// add the above callback to controlP5
|
||||||
|
cp5.addCallback(cb);
|
||||||
|
|
||||||
|
// add another callback to slider s1, callback event will only be invoked for this
|
||||||
|
// particular controller.
|
||||||
|
s1.addCallback(new CallbackListener() {
|
||||||
|
public void controlEvent(CallbackEvent theEvent) {
|
||||||
|
if (theEvent.getAction()==ControlP5.ACTION_BROADCAST) {
|
||||||
|
s2.setValue(s2.getMax() - s1.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(0);
|
||||||
|
info.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void controlEvent(ControlEvent theEvent) {
|
||||||
|
println("Got a ControlEvent for "+theEvent.name()+" = "+theEvent.value());
|
||||||
|
info.label.setText(theEvent.getController().getInfo());
|
||||||
|
}
|
||||||
|
|
||||||
|
void keyPressed() {
|
||||||
|
// uncomment the line below to remove callback cb from controlP5
|
||||||
|
// when a key is pressed.
|
||||||
|
//controlP5.removeCallback(cb);
|
||||||
|
}
|
||||||
|
|
||||||
|
// controlEvent(CallbackEvent) is called whenever a callback
|
||||||
|
// has been triggered. controlEvent(CallbackEvent) is detected by
|
||||||
|
// controlP5 automatically.
|
||||||
|
void controlEvent(CallbackEvent theEvent) {
|
||||||
|
if (theEvent.getController().equals(s2)) {
|
||||||
|
switch(theEvent.getAction()) {
|
||||||
|
case(ControlP5.ACTION_ENTER):
|
||||||
|
println("Action:ENTER");
|
||||||
|
break;
|
||||||
|
case(ControlP5.ACTION_LEAVE):
|
||||||
|
println("Action:LEAVE");
|
||||||
|
break;
|
||||||
|
case(ControlP5.ACTION_PRESSED):
|
||||||
|
println("Action:PRESSED");
|
||||||
|
break;
|
||||||
|
case(ControlP5.ACTION_RELEASED):
|
||||||
|
println("Action:RELEASED");
|
||||||
|
break;
|
||||||
|
case(ControlP5.ACTION_RELEASEDOUTSIDE):
|
||||||
|
println("Action:RELEASED OUTSIDE");
|
||||||
|
break;
|
||||||
|
case(ControlP5.ACTION_BROADCAST):
|
||||||
|
println("Action:BROADCAST");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Info {
|
||||||
|
float a;
|
||||||
|
float n = 0;
|
||||||
|
String txt = "";
|
||||||
|
Textarea label;
|
||||||
|
|
||||||
|
Info() {
|
||||||
|
label = cp5.addTextarea("Hello\nWorld")
|
||||||
|
.setSize(200,200)
|
||||||
|
.setPosition(300,40)
|
||||||
|
.setColor(color(255))
|
||||||
|
.setColorBackground(color(100,0))
|
||||||
|
.setLineHeight(12);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void update() {
|
||||||
|
a += (n-a)*0.1;
|
||||||
|
label.setColorBackground(color(100,255*a));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
a list of all methods available for the CallbackEvent Controller
|
||||||
|
use ControlP5.printPublicMethodsFor(CallbackEvent.class);
|
||||||
|
to print the following list into the console.
|
||||||
|
|
||||||
|
You can find further details about class CallbackEvent in the javadoc.
|
||||||
|
|
||||||
|
Format:
|
||||||
|
ClassName : returnType methodName(parameter type)
|
||||||
|
|
||||||
|
|
||||||
|
controlP5.CallbackEvent : Controller getController()
|
||||||
|
controlP5.CallbackEvent : int getAction()
|
||||||
|
java.lang.Object : String toString()
|
||||||
|
java.lang.Object : boolean equals(Object)
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
112
examples/use/ControlP5controlEvent/ControlP5controlEvent.pde
Normal file
112
examples/use/ControlP5controlEvent/ControlP5controlEvent.pde
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 ControlEvent.
|
||||||
|
* every control event is automatically forwarded to the function controlEvent(ControlEvent)
|
||||||
|
* inside a sketch if such function is available. For further details about the API of
|
||||||
|
* the ControlEvent class, please refer to the documentation.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* find a list of public methods available for ControlEvent
|
||||||
|
* at the bottom of this sketch's source code
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlP5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
public int myColorRect1 = 200;
|
||||||
|
|
||||||
|
public int myColorRect2 = 100;
|
||||||
|
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400, 400);
|
||||||
|
noStroke();
|
||||||
|
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
cp5.addNumberbox("n1")
|
||||||
|
.setValue(myColorRect1)
|
||||||
|
.setPosition(20, 20)
|
||||||
|
.setSize(100, 20)
|
||||||
|
.setMin(0)
|
||||||
|
.setMax(255)
|
||||||
|
.setId(1);
|
||||||
|
|
||||||
|
cp5.addNumberbox("n2")
|
||||||
|
.setValue(myColorRect2)
|
||||||
|
.setPosition(20, 60)
|
||||||
|
.setSize(100, 20)
|
||||||
|
.setMin(0)
|
||||||
|
.setMax(255)
|
||||||
|
.setId(2);
|
||||||
|
|
||||||
|
cp5.addTextfield("n3")
|
||||||
|
.setPosition(20, 100)
|
||||||
|
.setSize(100, 20)
|
||||||
|
.setId(3);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(ControlP5.MAROON);
|
||||||
|
fill(ControlP5.RED, myColorRect1);
|
||||||
|
rect(140, 20, 240, 170);
|
||||||
|
fill(ControlP5.FUCHSIA, myColorRect2);
|
||||||
|
rect(140, 210, 240, 170);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void controlEvent(ControlEvent theEvent) {
|
||||||
|
println("got a control event from controller with id "+theEvent.getController().getId());
|
||||||
|
|
||||||
|
if (theEvent.isFrom(cp5.getController("n1"))) {
|
||||||
|
println("this event was triggered by Controller n1");
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(theEvent.getController().getId()) {
|
||||||
|
case(1):
|
||||||
|
myColorRect1 = (int)(theEvent.getController().getValue());
|
||||||
|
break;
|
||||||
|
case(2):
|
||||||
|
myColorRect2 = (int)(theEvent.getController().getValue());
|
||||||
|
break;
|
||||||
|
case(3):
|
||||||
|
println(theEvent.getController().getStringValue());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
a list of all methods available for ControlEvent
|
||||||
|
use ControlP5.printPublicMethodsFor(ControlEvent.class);
|
||||||
|
to print the following list into the console.
|
||||||
|
|
||||||
|
You can find further details about class ControlEvent in the javadoc.
|
||||||
|
|
||||||
|
Format:
|
||||||
|
ClassName : returnType methodName(parameter type)
|
||||||
|
|
||||||
|
controlP5.ControlEvent : ControlGroup getGroup()
|
||||||
|
controlP5.ControlEvent : Controller getController()
|
||||||
|
controlP5.ControlEvent : String getLabel()
|
||||||
|
controlP5.ControlEvent : String getName()
|
||||||
|
controlP5.ControlEvent : String getStringValue()
|
||||||
|
controlP5.ControlEvent : Tab getTab()
|
||||||
|
controlP5.ControlEvent : boolean isController()
|
||||||
|
controlP5.ControlEvent : boolean isFrom(ControllerInterface)
|
||||||
|
controlP5.ControlEvent : boolean isFrom(String)
|
||||||
|
controlP5.ControlEvent : boolean isGroup()
|
||||||
|
controlP5.ControlEvent : boolean isTab()
|
||||||
|
controlP5.ControlEvent : float getValue()
|
||||||
|
controlP5.ControlEvent : float[] getArrayValue()
|
||||||
|
controlP5.ControlEvent : int getId()
|
||||||
|
controlP5.ControlEvent : int getType()
|
||||||
|
java.lang.Object : String toString()
|
||||||
|
java.lang.Object : boolean equals(Object)
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
100
examples/use/ControlP5controlFont/ControlP5controlFont.pde
Normal file
100
examples/use/ControlP5controlFont/ControlP5controlFont.pde
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 controlFont.
|
||||||
|
*
|
||||||
|
* this example shows how to create a button with controlP5 (1), how to
|
||||||
|
* load and use a PFont with controlP5 (2), apply a ControlFont to
|
||||||
|
* the caption label of a button (3), and adjust the location of a
|
||||||
|
* caption label using the style() property of a controller.
|
||||||
|
*
|
||||||
|
* by andreas schlegel, 2012
|
||||||
|
*/
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
controlP5.Button b;
|
||||||
|
|
||||||
|
int buttonValue = 1;
|
||||||
|
|
||||||
|
boolean isOpen;
|
||||||
|
|
||||||
|
int myColorBackground = color(0,0,0);
|
||||||
|
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(700,400);
|
||||||
|
smooth();
|
||||||
|
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
// (1)
|
||||||
|
// create some controllers
|
||||||
|
cp5.addButton("button")
|
||||||
|
.setValue(10)
|
||||||
|
.setPosition(20,20)
|
||||||
|
.setSize(100,50)
|
||||||
|
.setId(1);
|
||||||
|
|
||||||
|
b = cp5.addButton("buttonValue")
|
||||||
|
.setValue(4)
|
||||||
|
.setPosition(100,190)
|
||||||
|
.setSize(200,200)
|
||||||
|
.setId(2);
|
||||||
|
|
||||||
|
// (2)
|
||||||
|
// load a new font. ControlFont is a wrapper for processing's PFont
|
||||||
|
// with processing 1.1 ControlFont.setSmooth() is not supported anymore.
|
||||||
|
// to display a font as smooth or non-smooth, use true/false as 3rd parameter
|
||||||
|
// when creating a PFont:
|
||||||
|
|
||||||
|
PFont pfont = createFont("Arial",20,true); // use true/false for smooth/no-smooth
|
||||||
|
ControlFont font = new ControlFont(pfont,241);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// (3)
|
||||||
|
// change the font and content of the captionlabels
|
||||||
|
// for both buttons create earlier.
|
||||||
|
cp5.getController("button")
|
||||||
|
.getCaptionLabel()
|
||||||
|
.setFont(font)
|
||||||
|
.toUpperCase(false)
|
||||||
|
.setSize(24)
|
||||||
|
;
|
||||||
|
|
||||||
|
b.getCaptionLabel()
|
||||||
|
.setFont(font)
|
||||||
|
.setSize(50)
|
||||||
|
.toUpperCase(false)
|
||||||
|
.setText("hello")
|
||||||
|
;
|
||||||
|
//
|
||||||
|
// (4)
|
||||||
|
// adjust the location of a catiption label using the
|
||||||
|
// style property of a controller.
|
||||||
|
b.getCaptionLabel().getStyle().marginLeft = 20;
|
||||||
|
b.getCaptionLabel().getStyle().marginTop = 40;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(ControlP5.SILVER);
|
||||||
|
// animate button b
|
||||||
|
float x = b.x(b.getPosition());
|
||||||
|
x += ((isOpen==true ? 0:-200) - x) * 0.2;;
|
||||||
|
float y = b.y(b.getPosition());
|
||||||
|
b.setPosition(x,y);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void controlEvent(ControlEvent theEvent) {
|
||||||
|
println(theEvent.getController().getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void button(float theValue) {
|
||||||
|
println("a button event. "+theValue);
|
||||||
|
isOpen = !isOpen;
|
||||||
|
cp5.getController("button").setCaptionLabel((isOpen==true) ? "close":"open");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
101
examples/use/ControlP5customView/ControlP5customView.pde
Normal file
101
examples/use/ControlP5customView/ControlP5customView.pde
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 Custom View
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* find a list of public methods available for the ControllerDisplay Controller
|
||||||
|
* at the bottom of this sketch.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400, 400);
|
||||||
|
smooth();
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
cp5.addButton("hello")
|
||||||
|
.setPosition(50, 100)
|
||||||
|
.setSize(150,150)
|
||||||
|
.setView(new CircularButton())
|
||||||
|
;
|
||||||
|
|
||||||
|
cp5.addButton("world")
|
||||||
|
.setPosition(250, 100)
|
||||||
|
.setSize(50,50)
|
||||||
|
.setView(new CircularButton())
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(ControlP5.BLACK);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void hello(int theValue) {
|
||||||
|
println("Hello pressed");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void world(int theValue) {
|
||||||
|
println("World pressed");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* to define a custom View for a controller use the ContollerView<T> interface
|
||||||
|
* T here must be replace by the name of the Controller class your custom View will be
|
||||||
|
* applied to. In our example T is replace by Button since we are aplpying the View
|
||||||
|
* to the Button instance create in setup. The ControllerView interface requires
|
||||||
|
* you to implement the display(PApplet, T) method. Same here, T must be replaced by
|
||||||
|
* the Controller class you are designing the custom view for, for us this is the
|
||||||
|
* Button class.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class CircularButton implements ControllerView<Button> {
|
||||||
|
|
||||||
|
public void display(PGraphics theApplet, Button theButton) {
|
||||||
|
theApplet.pushMatrix();
|
||||||
|
if (theButton.isInside()) {
|
||||||
|
if (theButton.isPressed()) { // button is pressed
|
||||||
|
theApplet.fill(ControlP5.LIME);
|
||||||
|
} else { // mouse hovers the button
|
||||||
|
theApplet.fill(ControlP5.YELLOW);
|
||||||
|
}
|
||||||
|
} else { // the mouse is located outside the button area
|
||||||
|
theApplet.fill(ControlP5.GREEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
theApplet.ellipse(0, 0, theButton.getWidth(), theButton.getHeight());
|
||||||
|
|
||||||
|
// center the caption label
|
||||||
|
int x = theButton.getWidth()/2 - theButton.getCaptionLabel().getWidth()/2;
|
||||||
|
int y = theButton.getHeight()/2 - theButton.getCaptionLabel().getHeight()/2;
|
||||||
|
|
||||||
|
translate(x, y);
|
||||||
|
theButton.getCaptionLabel().draw(theApplet);
|
||||||
|
|
||||||
|
theApplet.popMatrix();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
a list of all methods available for the ControllerView Controller
|
||||||
|
use ControlP5.printPublicMethodsFor(ControllerView.class);
|
||||||
|
to print the following list into the console.
|
||||||
|
|
||||||
|
You can find further details about class ControllerView in the javadoc.
|
||||||
|
|
||||||
|
Format:
|
||||||
|
ClassName : returnType methodName(parameter type)
|
||||||
|
|
||||||
|
controlP5.ControllerView : void display(PApplet, T)
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,163 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 extending Controllers
|
||||||
|
*
|
||||||
|
* the following example shows how to extend the Controller class to
|
||||||
|
* create customizable Controllers. You can either extend the Controller class itself,
|
||||||
|
* or any class that extends Controller itself like the Slider, Button, DropdownList, etc.
|
||||||
|
*
|
||||||
|
* How to:
|
||||||
|
*
|
||||||
|
* 1) do a super call to the convenience constructor requiring
|
||||||
|
* 2 parameter (ControlP5 instance, name)
|
||||||
|
*
|
||||||
|
* 2) the Controller class has a set of empty methods that allow you to capture
|
||||||
|
* inputs from the mouse including
|
||||||
|
* onEnter(), onLeave(), onPress(), onRelease(), onClick(), onScroll(int), onDrag()
|
||||||
|
* These you can override and include functionality as needed.
|
||||||
|
*
|
||||||
|
* 3) use method getPointer() to return the local (relative)
|
||||||
|
* xy-coordinates of the controller
|
||||||
|
*
|
||||||
|
* 4) after instantiation custom controllers are treated the same
|
||||||
|
* as default controlP5 controllers.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
PApplet p;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400, 400);
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
|
||||||
|
// create 2 groups to show nesting of custom controllers and
|
||||||
|
//
|
||||||
|
Group g1 = cp5.addGroup("a").setPosition(0,100).setWidth(180);
|
||||||
|
Group g2 = cp5.addGroup("b").setPosition(0,10).setWidth(180);
|
||||||
|
g2.moveTo(g1);
|
||||||
|
|
||||||
|
// create 2 custom Controllers from class MyButton
|
||||||
|
// MyButton extends Controller and inherits all methods accordingly.
|
||||||
|
new MyButton(cp5, "b1").setPosition(0, 0).setSize(180, 200).moveTo(g2);
|
||||||
|
new MyButton(cp5, "b2").setPosition(205, 15).setSize(180, 200);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// b1 will be called from Controller b1
|
||||||
|
public void b1(float theValue) {
|
||||||
|
println("yay button "+theValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void controlEvent(ControlEvent theEvent) {
|
||||||
|
println("controlEvent : "+theEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Create a custom Controller, please not that
|
||||||
|
// MyButton extends Controller<MyButton>, <MyButton>
|
||||||
|
// is an indicator for the super class about the type of
|
||||||
|
// custom controller to be created.
|
||||||
|
|
||||||
|
class MyButton extends Controller<MyButton> {
|
||||||
|
|
||||||
|
int current = 0xffff0000;
|
||||||
|
|
||||||
|
float a = 128;
|
||||||
|
|
||||||
|
float na;
|
||||||
|
|
||||||
|
int y;
|
||||||
|
|
||||||
|
// use the convenience constructor of super class Controller
|
||||||
|
// MyButton will automatically registered and move to the
|
||||||
|
// default controlP5 tab.
|
||||||
|
|
||||||
|
MyButton(ControlP5 cp5, String theName) {
|
||||||
|
super(cp5, theName);
|
||||||
|
|
||||||
|
// replace the default view with a custom view.
|
||||||
|
setView(new ControllerView() {
|
||||||
|
public void display(PGraphics p, Object b) {
|
||||||
|
// draw button background
|
||||||
|
na += (a-na) * 0.1;
|
||||||
|
p.fill(current,na);
|
||||||
|
p.rect(0, 0, getWidth(), getHeight());
|
||||||
|
|
||||||
|
// draw horizontal line which can be moved on the x-axis
|
||||||
|
// using the scroll wheel.
|
||||||
|
p.fill(0,255,0);
|
||||||
|
p.rect(0,y,width,10);
|
||||||
|
|
||||||
|
// draw the custom label
|
||||||
|
p.fill(128);
|
||||||
|
translate(0,getHeight()+14);
|
||||||
|
p.text(getName(),0,0);
|
||||||
|
p.text(getName(),0,0);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// override various input methods for mouse input control
|
||||||
|
void onEnter() {
|
||||||
|
cursor(HAND);
|
||||||
|
println("enter");
|
||||||
|
a = 255;
|
||||||
|
}
|
||||||
|
|
||||||
|
void onScroll(int n) {
|
||||||
|
println("scrolling");
|
||||||
|
y -= n;
|
||||||
|
y = constrain(y,0,getHeight()-10);
|
||||||
|
}
|
||||||
|
|
||||||
|
void onPress() {
|
||||||
|
println("press");
|
||||||
|
current = 0xffffff00;
|
||||||
|
}
|
||||||
|
|
||||||
|
void onClick() {
|
||||||
|
Pointer p1 = getPointer();
|
||||||
|
println("clicked at "+p1.x()+", "+p1.y());
|
||||||
|
current = 0xffffff00;
|
||||||
|
setValue(y);
|
||||||
|
}
|
||||||
|
|
||||||
|
void onRelease() {
|
||||||
|
println("release");
|
||||||
|
current = 0xffffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
void onMove() {
|
||||||
|
println("moving "+this+" "+_myControlWindow.getMouseOverList());
|
||||||
|
}
|
||||||
|
|
||||||
|
void onDrag() {
|
||||||
|
current = 0xff0000ff;
|
||||||
|
Pointer p1 = getPointer();
|
||||||
|
float dif = dist(p1.px(),p1.py(),p1.x(),p1.y());
|
||||||
|
println("dragging at "+p1.x()+", "+p1.y()+" "+dif);
|
||||||
|
}
|
||||||
|
|
||||||
|
void onReleaseOutside() {
|
||||||
|
onLeave();
|
||||||
|
}
|
||||||
|
|
||||||
|
void onLeave() {
|
||||||
|
println("leave");
|
||||||
|
cursor(ARROW);
|
||||||
|
a = 128;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,47 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 Listener.
|
||||||
|
* the ControlListener interface can be used to implement a custom
|
||||||
|
* ControlListener which listens for incoming ControlEvent from specific
|
||||||
|
* controller(s). MyControlListener in the example below listens to
|
||||||
|
* ControlEvents coming in from controller 'mySlider'.
|
||||||
|
*
|
||||||
|
* by andreas schlegel, 2012
|
||||||
|
*/
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
MyControlListener myListener;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(700,400);
|
||||||
|
|
||||||
|
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
cp5.setColor(ControlP5.THEME_RED);
|
||||||
|
|
||||||
|
cp5.addSlider("mySlider")
|
||||||
|
.setRange(100,200)
|
||||||
|
.setValue(140)
|
||||||
|
.setPosition(200,200)
|
||||||
|
.setSize(200,20);
|
||||||
|
|
||||||
|
myListener = new MyControlListener();
|
||||||
|
|
||||||
|
cp5.getController("mySlider").addListener(myListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(myListener.col);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class MyControlListener implements ControlListener {
|
||||||
|
int col;
|
||||||
|
public void controlEvent(ControlEvent theEvent) {
|
||||||
|
println("i got an event from mySlider, " +
|
||||||
|
"changing background color to "+
|
||||||
|
theEvent.getController().getValue());
|
||||||
|
col = (int)theEvent.getController().getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
98
examples/use/ControlP5mouseover/ControlP5mouseover.pde
Normal file
98
examples/use/ControlP5mouseover/ControlP5mouseover.pde
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
|
||||||
|
/**
|
||||||
|
* ControlP5 Mouseover
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* this example demonstrates the use of the mouseover methods
|
||||||
|
* isMouseOver(), getMouseOverList()
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
public int slider1 = 64;
|
||||||
|
public int slider2 = 128;
|
||||||
|
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(700, 400);
|
||||||
|
smooth(8);
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
|
||||||
|
cp5.addSlider("slider1", 0, 255, 20, 100, 128, 20);
|
||||||
|
cp5.addSlider("slider2", 0, 255, 20, 150, 128, 20);
|
||||||
|
|
||||||
|
ScrollableList l = cp5.addScrollableList("myList", 250, 260, 200, 80);
|
||||||
|
for (int i=0;i<80;i++) {
|
||||||
|
l.addItem("item "+i, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
cp5.addButton("b1", 0, 20, 350, 80, 20);
|
||||||
|
cp5.addButton("b2", 0, 101, 350, 80, 20);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
color hover = color(0, 230, 150);
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(ControlP5.BLACK);
|
||||||
|
// check if the mouse is inside of any of the controllers
|
||||||
|
// displayed in the main window
|
||||||
|
if(cp5.isMouseOver()) {
|
||||||
|
fill(hover);
|
||||||
|
} else {
|
||||||
|
fill(128);
|
||||||
|
}
|
||||||
|
|
||||||
|
ellipse(45,50,50,50);
|
||||||
|
|
||||||
|
// check if the mouse is hovering controller slider1 and set the color accordingly
|
||||||
|
fill(cp5.isMouseOver(cp5.getController("slider1")) ? hover:color(slider1));
|
||||||
|
rect(250, 100, 200, 20);
|
||||||
|
|
||||||
|
|
||||||
|
fill(cp5.isMouseOver(cp5.getController("slider2")) ? hover:color(slider2));
|
||||||
|
rect(250, 150, 200, 20);
|
||||||
|
|
||||||
|
fill(cp5.isMouseOver(cp5.getController("b1")) ? hover:color(128));
|
||||||
|
ellipse(30, 330, 20, 20);
|
||||||
|
|
||||||
|
fill(cp5.isMouseOver(cp5.getController("b2")) ? hover:color(128));
|
||||||
|
ellipse(110, 330, 20, 20);
|
||||||
|
|
||||||
|
fill(cp5.isMouseOver(cp5.getController("myList")) ? hover:color(128));
|
||||||
|
ellipse(260, 230, 20, 20);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void mousePressed() {
|
||||||
|
// print the current mouseoverlist on mouse pressed
|
||||||
|
print("The Current mouseoverlist:\t");
|
||||||
|
println(cp5.getWindow().getMouseOverList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
a list of all methods available for the ControlP5 Controller
|
||||||
|
use ControlP5.printPublicMethodsFor(ControlP5.class);
|
||||||
|
to print the full list into the console.
|
||||||
|
|
||||||
|
You can find further details about class ControlP5 in the javadoc.
|
||||||
|
|
||||||
|
Format:
|
||||||
|
ClassName : returnType methodName(parameter type)
|
||||||
|
|
||||||
|
controlP5.ControlP5 : List getMouseOverList()
|
||||||
|
controlP5.ControlP5 : boolean isMouseOver()
|
||||||
|
controlP5.ControlP5 : boolean isMouseOver(ControllerInterface)
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
109
examples/use/ControlP5plugTo/ControlP5plugTo.pde
Normal file
109
examples/use/ControlP5plugTo/ControlP5plugTo.pde
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 plugTo
|
||||||
|
*
|
||||||
|
* This example demonstrate how to use the plugTo method to
|
||||||
|
* connect a controller to a field or method of a particular object.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* find a list of public methods available for the ControlP5 Controller
|
||||||
|
* at the bottom of this sketch.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2011
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
import processing.opengl.*;
|
||||||
|
|
||||||
|
ControlP5 controlP5;
|
||||||
|
|
||||||
|
Test[] testarray;
|
||||||
|
|
||||||
|
Test test;
|
||||||
|
|
||||||
|
Button b;
|
||||||
|
|
||||||
|
int cnt;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(600,400);
|
||||||
|
smooth();
|
||||||
|
test = new Test(50);
|
||||||
|
testarray = new Test[10];
|
||||||
|
for(int i=0;i<10;i++) {
|
||||||
|
testarray[i] = new Test(200 + i*20);
|
||||||
|
}
|
||||||
|
|
||||||
|
controlP5 = new ControlP5(this);
|
||||||
|
|
||||||
|
controlP5.begin(100,20);
|
||||||
|
|
||||||
|
b = controlP5.addButton("trigger",1);
|
||||||
|
b.setColorBackground(ControlP5.RED);
|
||||||
|
|
||||||
|
controlP5.addButton("plug",2);
|
||||||
|
controlP5.addButton("unplug",3);
|
||||||
|
|
||||||
|
// b is a button previously added to controlP5 with name 'trigger'
|
||||||
|
// controlP5 no tries to find a field or method inside object test
|
||||||
|
// in order to connect controller 'trigger' with test.trigger()
|
||||||
|
b.plugTo(test);
|
||||||
|
controlP5.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
// connects controller 'trigger' with objects of type Test contained
|
||||||
|
// inside arrat testarray
|
||||||
|
void plug(int theValue) {
|
||||||
|
b.plugTo(testarray);
|
||||||
|
b.setColorBackground(ControlP5.GREEN);
|
||||||
|
println("plugging controller b1 to array 'testarray' and variable 'test'.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// disconnects controller 'trigger' from objects of type Test stored
|
||||||
|
// inside array testarray
|
||||||
|
void unplug(int theValue) {
|
||||||
|
b.unplugFrom(testarray);
|
||||||
|
b.setColorBackground(ControlP5.RED);
|
||||||
|
println("removing array 'testarray' and variable 'test' from controller b1.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(0);
|
||||||
|
fill(255);
|
||||||
|
for(int i=0;i<10;i++) {
|
||||||
|
testarray[i].display();
|
||||||
|
}
|
||||||
|
test.display();
|
||||||
|
cnt++;
|
||||||
|
if(cnt%30 == 0) {
|
||||||
|
controlP5.getController("trigger").update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class Test {
|
||||||
|
float n0 = 0;
|
||||||
|
float n1 = 1;
|
||||||
|
float x;
|
||||||
|
|
||||||
|
Test(float theX) {
|
||||||
|
x = theX;
|
||||||
|
}
|
||||||
|
|
||||||
|
void trigger(int theValue) {
|
||||||
|
n1 = random(100);
|
||||||
|
}
|
||||||
|
|
||||||
|
void display() {
|
||||||
|
n0 += (n1-n0) * 0.1;
|
||||||
|
rect(x,200,10,n0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void controlEvent(ControlEvent theEvent) {
|
||||||
|
//println("\t\t b1 event sub \n\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,106 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 properties example (see keyPressed).
|
||||||
|
* by andreas schlegel, 2011
|
||||||
|
*
|
||||||
|
* status: experimental
|
||||||
|
* saves/loads controller values into/from a properties-file
|
||||||
|
* by default properties will be saved in a serialized format and use the .ser extension.
|
||||||
|
*
|
||||||
|
* taken from the changelog;
|
||||||
|
* adding saveProperties(String) and loadProperties(String) to
|
||||||
|
* save and load serialized controller properties.
|
||||||
|
* The range of controllers implementing save/load properties currently includes
|
||||||
|
* Slider, Knob, Numberbox, Toggle, Checkbox, RadioButton, Textlabel, Matrix,Range,
|
||||||
|
* textarea, ListBox, Dropdown, colorPicker.
|
||||||
|
* Properties are currently saved in the java serialization
|
||||||
|
* format but xml and possibly json alternatives are being worked on.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* default properties load/save key combinations are
|
||||||
|
* alt+shift+l to load properties
|
||||||
|
* alt+shift+s to save properties
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
public int myColor = color(0,0,0);
|
||||||
|
|
||||||
|
public int sliderValue = 100;
|
||||||
|
public int sliderTicks1 = 100;
|
||||||
|
public int sliderTicks2 = 30;
|
||||||
|
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400,400);
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
noStroke();
|
||||||
|
// add a vertical slider
|
||||||
|
cp5.addSlider("slider")
|
||||||
|
.setRange(0,200)
|
||||||
|
.setValue(128)
|
||||||
|
.setPosition(20,100)
|
||||||
|
.setSize(20,100)
|
||||||
|
;
|
||||||
|
// create another slider with tick marks, now without
|
||||||
|
// default value, the initial value will be set according th
|
||||||
|
// the value of variable sliderTicks2 then.
|
||||||
|
cp5.addSlider("sliderTicks1")
|
||||||
|
.setRange(0,255)
|
||||||
|
.setPosition(100,100)
|
||||||
|
.setSize(20,100)
|
||||||
|
.setNumberOfTickMarks(5)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
// add horizontal sliders
|
||||||
|
cp5.addSlider("sliderValue")
|
||||||
|
.setRange(0,255)
|
||||||
|
.setValue(128)
|
||||||
|
.setPosition(200,180)
|
||||||
|
.setSize(100,20)
|
||||||
|
;
|
||||||
|
|
||||||
|
cp5.addSlider("sliderTicks2")
|
||||||
|
.setRange(0,255)
|
||||||
|
.setValue(128)
|
||||||
|
.setPosition(200,220)
|
||||||
|
.setSize(100,20)
|
||||||
|
.setNumberOfTickMarks(7)
|
||||||
|
.setSliderMode(Slider.FLEXIBLE);
|
||||||
|
;
|
||||||
|
// use Slider.FIX or Slider.FLEXIBLE to change the slider handle
|
||||||
|
// by default it is Slider.FIX
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(sliderTicks1);
|
||||||
|
|
||||||
|
fill(sliderValue);
|
||||||
|
rect(0,0,width,100);
|
||||||
|
|
||||||
|
fill(myColor);
|
||||||
|
rect(0,300,width,70);
|
||||||
|
|
||||||
|
fill(sliderTicks2);
|
||||||
|
rect(0,370,width,30);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void slider(float theColor) {
|
||||||
|
myColor = color(theColor);
|
||||||
|
println("a slider event. setting background to "+theColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
void keyPressed() {
|
||||||
|
// default properties load/save key combinations are
|
||||||
|
// alt+shift+l to load properties
|
||||||
|
// alt+shift+s to save properties
|
||||||
|
if(key=='1') {
|
||||||
|
cp5.saveProperties(("hello.json"));
|
||||||
|
} else if(key=='2') {
|
||||||
|
cp5.loadProperties(("hello.json"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
22
examples/use/ControlP5propertiesCustom/hello.json
Normal file
22
examples/use/ControlP5propertiesCustom/hello.json
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"/sliderValue": {
|
||||||
|
"min": 0,
|
||||||
|
"max": 255,
|
||||||
|
"value": 128
|
||||||
|
},
|
||||||
|
"/slider": {
|
||||||
|
"min": 0,
|
||||||
|
"max": 200,
|
||||||
|
"value": 128
|
||||||
|
},
|
||||||
|
"/sliderTicks1": {
|
||||||
|
"min": 0,
|
||||||
|
"max": 255,
|
||||||
|
"value": 127.5
|
||||||
|
},
|
||||||
|
"/sliderTicks2": {
|
||||||
|
"min": 0,
|
||||||
|
"max": 255,
|
||||||
|
"value": 127.5
|
||||||
|
}
|
||||||
|
}
|
94
examples/use/ControlP5quick/ControlP5quick.pde
Normal file
94
examples/use/ControlP5quick/ControlP5quick.pde
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 quick
|
||||||
|
*
|
||||||
|
* this example demonstrates how to quickly add Controllers such as
|
||||||
|
* Button, Slider,Toggle and Numberbox to a sketch without having to set
|
||||||
|
* positions, this is done automatically by cp5.
|
||||||
|
* controllers will be aligned horizontally - .linebreak() will
|
||||||
|
* force the next controller to the next line.
|
||||||
|
* the example shows as well how to link variables and functions to
|
||||||
|
* a controller. this is done by assigning the name of the variable
|
||||||
|
* or function to a controller.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// ControlP5quick
|
||||||
|
// this example demonstrates how to quickly add Controllers such as
|
||||||
|
// Button, Slider,Toggle and Numberbox to a sketch without having to set
|
||||||
|
// positions, this is done automatically by cp5.
|
||||||
|
// controllers will be aligned horizontally - .linebreak() will
|
||||||
|
// force the next controller to the next line.
|
||||||
|
// the example shows as well how to link variables and functions to
|
||||||
|
// a controller. this is done by assigning the name of the variable
|
||||||
|
// or function to a controller.
|
||||||
|
//
|
||||||
|
// by andreas schlegel 2010
|
||||||
|
//
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
float s1 = 5;
|
||||||
|
float s2 = 2;
|
||||||
|
boolean t1 = true;
|
||||||
|
boolean t2 = true;
|
||||||
|
boolean t3 = true;
|
||||||
|
boolean t4 = true;
|
||||||
|
float n1 = 100;
|
||||||
|
int n2 = 50;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(600,400);
|
||||||
|
noStroke();
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
cp5.addButton("b1",1);
|
||||||
|
cp5.addButton("b2",2);
|
||||||
|
cp5.addButton("b3",3);
|
||||||
|
cp5.addButton("b4",4).linebreak();
|
||||||
|
cp5.addSlider("s1",0,10);
|
||||||
|
cp5.addSlider("s2",0,10).linebreak();
|
||||||
|
cp5.addButton("b5");
|
||||||
|
cp5.addToggle("t1");
|
||||||
|
cp5.addToggle("t2");
|
||||||
|
cp5.addToggle("t3");
|
||||||
|
cp5.addToggle("t4").linebreak();
|
||||||
|
cp5.addNumberbox("n1");
|
||||||
|
cp5.addNumberbox("n2");
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(0);
|
||||||
|
if(t1) {
|
||||||
|
fill(s1*25);
|
||||||
|
rect(0,200,150,height);
|
||||||
|
}
|
||||||
|
if(t2) {
|
||||||
|
fill(s2*25);
|
||||||
|
rect(150,200,150,height);
|
||||||
|
}
|
||||||
|
if(t3) {
|
||||||
|
fill(n1);
|
||||||
|
rect(300,200,150,height);
|
||||||
|
}
|
||||||
|
if(t4) {
|
||||||
|
fill(n2);
|
||||||
|
rect(450,200,150,height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void b1(int theN) {
|
||||||
|
println(theN);
|
||||||
|
}
|
||||||
|
|
||||||
|
void b2(int theN) {
|
||||||
|
println(theN);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,54 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 Slider set value
|
||||||
|
* changes the value of a slider on keyPressed
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlP5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
int myColorBackground = color(0,0,0);
|
||||||
|
|
||||||
|
int sliderValue = 100;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400,400);
|
||||||
|
noStroke();
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
|
||||||
|
cp5.addSlider("sliderValue")
|
||||||
|
.setRange(100,200)
|
||||||
|
.setValue(120)
|
||||||
|
.setPosition(100,200)
|
||||||
|
.setSize(100,10)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
cp5.addSlider("slider")
|
||||||
|
.setRange(100,200)
|
||||||
|
.setValue(128)
|
||||||
|
.setPosition(100,160)
|
||||||
|
.setSize(100,10);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(myColorBackground);
|
||||||
|
fill(sliderValue);
|
||||||
|
rect(0,0,width,100);
|
||||||
|
}
|
||||||
|
|
||||||
|
void slider(int theColor) {
|
||||||
|
myColorBackground = color(theColor);
|
||||||
|
println("a slider event. setting background to "+theColor);
|
||||||
|
cp5.getController("sliderValue").setValue(theColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
void keyPressed() {
|
||||||
|
cp5.getController("sliderValue").setValue(150);
|
||||||
|
}
|
163
examples/use/ControlP5snapshot/ControlP5snapshot.pde
Normal file
163
examples/use/ControlP5snapshot/ControlP5snapshot.pde
Normal file
@ -0,0 +1,163 @@
|
|||||||
|
/**
|
||||||
|
* ControlP5 snapshot
|
||||||
|
*
|
||||||
|
* this example shows how to use the snapshot methods for ControllerProperties.
|
||||||
|
* Snapshots allow you to save controller states in memory, recall, save and remove them.
|
||||||
|
*
|
||||||
|
* find a list of public methods available for the ControllerProperties Controller
|
||||||
|
* at the bottom of this sketch.
|
||||||
|
*
|
||||||
|
* by Andreas Schlegel, 2012
|
||||||
|
* www.sojamo.de/libraries/controlp5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
public float n = 50;
|
||||||
|
public float s = 10;
|
||||||
|
public float k = 100;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400, 400);
|
||||||
|
smooth();
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
|
||||||
|
cp5.addNumberbox("n")
|
||||||
|
.setPosition(10, 10)
|
||||||
|
.setSize(42, 16)
|
||||||
|
.setMultiplier(0.1)
|
||||||
|
.setRange(10,60)
|
||||||
|
.setValue(20)
|
||||||
|
;
|
||||||
|
|
||||||
|
cp5.addSlider("s")
|
||||||
|
.setPosition(10, 100)
|
||||||
|
.setSize(100, 20)
|
||||||
|
.setScrollSensitivity(0.01)
|
||||||
|
.setRange(60,140)
|
||||||
|
.setValue(100)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
cp5.addKnob("k")
|
||||||
|
.setPosition(200, 100)
|
||||||
|
.setRadius(50)
|
||||||
|
.setScrollSensitivity(0.001)
|
||||||
|
.setMin(60)
|
||||||
|
.setMax(140)
|
||||||
|
.setDisplayStyle(Controller.ARC)
|
||||||
|
;
|
||||||
|
|
||||||
|
cp5.addRange("r")
|
||||||
|
.setPosition(10,200)
|
||||||
|
.setSize(100,20)
|
||||||
|
.setRange(0, 200)
|
||||||
|
.setRangeValues(50,100)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void keyPressed() {
|
||||||
|
switch(key) {
|
||||||
|
case('1'):
|
||||||
|
cp5.getProperties().setSnapshot("hello1");
|
||||||
|
break;
|
||||||
|
case('2'):
|
||||||
|
cp5.getProperties().setSnapshot("hello2");
|
||||||
|
break;
|
||||||
|
case('3'):
|
||||||
|
cp5.getProperties().setSnapshot("hello3");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case('a'):
|
||||||
|
cp5.getProperties().getSnapshot("hello1");
|
||||||
|
break;
|
||||||
|
case('s'):
|
||||||
|
cp5.getProperties().getSnapshot("hello2");
|
||||||
|
break;
|
||||||
|
case('d'):
|
||||||
|
cp5.getProperties().getSnapshot("hello3");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case('z'):
|
||||||
|
cp5.getProperties().removeSnapshot("hello1");
|
||||||
|
break;
|
||||||
|
case('x'):
|
||||||
|
cp5.getProperties().removeSnapshot("hello2");
|
||||||
|
break;
|
||||||
|
case('c'):
|
||||||
|
cp5.getProperties().removeSnapshot("hello3");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case('i'):
|
||||||
|
cp5.getProperties().saveSnapshot("hello1");
|
||||||
|
break;
|
||||||
|
case('o'):
|
||||||
|
cp5.getProperties().load("hello1.ser");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
println(cp5.getProperties().getSnapshotIndices());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
a list of all methods available for the ControllerProperties Controller
|
||||||
|
use ControlP5.printPublicMethodsFor(ControllerProperties.class);
|
||||||
|
to print the following list into the console.
|
||||||
|
|
||||||
|
You can find further details about class ControllerProperties in the javadoc.
|
||||||
|
|
||||||
|
Format:
|
||||||
|
ClassName : returnType methodName(parameter type)
|
||||||
|
|
||||||
|
|
||||||
|
controlP5.ControllerProperties : ArrayList getSnapshotIndices()
|
||||||
|
controlP5.ControllerProperties : ControllerProperties addSet(String)
|
||||||
|
controlP5.ControllerProperties : ControllerProperties delete(ControllerProperty)
|
||||||
|
controlP5.ControllerProperties : ControllerProperties getSnapshot(String)
|
||||||
|
controlP5.ControllerProperties : ControllerProperties move(ControllerInterface, String, String)
|
||||||
|
controlP5.ControllerProperties : ControllerProperties move(ControllerProperty, String, String)
|
||||||
|
controlP5.ControllerProperties : ControllerProperties only(ControllerProperty, String)
|
||||||
|
controlP5.ControllerProperties : ControllerProperties print()
|
||||||
|
controlP5.ControllerProperties : ControllerProperties register(ControllerInterface, String)
|
||||||
|
controlP5.ControllerProperties : ControllerProperties remove(ControllerInterface)
|
||||||
|
controlP5.ControllerProperties : ControllerProperties remove(ControllerInterface, String)
|
||||||
|
controlP5.ControllerProperties : ControllerProperties remove(ControllerInterface, String, String)
|
||||||
|
controlP5.ControllerProperties : ControllerProperties removeSnapshot(String)
|
||||||
|
controlP5.ControllerProperties : ControllerProperties saveSnapshot(String)
|
||||||
|
controlP5.ControllerProperties : ControllerProperties saveSnapshotAs(String, String)
|
||||||
|
controlP5.ControllerProperties : ControllerProperties setSnapshot(String)
|
||||||
|
controlP5.ControllerProperties : ControllerProperties updateSnapshot(String)
|
||||||
|
controlP5.ControllerProperties : ControllerProperty getProperty(ControllerInterface, String)
|
||||||
|
controlP5.ControllerProperties : ControllerProperty getProperty(ControllerInterface, String, String)
|
||||||
|
controlP5.ControllerProperties : ControllerProperty register(ControllerInterface, String, String)
|
||||||
|
controlP5.ControllerProperties : HashSet getPropertySet(ControllerInterface)
|
||||||
|
controlP5.ControllerProperties : List get(ControllerInterface)
|
||||||
|
controlP5.ControllerProperties : Map get()
|
||||||
|
controlP5.ControllerProperties : String toString()
|
||||||
|
controlP5.ControllerProperties : boolean load()
|
||||||
|
controlP5.ControllerProperties : boolean load(String)
|
||||||
|
controlP5.ControllerProperties : boolean save()
|
||||||
|
controlP5.ControllerProperties : boolean saveAs(String)
|
||||||
|
controlP5.ControllerProperties : void setFormat(Format)
|
||||||
|
java.lang.Object : String toString()
|
||||||
|
java.lang.Object : boolean equals(Object)
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,62 @@
|
|||||||
|
/**
|
||||||
|
* controlP5workingWithIDs by andreas schlegel
|
||||||
|
* an example to show how to distinguish controllers by IDs.
|
||||||
|
* further information in the documentation folder provided in the controlP5 folder.
|
||||||
|
* controlP5 website at http://www.sojamo.de/controlP5
|
||||||
|
*/
|
||||||
|
|
||||||
|
import controlP5.*;
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
public int myColorRect = 200;
|
||||||
|
|
||||||
|
public int myColorBackground = 40;
|
||||||
|
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(400,400);
|
||||||
|
|
||||||
|
noStroke();
|
||||||
|
|
||||||
|
/* new instance of ControlP5 */
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
/* add 2 controllers and give each of them a unique id. */
|
||||||
|
cp5.addNumberbox("numberbox1")
|
||||||
|
.setPosition(100,160)
|
||||||
|
.setSize(100,14)
|
||||||
|
.setId(1)
|
||||||
|
.setValue(myColorRect);
|
||||||
|
|
||||||
|
cp5.addSlider("slider1")
|
||||||
|
.setRange(10,200)
|
||||||
|
.setValue(myColorBackground)
|
||||||
|
.setPosition(100,220)
|
||||||
|
.setSize(100,10)
|
||||||
|
.setId(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
background(myColorBackground);
|
||||||
|
fill(myColorRect);
|
||||||
|
rect(0,0,width,100);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void controlEvent(ControlEvent theEvent) {
|
||||||
|
/* events triggered by controllers are automatically forwarded to
|
||||||
|
the controlEvent method. by checking the id of a controller one can distinguish
|
||||||
|
which of the controllers has been changed.
|
||||||
|
*/
|
||||||
|
println("got a control event from controller with id "+theEvent.getController().getId());
|
||||||
|
switch(theEvent.getController().getId()) {
|
||||||
|
case(1):
|
||||||
|
/* controller numberbox1 with id 1 */
|
||||||
|
myColorRect = (int)theEvent.getValue();
|
||||||
|
break;
|
||||||
|
case(2):
|
||||||
|
/* controller slider1 with id 2 */
|
||||||
|
myColorBackground = (int)theEvent.getValue();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
85
reference/allclasses-frame.html
Normal file
85
reference/allclasses-frame.html
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<!-- NewPage -->
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<!-- Generated by javadoc (version 1.7.0_51) on Sun Apr 27 21:39:48 SGT 2014 -->
|
||||||
|
<title>All Classes (Javadocs: controlP5)</title>
|
||||||
|
<meta name="date" content="2014-04-27">
|
||||||
|
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1 class="bar">All Classes</h1>
|
||||||
|
<div class="indexContainer">
|
||||||
|
<ul>
|
||||||
|
<li><a href="controlP5/Accordion.html" title="class in controlP5" target="classFrame">Accordion</a></li>
|
||||||
|
<li><a href="controlP5/Bang.html" title="class in controlP5" target="classFrame">Bang</a></li>
|
||||||
|
<li><a href="controlP5/BitFont.html" title="class in controlP5" target="classFrame">BitFont</a></li>
|
||||||
|
<li><a href="controlP5/BoundingBox.html" title="class in controlP5" target="classFrame">BoundingBox</a></li>
|
||||||
|
<li><a href="controlP5/Button.html" title="class in controlP5" target="classFrame">Button</a></li>
|
||||||
|
<li><a href="controlP5/CallbackEvent.html" title="class in controlP5" target="classFrame">CallbackEvent</a></li>
|
||||||
|
<li><a href="controlP5/CallbackListener.html" title="interface in controlP5" target="classFrame"><i>CallbackListener</i></a></li>
|
||||||
|
<li><a href="controlP5/Canvas.html" title="class in controlP5" target="classFrame">Canvas</a></li>
|
||||||
|
<li><a href="controlP5/CColor.html" title="class in controlP5" target="classFrame">CColor</a></li>
|
||||||
|
<li><a href="controlP5/CDrawable.html" title="interface in controlP5" target="classFrame"><i>CDrawable</i></a></li>
|
||||||
|
<li><a href="controlP5/Chart.html" title="class in controlP5" target="classFrame">Chart</a></li>
|
||||||
|
<li><a href="controlP5/ChartData.html" title="class in controlP5" target="classFrame">ChartData</a></li>
|
||||||
|
<li><a href="controlP5/ChartDataSet.html" title="class in controlP5" target="classFrame">ChartDataSet</a></li>
|
||||||
|
<li><a href="controlP5/CheckBox.html" title="class in controlP5" target="classFrame">CheckBox</a></li>
|
||||||
|
<li><a href="controlP5/ColorPicker.html" title="class in controlP5" target="classFrame">ColorPicker</a></li>
|
||||||
|
<li><a href="controlP5/ColorWheel.html" title="class in controlP5" target="classFrame">ColorWheel</a></li>
|
||||||
|
<li><a href="controlP5/ControlBehavior.html" title="class in controlP5" target="classFrame">ControlBehavior</a></li>
|
||||||
|
<li><a href="controlP5/ControlBroadcaster.html" title="class in controlP5" target="classFrame">ControlBroadcaster</a></li>
|
||||||
|
<li><a href="controlP5/ControlElement.html" title="annotation in controlP5" target="classFrame">ControlElement</a></li>
|
||||||
|
<li><a href="controlP5/ControlEvent.html" title="class in controlP5" target="classFrame">ControlEvent</a></li>
|
||||||
|
<li><a href="controlP5/ControlFont.html" title="class in controlP5" target="classFrame">ControlFont</a></li>
|
||||||
|
<li><a href="controlP5/ControlGroup.html" title="class in controlP5" target="classFrame">ControlGroup</a></li>
|
||||||
|
<li><a href="controlP5/ControlKey.html" title="interface in controlP5" target="classFrame"><i>ControlKey</i></a></li>
|
||||||
|
<li><a href="controlP5/Controller.html" title="class in controlP5" target="classFrame">Controller</a></li>
|
||||||
|
<li><a href="controlP5/ControllerGroup.html" title="class in controlP5" target="classFrame">ControllerGroup</a></li>
|
||||||
|
<li><a href="controlP5/ControllerInterface.html" title="interface in controlP5" target="classFrame"><i>ControllerInterface</i></a></li>
|
||||||
|
<li><a href="controlP5/ControllerList.html" title="class in controlP5" target="classFrame">ControllerList</a></li>
|
||||||
|
<li><a href="controlP5/ControllerPlug.html" title="class in controlP5" target="classFrame">ControllerPlug</a></li>
|
||||||
|
<li><a href="controlP5/ControllerProperties.html" title="class in controlP5" target="classFrame">ControllerProperties</a></li>
|
||||||
|
<li><a href="controlP5/ControllerProperty.html" title="class in controlP5" target="classFrame">ControllerProperty</a></li>
|
||||||
|
<li><a href="controlP5/ControllerStyle.html" title="class in controlP5" target="classFrame">ControllerStyle</a></li>
|
||||||
|
<li><a href="controlP5/ControllerView.html" title="interface in controlP5" target="classFrame"><i>ControllerView</i></a></li>
|
||||||
|
<li><a href="controlP5/ControlListener.html" title="interface in controlP5" target="classFrame"><i>ControlListener</i></a></li>
|
||||||
|
<li><a href="controlP5/ControlP5.html" title="class in controlP5" target="classFrame">ControlP5</a></li>
|
||||||
|
<li><a href="controlP5/ControlP5Base.html" title="class in controlP5" target="classFrame">ControlP5Base</a></li>
|
||||||
|
<li><a href="controlP5/ControlP5Constants.html" title="interface in controlP5" target="classFrame"><i>ControlP5Constants</i></a></li>
|
||||||
|
<li><a href="controlP5/ControlP5Legacy.html" title="class in controlP5" target="classFrame">ControlP5Legacy</a></li>
|
||||||
|
<li><a href="controlP5/ControlTimer.html" title="class in controlP5" target="classFrame">ControlTimer</a></li>
|
||||||
|
<li><a href="controlP5/ControlWindow.html" title="class in controlP5" target="classFrame">ControlWindow</a></li>
|
||||||
|
<li><a href="controlP5/CP.html" title="class in controlP5" target="classFrame">CP</a></li>
|
||||||
|
<li><a href="controlP5/DropdownList.html" title="class in controlP5" target="classFrame">DropdownList</a></li>
|
||||||
|
<li><a href="controlP5/FrameRate.html" title="class in controlP5" target="classFrame">FrameRate</a></li>
|
||||||
|
<li><a href="controlP5/Group.html" title="class in controlP5" target="classFrame">Group</a></li>
|
||||||
|
<li><a href="controlP5/Knob.html" title="class in controlP5" target="classFrame">Knob</a></li>
|
||||||
|
<li><a href="controlP5/Label.html" title="class in controlP5" target="classFrame">Label</a></li>
|
||||||
|
<li><a href="controlP5/ListBox.html" title="class in controlP5" target="classFrame">ListBox</a></li>
|
||||||
|
<li><a href="controlP5/ListBoxItem.html" title="class in controlP5" target="classFrame">ListBoxItem</a></li>
|
||||||
|
<li><a href="controlP5/Matrix.html" title="class in controlP5" target="classFrame">Matrix</a></li>
|
||||||
|
<li><a href="controlP5/MultiList.html" title="class in controlP5" target="classFrame">MultiList</a></li>
|
||||||
|
<li><a href="controlP5/MultiListButton.html" title="class in controlP5" target="classFrame">MultiListButton</a></li>
|
||||||
|
<li><a href="controlP5/Numberbox.html" title="class in controlP5" target="classFrame">Numberbox</a></li>
|
||||||
|
<li><a href="controlP5/Pointer.html" title="interface in controlP5" target="classFrame"><i>Pointer</i></a></li>
|
||||||
|
<li><a href="controlP5/Println.html" title="class in controlP5" target="classFrame">Println</a></li>
|
||||||
|
<li><a href="controlP5/Radio.html" title="class in controlP5" target="classFrame">Radio</a></li>
|
||||||
|
<li><a href="controlP5/RadioButton.html" title="class in controlP5" target="classFrame">RadioButton</a></li>
|
||||||
|
<li><a href="controlP5/Range.html" title="class in controlP5" target="classFrame">Range</a></li>
|
||||||
|
<li><a href="controlP5/ScrollableList.html" title="class in controlP5" target="classFrame">ScrollableList</a></li>
|
||||||
|
<li><a href="controlP5/ScrollableList.ScrollableListView.html" title="class in controlP5" target="classFrame">ScrollableList.ScrollableListView</a></li>
|
||||||
|
<li><a href="controlP5/Slider.html" title="class in controlP5" target="classFrame">Slider</a></li>
|
||||||
|
<li><a href="controlP5/Slider2D.html" title="class in controlP5" target="classFrame">Slider2D</a></li>
|
||||||
|
<li><a href="controlP5/Tab.html" title="class in controlP5" target="classFrame">Tab</a></li>
|
||||||
|
<li><a href="controlP5/Textarea.html" title="class in controlP5" target="classFrame">Textarea</a></li>
|
||||||
|
<li><a href="controlP5/Textfield.html" title="class in controlP5" target="classFrame">Textfield</a></li>
|
||||||
|
<li><a href="controlP5/Textfield.InputFilter.html" title="enum in controlP5" target="classFrame">Textfield.InputFilter</a></li>
|
||||||
|
<li><a href="controlP5/Textlabel.html" title="class in controlP5" target="classFrame">Textlabel</a></li>
|
||||||
|
<li><a href="controlP5/TickMark.html" title="class in controlP5" target="classFrame">TickMark</a></li>
|
||||||
|
<li><a href="controlP5/Toggle.html" title="class in controlP5" target="classFrame">Toggle</a></li>
|
||||||
|
<li><a href="controlP5/Tooltip.html" title="class in controlP5" target="classFrame">Tooltip</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
85
reference/allclasses-noframe.html
Normal file
85
reference/allclasses-noframe.html
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<!-- NewPage -->
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<!-- Generated by javadoc (version 1.7.0_51) on Sun Apr 27 21:39:48 SGT 2014 -->
|
||||||
|
<title>All Classes (Javadocs: controlP5)</title>
|
||||||
|
<meta name="date" content="2014-04-27">
|
||||||
|
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1 class="bar">All Classes</h1>
|
||||||
|
<div class="indexContainer">
|
||||||
|
<ul>
|
||||||
|
<li><a href="controlP5/Accordion.html" title="class in controlP5">Accordion</a></li>
|
||||||
|
<li><a href="controlP5/Bang.html" title="class in controlP5">Bang</a></li>
|
||||||
|
<li><a href="controlP5/BitFont.html" title="class in controlP5">BitFont</a></li>
|
||||||
|
<li><a href="controlP5/BoundingBox.html" title="class in controlP5">BoundingBox</a></li>
|
||||||
|
<li><a href="controlP5/Button.html" title="class in controlP5">Button</a></li>
|
||||||
|
<li><a href="controlP5/CallbackEvent.html" title="class in controlP5">CallbackEvent</a></li>
|
||||||
|
<li><a href="controlP5/CallbackListener.html" title="interface in controlP5"><i>CallbackListener</i></a></li>
|
||||||
|
<li><a href="controlP5/Canvas.html" title="class in controlP5">Canvas</a></li>
|
||||||
|
<li><a href="controlP5/CColor.html" title="class in controlP5">CColor</a></li>
|
||||||
|
<li><a href="controlP5/CDrawable.html" title="interface in controlP5"><i>CDrawable</i></a></li>
|
||||||
|
<li><a href="controlP5/Chart.html" title="class in controlP5">Chart</a></li>
|
||||||
|
<li><a href="controlP5/ChartData.html" title="class in controlP5">ChartData</a></li>
|
||||||
|
<li><a href="controlP5/ChartDataSet.html" title="class in controlP5">ChartDataSet</a></li>
|
||||||
|
<li><a href="controlP5/CheckBox.html" title="class in controlP5">CheckBox</a></li>
|
||||||
|
<li><a href="controlP5/ColorPicker.html" title="class in controlP5">ColorPicker</a></li>
|
||||||
|
<li><a href="controlP5/ColorWheel.html" title="class in controlP5">ColorWheel</a></li>
|
||||||
|
<li><a href="controlP5/ControlBehavior.html" title="class in controlP5">ControlBehavior</a></li>
|
||||||
|
<li><a href="controlP5/ControlBroadcaster.html" title="class in controlP5">ControlBroadcaster</a></li>
|
||||||
|
<li><a href="controlP5/ControlElement.html" title="annotation in controlP5">ControlElement</a></li>
|
||||||
|
<li><a href="controlP5/ControlEvent.html" title="class in controlP5">ControlEvent</a></li>
|
||||||
|
<li><a href="controlP5/ControlFont.html" title="class in controlP5">ControlFont</a></li>
|
||||||
|
<li><a href="controlP5/ControlGroup.html" title="class in controlP5">ControlGroup</a></li>
|
||||||
|
<li><a href="controlP5/ControlKey.html" title="interface in controlP5"><i>ControlKey</i></a></li>
|
||||||
|
<li><a href="controlP5/Controller.html" title="class in controlP5">Controller</a></li>
|
||||||
|
<li><a href="controlP5/ControllerGroup.html" title="class in controlP5">ControllerGroup</a></li>
|
||||||
|
<li><a href="controlP5/ControllerInterface.html" title="interface in controlP5"><i>ControllerInterface</i></a></li>
|
||||||
|
<li><a href="controlP5/ControllerList.html" title="class in controlP5">ControllerList</a></li>
|
||||||
|
<li><a href="controlP5/ControllerPlug.html" title="class in controlP5">ControllerPlug</a></li>
|
||||||
|
<li><a href="controlP5/ControllerProperties.html" title="class in controlP5">ControllerProperties</a></li>
|
||||||
|
<li><a href="controlP5/ControllerProperty.html" title="class in controlP5">ControllerProperty</a></li>
|
||||||
|
<li><a href="controlP5/ControllerStyle.html" title="class in controlP5">ControllerStyle</a></li>
|
||||||
|
<li><a href="controlP5/ControllerView.html" title="interface in controlP5"><i>ControllerView</i></a></li>
|
||||||
|
<li><a href="controlP5/ControlListener.html" title="interface in controlP5"><i>ControlListener</i></a></li>
|
||||||
|
<li><a href="controlP5/ControlP5.html" title="class in controlP5">ControlP5</a></li>
|
||||||
|
<li><a href="controlP5/ControlP5Base.html" title="class in controlP5">ControlP5Base</a></li>
|
||||||
|
<li><a href="controlP5/ControlP5Constants.html" title="interface in controlP5"><i>ControlP5Constants</i></a></li>
|
||||||
|
<li><a href="controlP5/ControlP5Legacy.html" title="class in controlP5">ControlP5Legacy</a></li>
|
||||||
|
<li><a href="controlP5/ControlTimer.html" title="class in controlP5">ControlTimer</a></li>
|
||||||
|
<li><a href="controlP5/ControlWindow.html" title="class in controlP5">ControlWindow</a></li>
|
||||||
|
<li><a href="controlP5/CP.html" title="class in controlP5">CP</a></li>
|
||||||
|
<li><a href="controlP5/DropdownList.html" title="class in controlP5">DropdownList</a></li>
|
||||||
|
<li><a href="controlP5/FrameRate.html" title="class in controlP5">FrameRate</a></li>
|
||||||
|
<li><a href="controlP5/Group.html" title="class in controlP5">Group</a></li>
|
||||||
|
<li><a href="controlP5/Knob.html" title="class in controlP5">Knob</a></li>
|
||||||
|
<li><a href="controlP5/Label.html" title="class in controlP5">Label</a></li>
|
||||||
|
<li><a href="controlP5/ListBox.html" title="class in controlP5">ListBox</a></li>
|
||||||
|
<li><a href="controlP5/ListBoxItem.html" title="class in controlP5">ListBoxItem</a></li>
|
||||||
|
<li><a href="controlP5/Matrix.html" title="class in controlP5">Matrix</a></li>
|
||||||
|
<li><a href="controlP5/MultiList.html" title="class in controlP5">MultiList</a></li>
|
||||||
|
<li><a href="controlP5/MultiListButton.html" title="class in controlP5">MultiListButton</a></li>
|
||||||
|
<li><a href="controlP5/Numberbox.html" title="class in controlP5">Numberbox</a></li>
|
||||||
|
<li><a href="controlP5/Pointer.html" title="interface in controlP5"><i>Pointer</i></a></li>
|
||||||
|
<li><a href="controlP5/Println.html" title="class in controlP5">Println</a></li>
|
||||||
|
<li><a href="controlP5/Radio.html" title="class in controlP5">Radio</a></li>
|
||||||
|
<li><a href="controlP5/RadioButton.html" title="class in controlP5">RadioButton</a></li>
|
||||||
|
<li><a href="controlP5/Range.html" title="class in controlP5">Range</a></li>
|
||||||
|
<li><a href="controlP5/ScrollableList.html" title="class in controlP5">ScrollableList</a></li>
|
||||||
|
<li><a href="controlP5/ScrollableList.ScrollableListView.html" title="class in controlP5">ScrollableList.ScrollableListView</a></li>
|
||||||
|
<li><a href="controlP5/Slider.html" title="class in controlP5">Slider</a></li>
|
||||||
|
<li><a href="controlP5/Slider2D.html" title="class in controlP5">Slider2D</a></li>
|
||||||
|
<li><a href="controlP5/Tab.html" title="class in controlP5">Tab</a></li>
|
||||||
|
<li><a href="controlP5/Textarea.html" title="class in controlP5">Textarea</a></li>
|
||||||
|
<li><a href="controlP5/Textfield.html" title="class in controlP5">Textfield</a></li>
|
||||||
|
<li><a href="controlP5/Textfield.InputFilter.html" title="enum in controlP5">Textfield.InputFilter</a></li>
|
||||||
|
<li><a href="controlP5/Textlabel.html" title="class in controlP5">Textlabel</a></li>
|
||||||
|
<li><a href="controlP5/TickMark.html" title="class in controlP5">TickMark</a></li>
|
||||||
|
<li><a href="controlP5/Toggle.html" title="class in controlP5">Toggle</a></li>
|
||||||
|
<li><a href="controlP5/Tooltip.html" title="class in controlP5">Tooltip</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
1189
reference/constant-values.html
Normal file
1189
reference/constant-values.html
Normal file
File diff suppressed because it is too large
Load Diff
994
reference/controlP5/Accordion.html
Normal file
994
reference/controlP5/Accordion.html
Normal file
File diff suppressed because one or more lines are too long
817
reference/controlP5/Bang.html
Normal file
817
reference/controlP5/Bang.html
Normal file
File diff suppressed because one or more lines are too long
378
reference/controlP5/BitFont.html
Normal file
378
reference/controlP5/BitFont.html
Normal file
@ -0,0 +1,378 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<!-- NewPage -->
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<!-- Generated by javadoc (version 1.7.0_51) on Sun Apr 27 21:39:46 SGT 2014 -->
|
||||||
|
<title>BitFont (Javadocs: controlP5)</title>
|
||||||
|
<meta name="date" content="2014-04-27">
|
||||||
|
<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script type="text/javascript"><!--
|
||||||
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
|
parent.document.title="BitFont (Javadocs: controlP5)";
|
||||||
|
}
|
||||||
|
//-->
|
||||||
|
</script>
|
||||||
|
<noscript>
|
||||||
|
<div>JavaScript is disabled on your browser.</div>
|
||||||
|
</noscript>
|
||||||
|
<!-- ========= START OF TOP NAVBAR ======= -->
|
||||||
|
<div class="topNav"><a name="navbar_top">
|
||||||
|
<!-- -->
|
||||||
|
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="navList" title="Navigation">
|
||||||
|
<li><a href="../controlP5/package-summary.html">Package</a></li>
|
||||||
|
<li class="navBarCell1Rev">Class</li>
|
||||||
|
<li><a href="package-tree.html">Tree</a></li>
|
||||||
|
<li><a href="../index-all.html">Index</a></li>
|
||||||
|
<li><a href="../help-doc.html">Help</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="subNav">
|
||||||
|
<ul class="navList">
|
||||||
|
<li><a href="../controlP5/Bang.html" title="class in controlP5"><span class="strong">Prev Class</span></a></li>
|
||||||
|
<li><a href="../controlP5/BoundingBox.html" title="class in controlP5"><span class="strong">Next Class</span></a></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList">
|
||||||
|
<li><a href="../index.html?controlP5/BitFont.html" target="_top">Frames</a></li>
|
||||||
|
<li><a href="BitFont.html" target="_top">No Frames</a></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList" id="allclasses_navbar_top">
|
||||||
|
<li><a href="../allclasses-noframe.html">All Classes</a></li>
|
||||||
|
</ul>
|
||||||
|
<div>
|
||||||
|
<script type="text/javascript"><!--
|
||||||
|
allClassesLink = document.getElementById("allclasses_navbar_top");
|
||||||
|
if(window==top) {
|
||||||
|
allClassesLink.style.display = "block";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
allClassesLink.style.display = "none";
|
||||||
|
}
|
||||||
|
//-->
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<ul class="subNavList">
|
||||||
|
<li>Summary: </li>
|
||||||
|
<li><a href="#nested_classes_inherited_from_class_processing.core.PFont">Nested</a> | </li>
|
||||||
|
<li><a href="#field_summary">Field</a> | </li>
|
||||||
|
<li><a href="#constructor_summary">Constr</a> | </li>
|
||||||
|
<li><a href="#method_summary">Method</a></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="subNavList">
|
||||||
|
<li>Detail: </li>
|
||||||
|
<li><a href="#field_detail">Field</a> | </li>
|
||||||
|
<li><a href="#constructor_detail">Constr</a> | </li>
|
||||||
|
<li><a href="#method_detail">Method</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<a name="skip-navbar_top">
|
||||||
|
<!-- -->
|
||||||
|
</a></div>
|
||||||
|
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||||
|
<!-- ======== START OF CLASS DATA ======== -->
|
||||||
|
<div class="header">
|
||||||
|
<div class="subTitle">controlP5</div>
|
||||||
|
<h2 title="Class BitFont" class="title">Class BitFont</h2>
|
||||||
|
</div>
|
||||||
|
<div class="contentContainer">
|
||||||
|
<ul class="inheritance">
|
||||||
|
<li>java.lang.Object</li>
|
||||||
|
<li>
|
||||||
|
<ul class="inheritance">
|
||||||
|
<li>processing.core.PFont</li>
|
||||||
|
<li>
|
||||||
|
<ul class="inheritance">
|
||||||
|
<li>controlP5.BitFont</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<div class="description">
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<dl>
|
||||||
|
<dt>All Implemented Interfaces:</dt>
|
||||||
|
<dd>processing.core.PConstants</dd>
|
||||||
|
</dl>
|
||||||
|
<hr>
|
||||||
|
<br>
|
||||||
|
<pre>public class <span class="strong">BitFont</span>
|
||||||
|
extends processing.core.PFont</pre>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="summary">
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<!-- ======== NESTED CLASS SUMMARY ======== -->
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList"><a name="nested_class_summary">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<h3>Nested Class Summary</h3>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList"><a name="nested_classes_inherited_from_class_processing.core.PFont">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<h3>Nested classes/interfaces inherited from class processing.core.PFont</h3>
|
||||||
|
<code>processing.core.PFont.Glyph</code></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<!-- =========== FIELD SUMMARY =========== -->
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList"><a name="field_summary">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<h3>Field Summary</h3>
|
||||||
|
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
|
||||||
|
<caption><span>Fields</span><span class="tabEnd"> </span></caption>
|
||||||
|
<tr>
|
||||||
|
<th class="colFirst" scope="col">Modifier and Type</th>
|
||||||
|
<th class="colLast" scope="col">Field and Description</th>
|
||||||
|
</tr>
|
||||||
|
<tr class="altColor">
|
||||||
|
<td class="colFirst"><code>static int</code></td>
|
||||||
|
<td class="colLast"><code><strong><a href="../controlP5/BitFont.html#defaultChar">defaultChar</a></strong></code> </td>
|
||||||
|
</tr>
|
||||||
|
<tr class="rowColor">
|
||||||
|
<td class="colFirst"><code>static java.lang.String</code></td>
|
||||||
|
<td class="colLast"><code><strong><a href="../controlP5/BitFont.html#grixelbase64">grixelbase64</a></strong></code> </td>
|
||||||
|
</tr>
|
||||||
|
<tr class="altColor">
|
||||||
|
<td class="colFirst"><code>static java.lang.String</code></td>
|
||||||
|
<td class="colLast"><code><strong><a href="../controlP5/BitFont.html#standard56base64">standard56base64</a></strong></code> </td>
|
||||||
|
</tr>
|
||||||
|
<tr class="rowColor">
|
||||||
|
<td class="colFirst"><code>static java.lang.String</code></td>
|
||||||
|
<td class="colLast"><code><strong><a href="../controlP5/BitFont.html#standard58base64">standard58base64</a></strong></code> </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList"><a name="fields_inherited_from_class_processing.core.PFont">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<h3>Fields inherited from class processing.core.PFont</h3>
|
||||||
|
<code>CHARSET</code></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList"><a name="fields_inherited_from_class_processing.core.PConstants">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<h3>Fields inherited from interface processing.core.PConstants</h3>
|
||||||
|
<code>ADD, ALPHA, ALT, AMBIENT, ARC, ARGB, ARROW, BACKSPACE, BASELINE, BEVEL, BEZIER_VERTEX, BLEND, BLUR, BOTTOM, BOX, BREAK, BURN, CENTER, CHATTER, CHORD, CLAMP, CLOSE, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CURVE_VERTEX, CUSTOM, DARKEST, DEG_TO_RAD, DELETE, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_DEPTH_MASK, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_NATIVE_FONTS, DISABLE_OPENGL_ERRORS, DISABLE_OPTIMIZED_STROKE, DISABLE_RETINA_PIXELS, DISABLE_STROKE_PERSPECTIVE, DISABLE_STROKE_PURE, DISABLE_TEXTURE_MIPMAPS, DODGE, DOWN, DXF, ELLIPSE, ENABLE_DEPTH_MASK, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_ERRORS, ENABLE_OPTIMIZED_STROKE, ENABLE_RETINA_PIXELS, ENABLE_STROKE_PERSPECTIVE, ENABLE_STROKE_PURE, ENABLE_TEXTURE_MIPMAPS, ENTER, EPSILON, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, GIF, GRAY, GROUP, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LANDSCAPE, LEFT, LIGHTEST, LINE, LINE_LOOP, LINE_STRIP, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MODELVIEW, MOVE, MULTIPLY, NORMAL, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, PIE, platformNames, POINT, POINTS, POLYGON, PORTRAIT, POSTERIZE, PROBLEM, PROJECT, PROJECTION, QUAD, QUAD_BEZIER_VERTEX, QUAD_STRIP, QUADS, QUARTER_PI, RAD_TO_DEG, RADIUS, RECT, REPEAT, REPLACE, RETURN, RGB, RIGHT, ROUND, SCREEN, SHAPE, SHIFT, SOFT_LIGHT, SPHERE, SPOT, SQUARE, SUBTRACT, TAB, TARGA, TAU, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, UP, VERTEX, WAIT, WHITESPACE, WINDOWS, X, Y, Z</code></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList"><a name="constructor_summary">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<h3>Constructor Summary</h3>
|
||||||
|
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
|
||||||
|
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
|
||||||
|
<tr>
|
||||||
|
<th class="colOne" scope="col">Constructor and Description</th>
|
||||||
|
</tr>
|
||||||
|
<tr class="altColor">
|
||||||
|
<td class="colOne"><code><strong><a href="../controlP5/BitFont.html#BitFont(byte[])">BitFont</a></strong>(byte[] theBytes)</code> </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<!-- ========== METHOD SUMMARY =========== -->
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList"><a name="method_summary">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<h3>Method Summary</h3>
|
||||||
|
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
|
||||||
|
<caption><span>Methods</span><span class="tabEnd"> </span></caption>
|
||||||
|
<tr>
|
||||||
|
<th class="colFirst" scope="col">Modifier and Type</th>
|
||||||
|
<th class="colLast" scope="col">Method and Description</th>
|
||||||
|
</tr>
|
||||||
|
<tr class="altColor">
|
||||||
|
<td class="colFirst"><code>processing.core.PFont.Glyph</code></td>
|
||||||
|
<td class="colLast"><code><strong><a href="../controlP5/BitFont.html#getGlyph(char)">getGlyph</a></strong>(char c)</code> </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList"><a name="methods_inherited_from_class_processing.core.PFont">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<h3>Methods inherited from class processing.core.PFont</h3>
|
||||||
|
<code>ascent, descent, findFont, findNative, getFont, getGlyph, getGlyphCount, getName, getNative, getPostScriptName, getSize, isStream, kern, list, loadFonts, save, setNative, setSubsetting, width</code></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<h3>Methods inherited from class java.lang.Object</h3>
|
||||||
|
<code>equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="details">
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<!-- ============ FIELD DETAIL =========== -->
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList"><a name="field_detail">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<h3>Field Detail</h3>
|
||||||
|
<a name="defaultChar">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>defaultChar</h4>
|
||||||
|
<pre>public static int defaultChar</pre>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<a name="grixelbase64">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>grixelbase64</h4>
|
||||||
|
<pre>public static final java.lang.String grixelbase64</pre>
|
||||||
|
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../constant-values.html#controlP5.BitFont.grixelbase64">Constant Field Values</a></dd></dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<a name="standard56base64">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>standard56base64</h4>
|
||||||
|
<pre>public static final java.lang.String standard56base64</pre>
|
||||||
|
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../constant-values.html#controlP5.BitFont.standard56base64">Constant Field Values</a></dd></dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<a name="standard58base64">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="blockListLast">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>standard58base64</h4>
|
||||||
|
<pre>public static final java.lang.String standard58base64</pre>
|
||||||
|
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../constant-values.html#controlP5.BitFont.standard58base64">Constant Field Values</a></dd></dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<!-- ========= CONSTRUCTOR DETAIL ======== -->
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList"><a name="constructor_detail">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<h3>Constructor Detail</h3>
|
||||||
|
<a name="BitFont(byte[])">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="blockListLast">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>BitFont</h4>
|
||||||
|
<pre>public BitFont(byte[] theBytes)</pre>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<!-- ============ METHOD DETAIL ========== -->
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList"><a name="method_detail">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<h3>Method Detail</h3>
|
||||||
|
<a name="getGlyph(char)">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="blockListLast">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>getGlyph</h4>
|
||||||
|
<pre>public processing.core.PFont.Glyph getGlyph(char c)</pre>
|
||||||
|
<dl>
|
||||||
|
<dt><strong>Overrides:</strong></dt>
|
||||||
|
<dd><code>getGlyph</code> in class <code>processing.core.PFont</code></dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- ========= END OF CLASS DATA ========= -->
|
||||||
|
<!-- ======= START OF BOTTOM NAVBAR ====== -->
|
||||||
|
<div class="bottomNav"><a name="navbar_bottom">
|
||||||
|
<!-- -->
|
||||||
|
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="navList" title="Navigation">
|
||||||
|
<li><a href="../controlP5/package-summary.html">Package</a></li>
|
||||||
|
<li class="navBarCell1Rev">Class</li>
|
||||||
|
<li><a href="package-tree.html">Tree</a></li>
|
||||||
|
<li><a href="../index-all.html">Index</a></li>
|
||||||
|
<li><a href="../help-doc.html">Help</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="subNav">
|
||||||
|
<ul class="navList">
|
||||||
|
<li><a href="../controlP5/Bang.html" title="class in controlP5"><span class="strong">Prev Class</span></a></li>
|
||||||
|
<li><a href="../controlP5/BoundingBox.html" title="class in controlP5"><span class="strong">Next Class</span></a></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList">
|
||||||
|
<li><a href="../index.html?controlP5/BitFont.html" target="_top">Frames</a></li>
|
||||||
|
<li><a href="BitFont.html" target="_top">No Frames</a></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList" id="allclasses_navbar_bottom">
|
||||||
|
<li><a href="../allclasses-noframe.html">All Classes</a></li>
|
||||||
|
</ul>
|
||||||
|
<div>
|
||||||
|
<script type="text/javascript"><!--
|
||||||
|
allClassesLink = document.getElementById("allclasses_navbar_bottom");
|
||||||
|
if(window==top) {
|
||||||
|
allClassesLink.style.display = "block";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
allClassesLink.style.display = "none";
|
||||||
|
}
|
||||||
|
//-->
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<ul class="subNavList">
|
||||||
|
<li>Summary: </li>
|
||||||
|
<li><a href="#nested_classes_inherited_from_class_processing.core.PFont">Nested</a> | </li>
|
||||||
|
<li><a href="#field_summary">Field</a> | </li>
|
||||||
|
<li><a href="#constructor_summary">Constr</a> | </li>
|
||||||
|
<li><a href="#method_summary">Method</a></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="subNavList">
|
||||||
|
<li>Detail: </li>
|
||||||
|
<li><a href="#field_detail">Field</a> | </li>
|
||||||
|
<li><a href="#constructor_detail">Constr</a> | </li>
|
||||||
|
<li><a href="#method_detail">Method</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<a name="skip-navbar_bottom">
|
||||||
|
<!-- -->
|
||||||
|
</a></div>
|
||||||
|
<!-- ======== END OF BOTTOM NAVBAR ======= -->
|
||||||
|
<p class="legalCopy"><small>processing library controlP5 by Andreas Schlegel. (c) 2006-2014</small></p>
|
||||||
|
</body>
|
||||||
|
</html>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user