Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7515117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:42:04+00:00 2026-05-30T00:42:04+00:00

This code is causing a very strange exception in Chingu, a game library for

  • 0

This code is causing a very strange exception in Chingu, a game library for ruby that depends upon the Gosu 2D game framework:

class StopSignAttack < Chingu::Window

  def initialize
    super(1000, 1000, false)
    self.input = { :escape => :close }
    self.caption = "Stop Sign ATTACK!!!"
    push_game_state(Start.new)
  end

end

The value of the input property for the Chingu::Window should simply cause the game window to close when pressing the escape key. The window closes when pressing the escape key, but bombs badly with this exception:

/Users/sams/.rvm/gems/ruby-1.9.3-p0/gems/chingu-0.8.1/lib/chingu/helpers/input_dispatcher.rb:63:in `block in dispatch_input_for': undefined method `button_down?' for nil:NilClass (NoMethodError)
    from /Users/sams/.rvm/gems/ruby-1.9.3-p0/gems/chingu-0.8.1/lib/chingu/helpers/input_dispatcher.rb:62:in `each'
    from /Users/sams/.rvm/gems/ruby-1.9.3-p0/gems/chingu-0.8.1/lib/chingu/helpers/input_dispatcher.rb:62:in `dispatch_input_for'
    from /Users/sams/.rvm/gems/ruby-1.9.3-p0/gems/chingu-0.8.1/lib/chingu/window.rb:148:in `block in intermediate_update'
    from /Users/sams/.rvm/gems/ruby-1.9.3-p0/gems/chingu-0.8.1/lib/chingu/window.rb:148:in `each'
    from /Users/sams/.rvm/gems/ruby-1.9.3-p0/gems/chingu-0.8.1/lib/chingu/window.rb:148:in `intermediate_update'
    from /Users/sams/.rvm/gems/ruby-1.9.3-p0/gems/chingu-0.8.1/lib/chingu/window.rb:133:in `update'
    from stop_sign_attack.rb:24:in `<main>'

I’ve tried implementing the close method in the Chingu::Window, calling the super class close method:

  def close
    super.close
  end

And I get this exception when pressing the ESC key:

stop_sign_attack.rb:23:in `close': undefined method `close' for nil:NilClass (NoMethodError)
    from /Users/sams/.rvm/gems/ruby-1.9.3-p0/gems/gosu-0.7.41-universal-darwin/lib/gosu/swig_patches.rb:19:in `rescue in block (2 levels) in <class:Window>'
    from /Users/sams/.rvm/gems/ruby-1.9.3-p0/gems/gosu-0.7.41-universal-darwin/lib/gosu/swig_patches.rb:12:in `block (2 levels) in <class:Window>'
    from /Users/sams/.rvm/gems/ruby-1.9.3-p0/gems/gosu-0.7.41-universal-darwin/lib/gosu/swig_patches.rb:26:in `show'
    from /Users/sams/.rvm/gems/ruby-1.9.3-p0/gems/gosu-0.7.41-universal-darwin/lib/gosu/swig_patches.rb:26:in `show'
    from stop_sign_attack.rb:28:in `<main>'

Any ideas are appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T00:42:07+00:00Added an answer on May 30, 2026 at 12:42 am

    You left off some information that would allow someone to debug this. For example, you’re pushing a game state called Start, but the Start class is not declared in your example. but you haven’t shared that portion of the code. I created the following sample project to test out what you’ve got there:

    require 'chingu'
    
    # A simple GameState-example
    class Start < Chingu::GameState
    end
    
    class StopSignAttack < Chingu::Window
    
      def initialize
        super(1000, 1000, false)
        self.input = { :escape => :close }
        self.caption = "Stop Sign ATTACK!!!"
        push_game_state(Start.new)
      end
    
    end
    
    StopSignAttack.new.show
    

    This works just fine, exiting without any exception when I press escape.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This morning we found an old chunk of code that was causing a library
I'm trying to do something that should be very simple, but it's causing this
This line in YUI's Reset CSS is causing trouble for me: address,caption,cite,code,dfn,em,strong,th,var { font-style:
I want to create maintainable code, but this inheritance situation is causing me problems.
Ok, this is a curly one. I'm working on some Delphi code that I
I am having a strange issue. I have a very simple piece of code
I'm trying to parse a JSON string using the json library. This code works
I have a very basic slideshow cycling some div containers. This is my code:
I have a very strange error using NSMutableArray in cocos2d/xcode In my code, I
This code in JS gives me a popup saying i think null is a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.