diff --git a/cmake/shiva-sfml-config.cmake.in b/cmake/shiva-sfml-config.cmake.in index 579328a..96f7884 100644 --- a/cmake/shiva-sfml-config.cmake.in +++ b/cmake/shiva-sfml-config.cmake.in @@ -6,30 +6,27 @@ include("${CMAKE_CURRENT_LIST_DIR}/shiva-shiva-system-sfml-resources-targets.cma include("${CMAKE_CURRENT_LIST_DIR}/shiva-shiva-system-sfml-graphics-targets.cmake") include("${CMAKE_CURRENT_LIST_DIR}/shiva-shiva-system-sfml-inputs-targets.cmake") -macro(import_plugin plugin_name) +macro(import_plugins plugin_name) if(CMAKE_BUILD_TYPE MATCHES Debug) get_property(result TARGET ${plugin_name} PROPERTY IMPORTED_LOCATION_DEBUG) else() get_property(result TARGET ${plugin_name} PROPERTY IMPORTED_LOCATION_RELEASE) endif() - get_filename_component(result_filename ${result} NAME) + message(STATUS "initial directory -> ${result}") + get_filename_component(result_directory ${result} DIRECTORY) + file(GLOB_RECURSE PLUGINS ${result_directory}/*) + message(STATUS "plugin directory to copy -> ${result_directory}") + message(STATUS "plugins -> ${PLUGINS}") - message(STATUS "plugin to copy -> ${result}") - message(STATUS "plugin filename to copy -> ${result_filename}") - - configure_file(${result} - ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${result_filename} - COPYONLY) + file(COPY ${PLUGINS} DESTINATION ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) endmacro() ##! directory output plugins set(SAVE_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/systems) -import_plugin(shiva::shiva-system-sfml-resources) -import_plugin(shiva::shiva-system-sfml-graphics) -import_plugin(shiva::shiva-system-sfml-inputs) +import_plugins(shiva::shiva-system-sfml-resources) ##! restore output plugins set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${SAVE_OUTPUT_DIRECTORY}") diff --git a/tools/game_templates/sfml/bin/assets/scripts/scenes/lua/game_scene.lua b/tools/game_templates/sfml/bin/assets/scripts/scenes/lua/game_scene.lua new file mode 100644 index 0000000..d3b1b12 --- /dev/null +++ b/tools/game_templates/sfml/bin/assets/scripts/scenes/lua/game_scene.lua @@ -0,0 +1,50 @@ +-- +-- Created by IntelliJ IDEA. +-- User: romansztergbaum +-- Date: 17/07/2018 +-- Time: 16:47 +-- To change this template use File | Settings | File Templates. +-- + +local entities = {} + +function update() +end + +function on_key_pressed(evt) + print("game scene keycode: " .. evt.keycode) +end + +function on_key_released(evt) + print("game scene released keycode: " .. evt.keycode) +end + +function leave() + print("leave game scene") + for key, value in pairs(entities) do + shiva.entity_registry:destroy(value) + end + shiva.resource_registry:unload_all_resources("game_scene") +end + +function on_after_load_resources(evt) +-- local id, sprite = shiva.entity_registry:create_game_object_with_sprite() +-- sprite:set_texture(shiva.resource_registry:get_texture("game_scene/toto"), false) +-- entities[#entities + 1] = id +-- shiva.entity_registry:add_layer_1_component(id) +end + +function enter() + print("enter game scene") + shiva.resource_registry:load_all_resources("game_scene") +end + +return { + on_key_released = on_key_released, + on_key_pressed = on_key_pressed, + on_after_load_resources = on_after_load_resources, + leave = leave, + enter = enter, + update = update, + scene_active = true +} \ No newline at end of file