From 1b6019419b087c5af39e6620ca75eb2a1c93f7a9 Mon Sep 17 00:00:00 2001 From: Cyberarm Date: Thu, 30 Jan 2020 19:53:42 -0600 Subject: [PATCH] Fixed cursor not showing up in Asset Viewer main menu, fixed Camera free move not having :turn_left/right implemented --- lib/game_objects/camera.rb | 10 ++++++++++ lib/tools/asset_viewer/lib/main_menu.rb | 6 ++++++ lib/tools/asset_viewer/lib/turn_table.rb | 6 ++++-- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/game_objects/camera.rb b/lib/game_objects/camera.rb index e4b239b..cd5d59a 100644 --- a/lib/game_objects/camera.rb +++ b/lib/game_objects/camera.rb @@ -116,6 +116,8 @@ class IMICFPS relative_speed = 10.0 if InputMapper.down?(:sprint) relative_speed *= window.dt + turn_speed = 50.0 * window.dt + if InputMapper.down?( :forward) @position.z+=Math.cos(relative_y_rotation * Math::PI / 180) * relative_speed @position.x-=Math.sin(relative_y_rotation * Math::PI / 180) * relative_speed @@ -136,6 +138,14 @@ class IMICFPS @position.x-=Math.cos(relative_y_rotation * Math::PI / 180) * relative_speed end + if InputMapper.down?(:turn_left) + @orientation.y -= turn_speed + end + + if InputMapper.down?(:turn_right) + @orientation.y += turn_speed + end + if InputMapper.down?(:ascend) @position.y+=relative_speed end diff --git a/lib/tools/asset_viewer/lib/main_menu.rb b/lib/tools/asset_viewer/lib/main_menu.rb index 2cec7d6..42e87d3 100644 --- a/lib/tools/asset_viewer/lib/main_menu.rb +++ b/lib/tools/asset_viewer/lib/main_menu.rb @@ -28,6 +28,12 @@ class IMICFPS window.close end end + + def update + super + + window.needs_cursor = true + end end end end \ No newline at end of file diff --git a/lib/tools/asset_viewer/lib/turn_table.rb b/lib/tools/asset_viewer/lib/turn_table.rb index 63a28a7..4b687e0 100644 --- a/lib/tools/asset_viewer/lib/turn_table.rb +++ b/lib/tools/asset_viewer/lib/turn_table.rb @@ -5,6 +5,7 @@ class IMICFPS attr_reader :map def setup + window.needs_cursor = false @manifest = @options[:manifest] if window.config.get(:debug, :use_shaders) @@ -23,6 +24,7 @@ class IMICFPS @entity.bind_model @map.add_entity(@entity) @map.entities.each { |e| e.backface_culling = false } + @crosshair = Crosshair.new(color: Gosu::Color.rgba(100, 200, 255, 100)) @lights = [] @light = Light.new(id: available_light, position: Vector.new, diffuse: Vector.new(1, 1, 1, 1)) @@ -42,8 +44,6 @@ class IMICFPS end def draw - window.show_cursor = true - color_top = Gosu::Color::GRAY color_bottom = Gosu::Color::BLACK @@ -58,6 +58,8 @@ class IMICFPS @renderer.draw(@camera, [@light], @map.entities) end + @crosshair.draw + super end