This repository has been archived by the owner on Sep 14, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from Milerius/dev
Dev
- Loading branch information
Showing
2 changed files
with
58 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
tools/game_templates/sfml/bin/assets/scripts/scenes/lua/game_scene.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |