docs
BIN
_downloads/0f77439a03c9c1eb57dab630d028b82d/instancing.zip
Normal file
BIN
_downloads/411d24b75fb71e4ae65083a28435826d/gBot_pieces.png
Normal file
After Width: | Height: | Size: 477 KiB |
BIN
_downloads/517017c514e6f170e33c06253ef7b39f/gridmap_demo.zip
Normal file
BIN
_downloads/6fe29990d33f1ef691b4a97f8e81b081/class_tree.zip
Normal file
BIN
_downloads/7c9bde383c09d42382be303c12eb4b10/gBot_complete.png
Normal file
After Width: | Height: | Size: 316 KiB |
BIN
_downloads/8b5024c070740230baeec94ce983e525/2D_movement_demo.zip
Normal file
BIN
_downloads/8bf979dd497cbe4450a6295fea32df17/run_animation.zip
Normal file
BIN
_downloads/923b18d4e18125cf494ee5f7efba7e03/dodge_assets.zip
Normal file
109
_downloads/988fdf9bf1fed6991e760aadf423d3df/SConstruct
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
#!python
|
||||||
|
import os
|
||||||
|
|
||||||
|
opts = Variables([], ARGUMENTS)
|
||||||
|
|
||||||
|
# Gets the standard flags CC, CCX, etc.
|
||||||
|
env = DefaultEnvironment()
|
||||||
|
|
||||||
|
# Define our options
|
||||||
|
opts.Add(EnumVariable('target', "Compilation target", 'debug', ['d', 'debug', 'r', 'release']))
|
||||||
|
opts.Add(EnumVariable('platform', "Compilation platform", '', ['', 'windows', 'x11', 'linux', 'osx']))
|
||||||
|
opts.Add(EnumVariable('p', "Compilation target, alias for 'platform'", '', ['', 'windows', 'x11', 'linux', 'osx']))
|
||||||
|
opts.Add(BoolVariable('use_llvm', "Use the LLVM / Clang compiler", 'no'))
|
||||||
|
opts.Add(PathVariable('target_path', 'The path where the lib is installed.', 'demo/bin/'))
|
||||||
|
opts.Add(PathVariable('target_name', 'The library name.', 'libgdexample', PathVariable.PathAccept))
|
||||||
|
|
||||||
|
# Local dependency paths, adapt them to your setup
|
||||||
|
godot_headers_path = "godot-cpp/godot-headers/"
|
||||||
|
cpp_bindings_path = "godot-cpp/"
|
||||||
|
cpp_library = "libgodot-cpp"
|
||||||
|
|
||||||
|
# only support 64 at this time..
|
||||||
|
bits = 64
|
||||||
|
|
||||||
|
# Updates the environment with the option variables.
|
||||||
|
opts.Update(env)
|
||||||
|
|
||||||
|
# Process some arguments
|
||||||
|
if env['use_llvm']:
|
||||||
|
env['CC'] = 'clang'
|
||||||
|
env['CXX'] = 'clang++'
|
||||||
|
|
||||||
|
if env['p'] != '':
|
||||||
|
env['platform'] = env['p']
|
||||||
|
|
||||||
|
if env['platform'] == '':
|
||||||
|
print("No valid target platform selected.")
|
||||||
|
quit();
|
||||||
|
|
||||||
|
# For the reference:
|
||||||
|
# - CCFLAGS are compilation flags shared between C and C++
|
||||||
|
# - CFLAGS are for C-specific compilation flags
|
||||||
|
# - CXXFLAGS are for C++-specific compilation flags
|
||||||
|
# - CPPFLAGS are for pre-processor flags
|
||||||
|
# - CPPDEFINES are for pre-processor defines
|
||||||
|
# - LINKFLAGS are for linking flags
|
||||||
|
|
||||||
|
# Check our platform specifics
|
||||||
|
if env['platform'] == "osx":
|
||||||
|
env['target_path'] += 'osx/'
|
||||||
|
cpp_library += '.osx'
|
||||||
|
env.Append(CCFLAGS=['-arch', 'x86_64'])
|
||||||
|
env.Append(CXXFLAGS=['-std=c++17'])
|
||||||
|
env.Append(LINKFLAGS=['-arch', 'x86_64'])
|
||||||
|
if env['target'] in ('debug', 'd'):
|
||||||
|
env.Append(CCFLAGS=['-g', '-O2'])
|
||||||
|
else:
|
||||||
|
env.Append(CCFLAGS=['-g', '-O3'])
|
||||||
|
|
||||||
|
elif env['platform'] in ('x11', 'linux'):
|
||||||
|
env['target_path'] += 'x11/'
|
||||||
|
cpp_library += '.linux'
|
||||||
|
env.Append(CCFLAGS=['-fPIC'])
|
||||||
|
env.Append(CXXFLAGS=['-std=c++17'])
|
||||||
|
if env['target'] in ('debug', 'd'):
|
||||||
|
env.Append(CCFLAGS=['-g3', '-Og'])
|
||||||
|
else:
|
||||||
|
env.Append(CCFLAGS=['-g', '-O3'])
|
||||||
|
|
||||||
|
elif env['platform'] == "windows":
|
||||||
|
env['target_path'] += 'win64/'
|
||||||
|
cpp_library += '.windows'
|
||||||
|
# This makes sure to keep the session environment variables on windows,
|
||||||
|
# that way you can run scons in a vs 2017 prompt and it will find all the required tools
|
||||||
|
env.Append(ENV=os.environ)
|
||||||
|
|
||||||
|
env.Append(CPPDEFINES=['WIN32', '_WIN32', '_WINDOWS', '_CRT_SECURE_NO_WARNINGS'])
|
||||||
|
env.Append(CCFLAGS=['-W3', '-GR'])
|
||||||
|
env.Append(CXXFLAGS='/std:c++17')
|
||||||
|
if env['target'] in ('debug', 'd'):
|
||||||
|
env.Append(CPPDEFINES=['_DEBUG'])
|
||||||
|
env.Append(CCFLAGS=['-EHsc', '-MDd', '-ZI'])
|
||||||
|
env.Append(LINKFLAGS=['-DEBUG'])
|
||||||
|
else:
|
||||||
|
env.Append(CPPDEFINES=['NDEBUG'])
|
||||||
|
env.Append(CCFLAGS=['-O2', '-EHsc', '-MD'])
|
||||||
|
|
||||||
|
if env['target'] in ('debug', 'd'):
|
||||||
|
cpp_library += '.debug'
|
||||||
|
else:
|
||||||
|
cpp_library += '.release'
|
||||||
|
|
||||||
|
cpp_library += '.' + str(bits)
|
||||||
|
|
||||||
|
# make sure our binding library is properly includes
|
||||||
|
env.Append(CPPPATH=['.', godot_headers_path, cpp_bindings_path + 'include/', cpp_bindings_path + 'include/core/', cpp_bindings_path + 'include/gen/'])
|
||||||
|
env.Append(LIBPATH=[cpp_bindings_path + 'bin/'])
|
||||||
|
env.Append(LIBS=[cpp_library])
|
||||||
|
|
||||||
|
# tweak this if you want to use different folders, or more folders, to store your source code in.
|
||||||
|
env.Append(CPPPATH=['src/'])
|
||||||
|
sources = Glob('src/*.cpp')
|
||||||
|
|
||||||
|
library = env.SharedLibrary(target=env['target_path'] + env['target_name'] , source=sources)
|
||||||
|
|
||||||
|
Default(library)
|
||||||
|
|
||||||
|
# Generates help for the -h scons option.
|
||||||
|
Help(opts.GenerateHelpText(env))
|
BIN
_downloads/9e015a6ce5b307c3c951f0f4f1783550/kbscene.zip
Normal file
166
_downloads/bc54982daa1be2e5b495d74f01a098f1/resource_queue.gd
Normal file
|
@ -0,0 +1,166 @@
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
var thread
|
||||||
|
var mutex
|
||||||
|
var semaphore
|
||||||
|
var exit_thread = false
|
||||||
|
|
||||||
|
var time_max = 100 # Milliseconds.
|
||||||
|
|
||||||
|
var queue = []
|
||||||
|
var pending = {}
|
||||||
|
|
||||||
|
func _lock(_caller):
|
||||||
|
mutex.lock()
|
||||||
|
|
||||||
|
|
||||||
|
func _unlock(_caller):
|
||||||
|
mutex.unlock()
|
||||||
|
|
||||||
|
|
||||||
|
func _post(_caller):
|
||||||
|
semaphore.post()
|
||||||
|
|
||||||
|
|
||||||
|
func _wait(_caller):
|
||||||
|
semaphore.wait()
|
||||||
|
|
||||||
|
|
||||||
|
func queue_resource(path, p_in_front = false):
|
||||||
|
_lock("queue_resource")
|
||||||
|
if path in pending:
|
||||||
|
_unlock("queue_resource")
|
||||||
|
return
|
||||||
|
elif ResourceLoader.has_cached(path):
|
||||||
|
var res = ResourceLoader.load(path)
|
||||||
|
pending[path] = res
|
||||||
|
_unlock("queue_resource")
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
var res = ResourceLoader.load_interactive(path)
|
||||||
|
res.set_meta("path", path)
|
||||||
|
if p_in_front:
|
||||||
|
queue.insert(0, res)
|
||||||
|
else:
|
||||||
|
queue.push_back(res)
|
||||||
|
pending[path] = res
|
||||||
|
_post("queue_resource")
|
||||||
|
_unlock("queue_resource")
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
func cancel_resource(path):
|
||||||
|
_lock("cancel_resource")
|
||||||
|
if path in pending:
|
||||||
|
if pending[path] is ResourceInteractiveLoader:
|
||||||
|
queue.erase(pending[path])
|
||||||
|
pending.erase(path)
|
||||||
|
_unlock("cancel_resource")
|
||||||
|
|
||||||
|
|
||||||
|
func get_progress(path):
|
||||||
|
_lock("get_progress")
|
||||||
|
var ret = -1
|
||||||
|
if path in pending:
|
||||||
|
if pending[path] is ResourceInteractiveLoader:
|
||||||
|
ret = float(pending[path].get_stage()) / float(pending[path].get_stage_count())
|
||||||
|
else:
|
||||||
|
ret = 1.0
|
||||||
|
_unlock("get_progress")
|
||||||
|
return ret
|
||||||
|
|
||||||
|
|
||||||
|
func is_ready(path):
|
||||||
|
var ret
|
||||||
|
_lock("is_ready")
|
||||||
|
if path in pending:
|
||||||
|
ret = !(pending[path] is ResourceInteractiveLoader)
|
||||||
|
else:
|
||||||
|
ret = false
|
||||||
|
_unlock("is_ready")
|
||||||
|
return ret
|
||||||
|
|
||||||
|
|
||||||
|
func _wait_for_resource(res, path):
|
||||||
|
_unlock("wait_for_resource")
|
||||||
|
while true:
|
||||||
|
VisualServer.sync()
|
||||||
|
OS.delay_usec(16000) # Wait approximately 1 frame.
|
||||||
|
_lock("wait_for_resource")
|
||||||
|
if queue.size() == 0 || queue[0] != res:
|
||||||
|
return pending[path]
|
||||||
|
_unlock("wait_for_resource")
|
||||||
|
|
||||||
|
|
||||||
|
func get_resource(path):
|
||||||
|
_lock("get_resource")
|
||||||
|
if path in pending:
|
||||||
|
if pending[path] is ResourceInteractiveLoader:
|
||||||
|
var res = pending[path]
|
||||||
|
if res != queue[0]:
|
||||||
|
var pos = queue.find(res)
|
||||||
|
queue.remove(pos)
|
||||||
|
queue.insert(0, res)
|
||||||
|
|
||||||
|
res = _wait_for_resource(res, path)
|
||||||
|
pending.erase(path)
|
||||||
|
_unlock("return")
|
||||||
|
return res
|
||||||
|
else:
|
||||||
|
var res = pending[path]
|
||||||
|
pending.erase(path)
|
||||||
|
_unlock("return")
|
||||||
|
return res
|
||||||
|
else:
|
||||||
|
_unlock("return")
|
||||||
|
return ResourceLoader.load(path)
|
||||||
|
|
||||||
|
|
||||||
|
func thread_process():
|
||||||
|
_wait("thread_process")
|
||||||
|
_lock("process")
|
||||||
|
|
||||||
|
while queue.size() > 0:
|
||||||
|
var res = queue[0]
|
||||||
|
_unlock("process_poll")
|
||||||
|
var ret = res.poll()
|
||||||
|
_lock("process_check_queue")
|
||||||
|
|
||||||
|
if ret == ERR_FILE_EOF || ret != OK:
|
||||||
|
var path = res.get_meta("path")
|
||||||
|
if path in pending: # Else, it was already retrieved.
|
||||||
|
pending[res.get_meta("path")] = res.get_resource()
|
||||||
|
# Something might have been put at the front of the queue while
|
||||||
|
# we polled, so use erase instead of remove.
|
||||||
|
queue.erase(res)
|
||||||
|
_unlock("process")
|
||||||
|
|
||||||
|
|
||||||
|
func thread_func(_u):
|
||||||
|
while true:
|
||||||
|
mutex.lock()
|
||||||
|
var should_exit = exit_thread # Protect with Mutex.
|
||||||
|
mutex.unlock()
|
||||||
|
|
||||||
|
if should_exit:
|
||||||
|
break
|
||||||
|
thread_process()
|
||||||
|
|
||||||
|
|
||||||
|
func start():
|
||||||
|
mutex = Mutex.new()
|
||||||
|
semaphore = Semaphore.new()
|
||||||
|
thread = Thread.new()
|
||||||
|
thread.start(self, "thread_func", 0)
|
||||||
|
|
||||||
|
# Triggered by calling "get_tree().quit()".
|
||||||
|
func _exit_tree():
|
||||||
|
mutex.lock()
|
||||||
|
exit_thread = true # Protect with Mutex.
|
||||||
|
mutex.unlock()
|
||||||
|
|
||||||
|
# Unblock by posting.
|
||||||
|
semaphore.post()
|
||||||
|
|
||||||
|
# Wait until it exits.
|
||||||
|
thread.wait_to_finish()
|
BIN
_downloads/deeb6291f47a803f016f7c279559ada5/autoload.zip
Normal file
BIN
_downloads/e127de157181dc9d0805f16f36a924d9/using_area_2d.zip
Normal file
BIN
_downloads/f64bfc21c561de70d9ebf43299bd3724/gbot_resources.zip
Normal file
BIN
_images/01.adding_area_node.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
_images/01.animation_player_dock.png
Normal file
After Width: | Height: | Size: 4 KiB |
BIN
_images/01.attach_script_to_player.png
Normal file
After Width: | Height: | Size: 7 KiB |
BIN
_images/01.import_button.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
_images/01.initial_three_nodes.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
_images/01.label_node.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
_images/01.monsters_path_preview.png
Normal file
After Width: | Height: | Size: 9.3 KiB |
BIN
_images/01.new_scene.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
_images/02.add_child_node.png
Normal file
After Width: | Height: | Size: 6.6 KiB |
BIN
_images/02.browse_to_project_folder.png
Normal file
After Width: | Height: | Size: 6 KiB |
BIN
_images/02.clicking_main_tab.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
_images/02.cylinder_shape.png
Normal file
After Width: | Height: | Size: 6.6 KiB |
BIN
_images/02.instantiating_the_model.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
_images/02.new_animation.png
Normal file
After Width: | Height: | Size: 1 KiB |
BIN
_images/02.project_settings.png
Normal file
After Width: | Height: | Size: 7.3 KiB |
BIN
_images/02.project_settings1.png
Normal file
After Width: | Height: | Size: 7.3 KiB |
BIN
_images/02.score_color_picker.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
_images/02.score_custom_color.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
_images/02.score_label_moved.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
_images/02.score_placeholder.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
_images/03.creating_theme.png
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
_images/03.cylinder_in_editor.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
_images/03.float_name.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
_images/03.import_and_edit.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
_images/03.instance_child_scene.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
_images/03.physics_layers.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
_images/03.scene_structure.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
_images/03.scene_with_collision_shape.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
_images/03.timeline.png
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
_images/03.window_settings.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
_images/04.autoplay_and_loop.png
Normal file
After Width: | Height: | Size: 5.8 KiB |
BIN
_images/04.camera_preview.png
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
_images/04.create_box_shape.png
Normal file
After Width: | Height: | Size: 6.8 KiB |
BIN
_images/04.default_physics_properties.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
_images/04.mob_detector_properties.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
_images/04.scene_tree_with_camera.png
Normal file
After Width: | Height: | Size: 4.8 KiB |
BIN
_images/04.sphere_shape.png
Normal file
After Width: | Height: | Size: 9 KiB |
BIN
_images/04.start_assets.png
Normal file
After Width: | Height: | Size: 6.9 KiB |
BIN
_images/04.theme_preview.png
Normal file
After Width: | Height: | Size: 7.2 KiB |
BIN
_images/05.body_entered_signal.png
Normal file
After Width: | Height: | Size: 4.4 KiB |
BIN
_images/05.box_final_size.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
_images/05.camera_preview_checkbox.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
_images/05.cylinders_node.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
_images/05.dynamic_font.png
Normal file
After Width: | Height: | Size: 4.8 KiB |
BIN
_images/05.main_node.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
_images/05.moving_the_sphere_up.png
Normal file
After Width: | Height: | Size: 6.1 KiB |
BIN
_images/05.pin_icon.png
Normal file
After Width: | Height: | Size: 644 B |
BIN
_images/05.toggle_layer_and_mask.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
_images/06.animation_duration.png
Normal file
After Width: | Height: | Size: 1 KiB |
BIN
_images/06.cylinder_mesh.png
Normal file
After Width: | Height: | Size: 6.2 KiB |
BIN
_images/06.font_data.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
_images/06.named_checkboxes.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
_images/06.player_hit_signal.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
_images/06.staticbody_node.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
_images/06.toggling_visibility.png
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
_images/06.two_viewports.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
_images/06.visibility_notifier.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
_images/07.adding_action.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
_images/07.camera_preview_checkbox.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
_images/07.collision_shape_warning.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
_images/07.editable_timeline.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
_images/07.font_size.png
Normal file
After Width: | Height: | Size: 5.8 KiB |
BIN
_images/07.input_map_tab.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
_images/07.player_physics_mask.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
_images/07.project_settings.png
Normal file
After Width: | Height: | Size: 5.2 KiB |
BIN
_images/07.top_view.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
_images/07.visibility_notifier_bbox_resized.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
_images/08.actions_list_empty.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
_images/08.camera_moved.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
_images/08.create_box_shape.png
Normal file
After Width: | Height: | Size: 8 KiB |
BIN
_images/08.create_key_action.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
_images/08.mob_attach_script.png
Normal file
After Width: | Height: | Size: 7.5 KiB |
BIN
_images/08.mob_physics_mask.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
_images/08.open_main_script.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
_images/08.toggle_view_grid.png
Normal file
After Width: | Height: | Size: 4 KiB |
BIN
_images/08.zoom_slider.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
_images/09.box_extents.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
_images/09.camera_rotated.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
_images/09.creating_first_keyframe.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
_images/09.groups_tab.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
_images/09.keyboard_key_popup.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
_images/09.keyboard_keys.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
_images/09.score_in_game.png
Normal file
After Width: | Height: | Size: 8.9 KiB |