draw_circle" method that draws an unfilled circle with a given edge thickness (using draw_quad), but I don't know how to integrate it into Gosu so it functions like
Gosu::Window, and it works fine when called directly from within (a subclass of)
Window#draw. However, I want to call it from within the
#drawof another class, which is itself called inside
Window#draw. When I do, Ruby says the method is undefined. Okay, that kinda makes sense... I just have to call
Window#draw_circle, then, right? So, I pass a reference to the
Windowobject into my class' constructor, but calling
@win.draw_circle(...)makes the first call to
draw_circlefail with the message "
draw_quad, etc. are defined directly in the
Gosumodule, I tried doing that with my
draw_circle, too, but then I can't figure out how to call it at all. It doesn't "just work" like calling
def self.xinstead of
... draw_quad(...) ...
undefined method 'draw_circle' for #<GfxWindow:0x287bc20>and, in the non-working example:
undefined method 'draw_circle' for #<Connector:0x2944398>
Gosu::" to the
draw_circlecalls, the non-working example gives "invalid value" and the working example works again, but I don't have to add "
draw_quad, etc., so why should I now?
draw_quadoriginally was (and still is) an instance method of
Gosu::Window, which is why you can call it without
Gosu.inside of your window subclass, but only there.
Gosu::Windowinstance made it necessary to pass around references to the window everywhere (same thing with the old
Imageconstructors etc.), which was so annoying that many games used a global
$windowvariable instead. So in Gosu 0.9, I've moved all the
module Gosu, along with
draw_quadmethods now, one on
Gosu::Windowand one in
Gosuitself. If you want
draw_circleto have the same behaviour, you'll need to implement it twice as well. The method in
Gosu::Windowwould just forward all arguments to the module.
Gosu.draw_xxx, but I'm afraid that'll make things even more confusing when someone uses
draw_circle(and, thus, to the
draw_circlea class method of Gosu and made an instance method of Window pointing to it, and all works as it should!
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill