Skip to content
This repository has been archived by the owner on Sep 14, 2019. It is now read-only.

Commit

Permalink
Merge pull request #95 from Milerius/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Milerius authored Aug 4, 2018
2 parents b23a0a2 + f8ca2db commit 52d665e
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 11 deletions.
19 changes: 8 additions & 11 deletions cmake/shiva-sfml-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit 52d665e

Please sign in to comment.