├── .classpath ├── .gitignore ├── .project ├── .settings ├── org.eclipse.jdt.core.prefs └── org.eclipse.jdt.ui.prefs ├── .tutorial-embed-lua-classpath ├── README.md ├── lib ├── gdx-backend-lwjgl-natives.jar ├── gdx-backend-lwjgl.jar ├── gdx-natives.jar ├── gdx.jar └── luaj-jse-3.0-alpha2.jar ├── scripts └── tumbler.lua └── src └── com └── laex ├── IScript.java ├── LuaScriptManager.java ├── MyGdxGame.java └── MyGdxGameDesktop.java /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.class 3 | *.swp 4 | bin/* 5 | 6 | # Package Files # 7 | *.war 8 | *.ear 9 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Embed-Lua-Java-Box2D 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.codeComplete.argumentPrefixes= 3 | org.eclipse.jdt.core.codeComplete.argumentSuffixes= 4 | org.eclipse.jdt.core.codeComplete.fieldPrefixes= 5 | org.eclipse.jdt.core.codeComplete.fieldSuffixes= 6 | org.eclipse.jdt.core.codeComplete.localPrefixes= 7 | org.eclipse.jdt.core.codeComplete.localSuffixes= 8 | org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= 9 | org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= 10 | org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= 11 | org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= 12 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 13 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 14 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 15 | org.eclipse.jdt.core.compiler.compliance=1.6 16 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 17 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 18 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 19 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 20 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 21 | org.eclipse.jdt.core.compiler.source=1.6 22 | org.eclipse.jdt.core.formatter.align_type_members_on_columns=false 23 | org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 24 | org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 25 | org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 26 | org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 27 | org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 28 | org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 29 | org.eclipse.jdt.core.formatter.alignment_for_assignment=0 30 | org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 31 | org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 32 | org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 33 | org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 34 | org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 35 | org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 36 | org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 37 | org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 38 | org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 39 | org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 40 | org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 41 | org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 42 | org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 43 | org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 44 | org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 45 | org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 46 | org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 47 | org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 48 | org.eclipse.jdt.core.formatter.blank_lines_after_package=1 49 | org.eclipse.jdt.core.formatter.blank_lines_before_field=0 50 | org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 51 | org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 52 | org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 53 | org.eclipse.jdt.core.formatter.blank_lines_before_method=1 54 | org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 55 | org.eclipse.jdt.core.formatter.blank_lines_before_package=0 56 | org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 57 | org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 58 | org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line 59 | org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line 60 | org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line 61 | org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line 62 | org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line 63 | org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line 64 | org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line 65 | org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line 66 | org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line 67 | org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line 68 | org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line 69 | org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false 70 | org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false 71 | org.eclipse.jdt.core.formatter.comment.format_block_comments=true 72 | org.eclipse.jdt.core.formatter.comment.format_header=false 73 | org.eclipse.jdt.core.formatter.comment.format_html=true 74 | org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true 75 | org.eclipse.jdt.core.formatter.comment.format_line_comments=true 76 | org.eclipse.jdt.core.formatter.comment.format_source_code=true 77 | org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true 78 | org.eclipse.jdt.core.formatter.comment.indent_root_tags=true 79 | org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert 80 | org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert 81 | org.eclipse.jdt.core.formatter.comment.line_length=80 82 | org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true 83 | org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true 84 | org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false 85 | org.eclipse.jdt.core.formatter.compact_else_if=true 86 | org.eclipse.jdt.core.formatter.continuation_indentation=2 87 | org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 88 | org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off 89 | org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on 90 | org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false 91 | org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true 92 | org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true 93 | org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true 94 | org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true 95 | org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true 96 | org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true 97 | org.eclipse.jdt.core.formatter.indent_empty_lines=false 98 | org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true 99 | org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true 100 | org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true 101 | org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false 102 | org.eclipse.jdt.core.formatter.indentation.size=4 103 | org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert 104 | org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert 105 | org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert 106 | org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert 107 | org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert 108 | org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert 109 | org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert 110 | org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert 111 | org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert 112 | org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert 113 | org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert 114 | org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert 115 | org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert 116 | org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert 117 | org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert 118 | org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert 119 | org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert 120 | org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert 121 | org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert 122 | org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert 123 | org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert 124 | org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert 125 | org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert 126 | org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert 127 | org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert 128 | org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert 129 | org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert 130 | org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert 131 | org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert 132 | org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert 133 | org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert 134 | org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert 135 | org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert 136 | org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert 137 | org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert 138 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert 139 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert 140 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert 141 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert 142 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert 143 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert 144 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert 145 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert 146 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert 147 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert 148 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert 149 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert 150 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert 151 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert 152 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert 153 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert 154 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert 155 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert 156 | org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert 157 | org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert 158 | org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert 159 | org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert 160 | org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert 161 | org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert 162 | org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert 163 | org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert 164 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert 165 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert 166 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert 167 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert 168 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert 169 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert 170 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert 171 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert 172 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert 173 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert 174 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert 175 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert 176 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert 177 | org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert 178 | org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert 179 | org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert 180 | org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert 181 | org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert 182 | org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert 183 | org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert 184 | org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert 185 | org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert 186 | org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert 187 | org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert 188 | org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert 189 | org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert 190 | org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert 191 | org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert 192 | org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert 193 | org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert 194 | org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert 195 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert 196 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert 197 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert 198 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert 199 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert 200 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert 201 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert 202 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert 203 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert 204 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert 205 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert 206 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert 207 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert 208 | org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert 209 | org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert 210 | org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert 211 | org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert 212 | org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert 213 | org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert 214 | org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert 215 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert 216 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert 217 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert 218 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert 219 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert 220 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert 221 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert 222 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert 223 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert 224 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert 225 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert 226 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert 227 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert 228 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert 229 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert 230 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert 231 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert 232 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert 233 | org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert 234 | org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert 235 | org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert 236 | org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert 237 | org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert 238 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert 239 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert 240 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert 241 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert 242 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert 243 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert 244 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert 245 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert 246 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert 247 | org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert 248 | org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert 249 | org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert 250 | org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert 251 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert 252 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert 253 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert 254 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert 255 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert 256 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert 257 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert 258 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert 259 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert 260 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert 261 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert 262 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert 263 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert 264 | org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert 265 | org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert 266 | org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert 267 | org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert 268 | org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert 269 | org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert 270 | org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert 271 | org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert 272 | org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert 273 | org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert 274 | org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert 275 | org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert 276 | org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert 277 | org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert 278 | org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert 279 | org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert 280 | org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert 281 | org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert 282 | org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert 283 | org.eclipse.jdt.core.formatter.join_lines_in_comments=true 284 | org.eclipse.jdt.core.formatter.join_wrapped_lines=true 285 | org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false 286 | org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false 287 | org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false 288 | org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false 289 | org.eclipse.jdt.core.formatter.lineSplit=80 290 | org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false 291 | org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false 292 | org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 293 | org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 294 | org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true 295 | org.eclipse.jdt.core.formatter.tabulation.char=space 296 | org.eclipse.jdt.core.formatter.tabulation.size=4 297 | org.eclipse.jdt.core.formatter.use_on_off_tags=false 298 | org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true 299 | org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true 300 | org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true 301 | org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true 302 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.ui.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | formatter_profile=_formatter 3 | formatter_settings_version=12 4 | org.eclipse.jdt.ui.exception.name=e 5 | org.eclipse.jdt.ui.gettersetter.use.is=true 6 | org.eclipse.jdt.ui.keywordthis=false 7 | org.eclipse.jdt.ui.overrideannotation=true 8 | -------------------------------------------------------------------------------- /.tutorial-embed-lua-classpath: -------------------------------------------------------------------------------- 1 | # 2 | #Tue Mar 05 22:19:23 EST 2013 3 | /Volumes/MyFiles/Projects/Libraries/libgdx-0.9.7/gdx.jar= 4 | /Volumes/MyFiles/Projects/Libraries/libgdx-0.9.7/gdx-backend-lwjgl-natives.jar= 5 | /Volumes/MyFiles/Projects/Libraries/libgdx-0.9.7/gdx-backend-lwjgl.jar= 6 | /Volumes/MyFiles/Projects/WS/MyWS/tutorial-embed-lua/src= 7 | /Volumes/MyFiles/Projects/WS/MyWS/Laexian_Box2D_Editor/luaj-3.0-alpha/luaj-jse-3.0-alpha2.jar= 8 | /Volumes/MyFiles/Projects/Libraries/libgdx-0.9.7/gdx-natives.jar= 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Embed-Lua-Java-Box2D 2 | ==================== 3 | 4 | Tutorial - How to embed Lua in Java. Example with LibGDX and Box2D. 5 | 6 | http://hemantasapkota.github.io/posts/tutorial-embed-lua-in-java-w-libgdx-and-box2d/ 7 | -------------------------------------------------------------------------------- /lib/gdx-backend-lwjgl-natives.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hemantasapkota/Embed-Lua-Java-Box2D/f424abb0b24748b7fa8e72c2a084034ee0d8482d/lib/gdx-backend-lwjgl-natives.jar -------------------------------------------------------------------------------- /lib/gdx-backend-lwjgl.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hemantasapkota/Embed-Lua-Java-Box2D/f424abb0b24748b7fa8e72c2a084034ee0d8482d/lib/gdx-backend-lwjgl.jar -------------------------------------------------------------------------------- /lib/gdx-natives.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hemantasapkota/Embed-Lua-Java-Box2D/f424abb0b24748b7fa8e72c2a084034ee0d8482d/lib/gdx-natives.jar -------------------------------------------------------------------------------- /lib/gdx.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hemantasapkota/Embed-Lua-Java-Box2D/f424abb0b24748b7fa8e72c2a084034ee0d8482d/lib/gdx.jar -------------------------------------------------------------------------------- /lib/luaj-jse-3.0-alpha2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hemantasapkota/Embed-Lua-Java-Box2D/f424abb0b24748b7fa8e72c2a084034ee0d8482d/lib/luaj-jse-3.0-alpha2.jar -------------------------------------------------------------------------------- /scripts/tumbler.lua: -------------------------------------------------------------------------------- 1 | function init(world, cam) 2 | end 3 | 4 | function keyPressed(world, cam, body, joint, key) 5 | if key == "Right" then 6 | cam:translate(0.5, 0, 0) 7 | end 8 | 9 | if key == "Left" then 10 | cam:translate(-0.5, 0, 0) 11 | end 12 | 13 | if key == "A" then 14 | joint:setMotorSpeed(1) 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /src/com/laex/IScript.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012, 2013 Hemanta Sapkota. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * Hemanta Sapkota (laex.pearl@gmail.com) 10 | * http://hsapkota.com.au 11 | */ 12 | package com.laex; 13 | 14 | import com.badlogic.gdx.physics.box2d.Body; 15 | import com.badlogic.gdx.physics.box2d.Joint; 16 | 17 | 18 | /** 19 | * The Interface IScript. 20 | */ 21 | public interface IScript { 22 | 23 | /** 24 | * Can execute. 25 | * 26 | * @return true, if successful 27 | */ 28 | boolean canExecute(); 29 | 30 | /** 31 | * Execute init. 32 | */ 33 | void executeInit(); 34 | 35 | /** 36 | * Execute key pressed. 37 | * 38 | * @param key the key 39 | * @param body the body 40 | * @param joint the joint 41 | */ 42 | void executeKeyPressed(String key, Body body, Joint joint); 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/com/laex/LuaScriptManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012, 2013 Hemanta Sapkota. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * Hemanta Sapkota (laex.pearl@gmail.com) 10 | * http://hsapkota.com.au 11 | */ 12 | package com.laex; 13 | 14 | import org.luaj.vm2.Globals; 15 | import org.luaj.vm2.LuaValue; 16 | import org.luaj.vm2.lib.jse.CoerceJavaToLua; 17 | import org.luaj.vm2.lib.jse.JsePlatform; 18 | 19 | import com.badlogic.gdx.Gdx; 20 | import com.badlogic.gdx.graphics.Camera; 21 | import com.badlogic.gdx.physics.box2d.Body; 22 | import com.badlogic.gdx.physics.box2d.Joint; 23 | import com.badlogic.gdx.physics.box2d.World; 24 | 25 | /** 26 | * The Class LuaScriptManager. 27 | */ 28 | public class LuaScriptManager implements IScript { 29 | 30 | /** The globals. */ 31 | private Globals globals = JsePlatform.standardGlobals(); 32 | 33 | /** The chunk. */ 34 | private LuaValue chunk; 35 | 36 | /** The script file exists. */ 37 | private boolean scriptFileExists; 38 | 39 | /** The world. */ 40 | private World world; 41 | 42 | /** The cam. */ 43 | private Camera cam; 44 | 45 | /** 46 | * Instantiates a new lua script manager. 47 | * 48 | * @param world the world 49 | * @param cam the cam 50 | * @param scriptFileName the script file name 51 | */ 52 | public LuaScriptManager(World world, Camera cam, String scriptFileName) { 53 | this.world = world; 54 | this.cam = cam; 55 | 56 | if (!Gdx.files.internal(scriptFileName).exists()) { 57 | scriptFileExists = false; 58 | return; 59 | } else { 60 | scriptFileExists = true; 61 | } 62 | 63 | chunk = globals.loadFile(scriptFileName); 64 | 65 | // very important step. subsequent calls to script method do not work if the 66 | // chunk 67 | // is not called here 68 | chunk.call(); 69 | 70 | } 71 | 72 | /* (non-Javadoc) 73 | * @see com.laex.IScript#canExecute() 74 | */ 75 | @Override 76 | public boolean canExecute() { 77 | return scriptFileExists; 78 | } 79 | 80 | /* (non-Javadoc) 81 | * @see com.laex.IScript#executeInit() 82 | */ 83 | @Override 84 | public void executeInit() { 85 | if (!canExecute()) { 86 | return; 87 | } 88 | 89 | globals.get("init").invoke( 90 | new LuaValue[] { CoerceJavaToLua.coerce(world), 91 | CoerceJavaToLua.coerce(cam) }); 92 | } 93 | 94 | /* (non-Javadoc) 95 | * @see com.laex.IScript#executeKeyPressed(java.lang.String, com.badlogic.gdx.physics.box2d.Body, com.badlogic.gdx.physics.box2d.Joint) 96 | */ 97 | @Override 98 | public void executeKeyPressed(String key, Body body, Joint joint) { 99 | if (!canExecute()) { 100 | return; 101 | } 102 | 103 | globals.get("keyPressed").invoke( 104 | new LuaValue[] { CoerceJavaToLua.coerce(world), 105 | CoerceJavaToLua.coerce(cam), 106 | CoerceJavaToLua.coerce(body), 107 | CoerceJavaToLua.coerce(joint), LuaValue.valueOf(key) }); 108 | } 109 | 110 | } 111 | -------------------------------------------------------------------------------- /src/com/laex/MyGdxGame.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012, 2013 Hemanta Sapkota. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * Hemanta Sapkota (laex.pearl@gmail.com) 10 | * http://hsapkota.com.au 11 | */ 12 | package com.laex; 13 | 14 | import com.badlogic.gdx.ApplicationAdapter; 15 | import com.badlogic.gdx.Gdx; 16 | import com.badlogic.gdx.Input.Keys; 17 | import com.badlogic.gdx.graphics.GL10; 18 | import com.badlogic.gdx.graphics.OrthographicCamera; 19 | import com.badlogic.gdx.math.MathUtils; 20 | import com.badlogic.gdx.math.Vector2; 21 | import com.badlogic.gdx.physics.box2d.Body; 22 | import com.badlogic.gdx.physics.box2d.BodyDef; 23 | import com.badlogic.gdx.physics.box2d.BodyDef.BodyType; 24 | import com.badlogic.gdx.physics.box2d.Box2DDebugRenderer; 25 | import com.badlogic.gdx.physics.box2d.Joint; 26 | import com.badlogic.gdx.physics.box2d.PolygonShape; 27 | import com.badlogic.gdx.physics.box2d.World; 28 | import com.badlogic.gdx.physics.box2d.joints.RevoluteJointDef; 29 | 30 | /** 31 | * The Class MyGdxGame. 32 | */ 33 | public class MyGdxGame extends ApplicationAdapter { 34 | 35 | /** The debug draw. */ 36 | private Box2DDebugRenderer debugDraw; 37 | 38 | /** The world. */ 39 | private World world; 40 | 41 | /** The cam. */ 42 | private OrthographicCamera cam; 43 | 44 | /** The ground. */ 45 | private Body ground; 46 | 47 | /** The joint. */ 48 | private Joint joint; 49 | 50 | /** The script manager. */ 51 | private LuaScriptManager scriptManager; 52 | 53 | /** The body. */ 54 | private Body body; 55 | 56 | /* 57 | * (non-Javadoc) 58 | * 59 | * @see com.badlogic.gdx.ApplicationAdapter#create() 60 | */ 61 | @Override 62 | public void create() { 63 | // Set up world and debug draw 64 | Vector2 gravity = new Vector2(0, -9); 65 | world = new World(gravity, true); 66 | debugDraw = new Box2DDebugRenderer(); 67 | 68 | float w = Gdx.graphics.getWidth(); 69 | float h = Gdx.graphics.getHeight(); 70 | 71 | // set up orthographic camera 72 | cam = new OrthographicCamera(w / 10, h / 10); 73 | cam.position.set(cam.viewportWidth / 2, cam.viewportHeight / 2, 0); 74 | 75 | // Our LuaScriptManager. We'll talk about this in a while. 76 | scriptManager = new LuaScriptManager( 77 | world, 78 | cam, 79 | "scripts/tumbler.lua"); 80 | 81 | // Create Box2D physics objcets 82 | createBodies(); 83 | 84 | // Call script manager init(). This method is only called once for each script. 85 | scriptManager.executeInit(); 86 | } 87 | 88 | /** 89 | * Creates the bodies. 90 | */ 91 | private void createBodies() { 92 | // this part of box2d code is taken from Tumbler test from Box2D Source 93 | { 94 | BodyDef bodyDef = new BodyDef(); 95 | ground = world.createBody(bodyDef); 96 | } 97 | 98 | { 99 | BodyDef bodyDef = new BodyDef(); 100 | bodyDef.type = BodyType.DynamicBody; 101 | bodyDef.allowSleep = true; 102 | bodyDef.position.set(0.0f, 0.0f); 103 | body = world.createBody(bodyDef); 104 | 105 | PolygonShape shape = new PolygonShape(); 106 | 107 | shape.setAsBox(0.5f, 10.0f, new Vector2(5.0f, 0.0f), 0.0f); 108 | body.createFixture(shape, 5.0f); 109 | 110 | shape.setAsBox(0.5f, 10.0f, new Vector2(-5.0f, 0.0f), 0.0f); 111 | body.createFixture(shape, 5.0f); 112 | 113 | shape.setAsBox(10.0f, 0.5f, new Vector2(0.0f, 5.0f), 0.0f); 114 | body.createFixture(shape, 5.0f); 115 | 116 | shape.setAsBox(10.0f, 0.5f, new Vector2(0.0f, -5.0f), 0.0f); 117 | body.createFixture(shape, 5.0f); 118 | 119 | RevoluteJointDef rjd = new RevoluteJointDef(); 120 | rjd.bodyA = ground; 121 | rjd.bodyB = body; 122 | rjd.localAnchorA.set(0.0f, 10.0f); 123 | rjd.localAnchorB.set(0.0f, 0.0f); 124 | rjd.referenceAngle = 0.0f; 125 | rjd.motorSpeed = 0.05f * MathUtils.PI; 126 | rjd.maxMotorTorque = 1e8f; 127 | rjd.enableMotor = true; 128 | joint = world.createJoint(rjd); 129 | 130 | } 131 | 132 | } 133 | 134 | /* 135 | * (non-Javadoc) 136 | * 137 | * @see com.badlogic.gdx.ApplicationAdapter#render() 138 | */ 139 | @Override 140 | public void render() { 141 | Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); 142 | 143 | cam.update(); 144 | cam.apply(Gdx.graphics.getGL10()); 145 | 146 | debugDraw.render(world, cam.combined); 147 | world.step(1 / 60f, 100, 100); 148 | 149 | if (Gdx.input.isKeyPressed(Keys.RIGHT)) { 150 | scriptManager.executeKeyPressed("Right", body, joint); 151 | } else if (Gdx.input.isKeyPressed(Keys.LEFT)) { 152 | scriptManager.executeKeyPressed("Left", body, joint); 153 | } else if (Gdx.input.isKeyPressed(Keys.A)) { 154 | scriptManager.executeKeyPressed("A", body, joint); 155 | } 156 | } 157 | 158 | /* 159 | * (non-Javadoc) 160 | * 161 | * @see com.badlogic.gdx.ApplicationAdapter#dispose() 162 | */ 163 | @Override 164 | public void dispose() { 165 | super.dispose(); 166 | } 167 | 168 | } 169 | -------------------------------------------------------------------------------- /src/com/laex/MyGdxGameDesktop.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012, 2013 Hemanta Sapkota. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * Hemanta Sapkota (laex.pearl@gmail.com) 10 | * http://hsapkota.com.au 11 | */ 12 | package com.laex; 13 | 14 | import com.badlogic.gdx.backends.lwjgl.LwjglApplication; 15 | import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; 16 | import com.badlogic.gdx.utils.GdxNativesLoader; 17 | 18 | /** 19 | * The Class MyGdxGameDesktop. 20 | */ 21 | public class MyGdxGameDesktop { 22 | 23 | /** 24 | * The main method. 25 | * 26 | * @param args the arguments 27 | */ 28 | public static void main(String[] args) { 29 | LwjglApplicationConfiguration lwapp = new LwjglApplicationConfiguration(); 30 | lwapp.width = 480; 31 | lwapp.height = 320; 32 | lwapp.title = "Embed-Lua-Java-Tutorial"; 33 | 34 | GdxNativesLoader.load(); 35 | 36 | new LwjglApplication(new MyGdxGame(), lwapp); 37 | } 38 | 39 | } 40 | --------------------------------------------------------------------------------