From c53d42166bfa54ef25b0d84df0fcc69521c7baa9 Mon Sep 17 00:00:00 2001 From: Cyberarm Date: Sun, 3 May 2020 09:49:57 -0500 Subject: [PATCH] Use glLineWidth for wireframe rendering, use LoadingState for MapEditor --- lib/renderer/opengl_renderer.rb | 2 ++ lib/states/game_states/loading_state.rb | 8 +++++++- lib/tools/map_editor/lib/main_menu.rb | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/renderer/opengl_renderer.rb b/lib/renderer/opengl_renderer.rb index 01f9e0b..f835d8b 100644 --- a/lib/renderer/opengl_renderer.rb +++ b/lib/renderer/opengl_renderer.rb @@ -155,6 +155,7 @@ class IMICFPS end if window.config.get(:debug_options, :wireframe) + glLineWidth(2) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE) Shader.active_shader.uniform_boolean("disableLighting", true) @@ -163,6 +164,7 @@ class IMICFPS Shader.active_shader.uniform_boolean("disableLighting", false) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL) + glLineWidth(1) end glDrawArrays(GL_TRIANGLES, 0, model.faces.count * 3) diff --git a/lib/states/game_states/loading_state.rb b/lib/states/game_states/loading_state.rb index 927f478..cd5ccb3 100644 --- a/lib/states/game_states/loading_state.rb +++ b/lib/states/game_states/loading_state.rb @@ -2,7 +2,13 @@ class IMICFPS class LoadingState < Menu def setup window.needs_cursor = false - @map_parser = MapParser.new(map_file: @options[:map_file]) + if @options[:map_file] + @map_parser = MapParser.new(map_file: @options[:map_file]) + elsif @options[:map_parser] + @map_parser = @options[:map_parser] + else + raise "Unable to load map, missing :map_file or :map_parser" + end title "I-MIC FPS" @subheading = Text.new("Loading Map: #{@map_parser.metadata.name}", y: 100, size: 50, alignment: :center) diff --git a/lib/tools/map_editor/lib/main_menu.rb b/lib/tools/map_editor/lib/main_menu.rb index 63c39d2..5189c34 100644 --- a/lib/tools/map_editor/lib/main_menu.rb +++ b/lib/tools/map_editor/lib/main_menu.rb @@ -29,7 +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(LoadingState, map_parser: map, forward: Editor) end end end