Not logged inGosu Forums
Forum back to Help Search Register Login
Up Topic Gosu / Gosu Exchange / Method button_down(id)?
- - By battousai Date 2012-05-09 18:09
Hi, post to ask if there is a way to use the method button_down(id) out of a class that inherits from Window. Example: I can invoke the method button_down?(id) outside as follows: window.button_down?, returning true if I press a button, but as I do with the method button_down(id)??

I tried to do the following:

def window.button_down(id)
    if id == KbUp then
        puts 1

But got no results.

I hope their solutions, bye!
Parent - By lol_o2 Date 2012-05-10 08:05
Make a button_down(id) method inside class you wan to use it and then call it from Window.button_down(id)

class GameWindow < Window
  def button_down(id)
Parent - By RavensKrag Date 2012-05-11 12:47
This syntax seems to be for a singleton method defined on the window variable, which might not be what you intend to do.  Still, I don't think that should cause any problems.

Can you clarify whether you are attempting to define #button_down() or #button_down?() ?

The former is what you want to be redefining in descendants of Gosu::Window.  The latter is used to see if the given key is currently depressed or not.
Up Topic Gosu / Gosu Exchange / Method button_down(id)?

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill