Skip to content
This repository has been archived by the owner on Jan 11, 2019. It is now read-only.

Commit

Permalink
Added variable internal_update_interval to Gosu::Window to solve
Browse files Browse the repository at this point in the history
compatibility issues with gosu
  • Loading branch information
neochuky committed Apr 16, 2013
1 parent d5fe3d5 commit 8b29658
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions lib/gosu_android/main-window.rb
Expand Up @@ -65,6 +65,7 @@ class Window
attr_accessor :media_player
attr_reader :width, :height
attr_reader :fullscreen
attr_reader :internal_update_interval
attr_reader :update_interval
attr_reader :physics_manager
attr_reader :fonts_manager
Expand All @@ -81,7 +82,8 @@ def initialize(width, height, fullscreen, update_interval=16.666666)
@display = @activity.getWindowManager.getDefaultDisplay
@width = width
@height= height
@update_interval = update_interval/1000.0
@internal_update_interval = update_interval/1000.0
@update_interval = update_interval
#@surface_view = GosuSurfaceView.new(@activity)
@surface_view = android_initializer.surface_view
@input = Input.new(@display, self)
Expand Down Expand Up @@ -176,8 +178,8 @@ def do_show
do_tick
#TODO gosu dark side
@end_time = Time.now
if (@start_time <= @end_time and (@end_time - @start_time) < @update_interval)
sleep(@update_interval - (@end_time - @start_time))
if (@start_time <= @end_time and (@end_time - @start_time) < @internal_update_interval)
sleep(@internal_update_interval - (@end_time - @start_time))
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/gosu_android/physics/physicsManager.rb
Expand Up @@ -6,7 +6,7 @@ class PhysicsManager
attr_accessor :gravity_x, :gravity_y
def initialize(window)
@window = window
@dt = @window.update_interval
@dt = @window.internal_update_interval
@squares = []
@planes = []
@gravity_x = 0
Expand Down
2 changes: 1 addition & 1 deletion lib/gosu_android/physics/physicsObject.rb
Expand Up @@ -42,7 +42,7 @@ def initialize(window, file_name, x, y, z, size, mass_inverted,
@velocity = [velocity_x, velocity_y]
@mass_inverted = mass_inverted
@image = Gosu::Image.new(@window, file_name , tileable)
@dt = @window.update_interval
@dt = @window.internal_update_interval
end

def integrate
Expand Down

0 comments on commit 8b29658

Please sign in to comment.