diff --git a/Gemfile.lock b/Gemfile.lock index e90277a..b72daa2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,22 +1,23 @@ GIT remote: https://github.com/cyberarm/cyberarm_engine - revision: d8551c7428da98bb7da76c138e5fbde50ef0137f + revision: 4055f645f3446c61f57ad1c7748284106c1516ff specs: cyberarm_engine (0.13.1) gosu (~> 0.15.0) + gosu_more_drawables (~> 0.3) GEM remote: https://rubygems.org/ specs: gosu (0.15.1) gosu (0.15.1-x64-mingw32) - mini_portile2 (2.4.0) - nokogiri (1.11.0.rc1) - mini_portile2 (~> 2.4.0) - nokogiri (1.11.0.rc1-x64-mingw32) - mini_portile2 (~> 2.4.0) + gosu_more_drawables (0.3.0) + mini_portile2 (2.5.0) + nokogiri (1.11.0.rc2) + mini_portile2 (~> 2.5.0) + nokogiri (1.11.0.rc2-x64-mingw32) ocra (1.3.11) - opengl-bindings (1.6.9) + opengl-bindings (1.6.10) PLATFORMS ruby diff --git a/lib/map.rb b/lib/map.rb index 3c7d7cf..03311ab 100644 --- a/lib/map.rb +++ b/lib/map.rb @@ -33,8 +33,11 @@ class IMICFPS add_entity(Player.new(spawnpoint: @map_parser.spawnpoints.sample, manifest: Manifest.new(package: "base", name: "character"))) - # add_light(Light.new(id: available_light, position: Vector.new(30, 10.0, 30))) - # add_light(Light.new(id: available_light, position: Vector.new(0, 100, 0), diffuse: Color.new(1.0, 0.5, 0.1))) + # Default lights if non are defined + if @map_parser.lights.size == 0 + add_light(Light.new(id: available_light, position: Vector.new(30, 10.0, 30))) + add_light(Light.new(id: available_light, position: Vector.new(0, 100, 0), diffuse: Color.new(1.0, 0.5, 0.1))) + end end def data diff --git a/lib/tools/map_editor.rb b/lib/tools/map_editor.rb index 6191385..261e972 100644 --- a/lib/tools/map_editor.rb +++ b/lib/tools/map_editor.rb @@ -1 +1,2 @@ -require_relative "map_editor/lib/main_menu" \ No newline at end of file +require_relative "map_editor/lib/main_menu" +require_relative "map_editor/lib/editor" \ No newline at end of file diff --git a/lib/tools/map_editor/lib/editor.rb b/lib/tools/map_editor/lib/editor.rb new file mode 100644 index 0000000..336f247 --- /dev/null +++ b/lib/tools/map_editor/lib/editor.rb @@ -0,0 +1,18 @@ +class IMICFPS + class MapEditorTool + class Editor < CyberarmEngine::GuiState + def setup + @map = Map.new( map_parser: @options[:map] ) + @camera = Camera.new( position: Vector.new, orientation: Vector.new(0, 90, 0) ) + end + + def draw + window.renderer.draw(@camera, @map.entities, @map.lights) + end + + def update + @camera.position.y -= 1 * window.dt + end + end + end +end diff --git a/lib/tools/map_editor/lib/main_menu.rb b/lib/tools/map_editor/lib/main_menu.rb index 72193c7..d61d43f 100644 --- a/lib/tools/map_editor/lib/main_menu.rb +++ b/lib/tools/map_editor/lib/main_menu.rb @@ -29,6 +29,7 @@ class IMICFPS flow(margin: 10) do @maps.each do |map| button map.metadata.name do + push_state(Editor, map_parser: map) # push_state(TurnTable, manifest: manifest) end end