Added main menu, added loading screen, hacked and chiseled things until I could load models without attaching to a gameobject.

This commit is contained in:
2018-09-09 15:01:53 -05:00
parent d37758526a
commit 66e7800cad
11 changed files with 182 additions and 16 deletions

View File

@@ -26,6 +26,9 @@ class IMICFPS
setup
if @bound_model
@bound_model.model.game_object = self
@bound_model.model.objects.each {|o| o.parent = self}
box = normalize_bounding_box(@bound_model.model.bounding_box)
@width = box.max_x-box.min_x
@height = box.max_y-box.min_y
@@ -38,6 +41,8 @@ class IMICFPS
def bind_model(model)
raise "model isn't a model!" unless model.is_a?(ModelLoader)
@bound_model = model
@bound_model.model.game_object = self
@bound_model.model.objects.each {|o| o.parent = self}
box = normalize_bounding_box(@bound_model.model.bounding_box)
@width = box.max_x-box.min_x
@height = box.max_y-box.min_y

View File

@@ -8,20 +8,21 @@ class IMICFPS
attr_reader :model, :name, :debug_color
def initialize(type:, file_path:, game_object:)
def initialize(type:, file_path:, game_object: nil)
@type = type
@file_path = file_path
@name = file_path.split("/").last.split(".").first
@debug_color = Color.new(0.0, 1.0, 0.0)
@model = nil
@supported_models = ["OBJ"]
unless load_model_from_cache
case type
case @type
when :obj
@model = Wavefront::Model.new(file_path: @file_path, game_object: game_object)
else
raise "Unsupported model type, supported models are: #{Model.supported_models.join(', ')}"
raise "Unsupported model type, supported models are: #{@supported_models.join(', ')}"
end
cache_model