mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-15 15:42:35 +00:00
Added fps target, added comma
This commit is contained in:
@@ -39,7 +39,7 @@ class IMICFPS
|
|||||||
face_count = 0
|
face_count = 0
|
||||||
@objects.each {|o| face_count+=o.faces.size}
|
@objects.each {|o| face_count+=o.faces.size}
|
||||||
@objects.each_with_index do |o, i|
|
@objects.each_with_index do |o, i|
|
||||||
puts " Model::Object Name: #{o.name} Faces: #{o.faces.size}"
|
puts " Model::Object Name: #{o.name}, Faces: #{o.faces.size}"
|
||||||
end
|
end
|
||||||
$window.number_of_faces+=face_count
|
$window.number_of_faces+=face_count
|
||||||
@model_has_texture = false
|
@model_has_texture = false
|
||||||
@@ -76,13 +76,13 @@ class IMICFPS
|
|||||||
|
|
||||||
if $debug
|
if $debug
|
||||||
glDisable(GL_LIGHTING)
|
glDisable(GL_LIGHTING)
|
||||||
glLineWidth(3)
|
|
||||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
|
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
|
||||||
glPolygonOffset(2, 0.5)
|
glPolygonOffset(2, 0.5)
|
||||||
|
glLineWidth(3)
|
||||||
glDrawArrays(GL_TRIANGLES, 0, o.flattened_vertices_size/4)
|
glDrawArrays(GL_TRIANGLES, 0, o.flattened_vertices_size/4)
|
||||||
|
glLineWidth(1)
|
||||||
glPolygonOffset(0, 0)
|
glPolygonOffset(0, 0)
|
||||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)
|
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)
|
||||||
glLineWidth(1)
|
|
||||||
glEnable(GL_LIGHTING)
|
glEnable(GL_LIGHTING)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,11 @@ class IMICFPS
|
|||||||
attr_reader :camera
|
attr_reader :camera
|
||||||
|
|
||||||
def initialize(window_width = 1280, window_height = 800, fullscreen = false)
|
def initialize(window_width = 1280, window_height = 800, fullscreen = false)
|
||||||
|
fps_target = (ARGV.first.to_i != 0) ? ARGV.first.to_i : 60
|
||||||
if ARGV.join.include?("--native")
|
if ARGV.join.include?("--native")
|
||||||
super(Gosu.screen_width, Gosu.screen_height, true)
|
super(Gosu.screen_width, Gosu.screen_height, fullscreen: true, resizable: false, update_interval: 1000.0/fps_target)
|
||||||
else
|
else
|
||||||
super(window_width, window_height, fullscreen)
|
super(window_width, window_height, fullscreen: fullscreen, resizable: false, update_interval: 1000.0/fps_target)
|
||||||
end
|
end
|
||||||
$window = self
|
$window = self
|
||||||
@needs_cursor = false
|
@needs_cursor = false
|
||||||
@@ -55,9 +56,7 @@ class IMICFPS
|
|||||||
glClearColor(0,0.2,0.5,1) # skyish blue
|
glClearColor(0,0.2,0.5,1) # skyish blue
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) # clear the screen and the depth buffer
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) # clear the screen and the depth buffer
|
||||||
|
|
||||||
LightManager.lights.each do |light|
|
LightManager.lights.each(&:draw)
|
||||||
light.draw
|
|
||||||
end
|
|
||||||
|
|
||||||
@camera.draw
|
@camera.draw
|
||||||
@skydome.draw if @skydome.renderable
|
@skydome.draw if @skydome.renderable
|
||||||
|
|||||||
Reference in New Issue
Block a user