mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-15 23:52:35 +00:00
Initial work on map editor
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
require_relative "map_editor/lib/main_menu"
|
||||
require_relative "map_editor/lib/main_menu"
|
||||
require_relative "map_editor/lib/editor"
|
||||
18
lib/tools/map_editor/lib/editor.rb
Normal file
18
lib/tools/map_editor/lib/editor.rb
Normal file
@@ -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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user