Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Exchange / undefined method `to_blob' for #<Game:0x000000025c3c38 @__sw
- - By redcodefinal Date 2015-10-03 21:05 Edited 2015-10-04 03:14
/home/ian/Documents/gamedev/isometric-city-generator-ruby/assets.rb:39:in initialize': undefined method to_blob' for #<Game:0x000000025c3c38 @__swigtype__="_p_Gosu__Window"> (NoMethodError)
  from /home/ian/Documents/gamedev/isometric-city-generator-ruby/assets.rb:39:in initialize'
  from /home/ian/Documents/gamedev/isometric-city-generator-ruby/assets.rb:39:in
new'
  from /home/ian/Documents/gamedev/isometric-city-generator-ruby/assets.rb:39:in block (2 levels) in load_assets'
  from /home/ian/Documents/gamedev/isometric-city-generator-ruby/assets.rb:29:in
each'
  from /home/ian/Documents/gamedev/isometric-city-generator-ruby/assets.rb:29:in block in load_assets'
  from /home/ian/Documents/gamedev/isometric-city-generator-ruby/assets.rb:26:in
each'
  from /home/ian/Documents/gamedev/isometric-city-generator-ruby/assets.rb:26:in load_assets'
  from ./game.rb:23:in
initialize'
  from ./game.rb:113:in new'
  from ./game.rb:113:in
<main>'


Code: assets.rb @ 39

Just reinstalled gosu on a new machine and I get this error when I try to run my Isometric City Generator. I haven't updated it in 8 months or so, was there any updates changing how Gosu::Image works? The error occurs when calling Gosu::Image.new.

2.2.1 :001 > require 'gosu'
=> true
2.2.1 :002 > Gosu::Image
=> Gosu::Image
2.2.1 :003 > window = Gosu::Window.new(400, 400, false)
=> #<Gosu::Window:0x00000001252708 @__swigtype__="_p_Gosu__Window">
2.2.1 :004 > image = Gosu::Image.new(window, "./block.png")
NoMethodError: undefined method to_blob' for #<Gosu::Window:0x00000001252708 @__swigtype__="_p_Gosu__Window">
  from (irb):4:in
initialize'
  from (irb):4:in initialize'
  from (irb):4:in
new'
  from (irb):4
  from /home/ian/.rvm/rubies/ruby-2.2.1/bin/irb:11:in <main>'
2.2.1 :005 > image = Gosu::Image.new(window, "block.png")
NoMethodError: undefined method
to_blob' for #<Gosu::Window:0x00000001252708 @__swigtype__="_p_Gosu__Window">
  from (irb):5:in initialize'
  from (irb):5:in
initialize'
  from (irb):5:in new'
  from (irb):5
  from /home/ian/.rvm/rubies/ruby-2.2.1/bin/irb:11:in
<main>'
2.2.1 :006 > image = Gosu::Image.new(window, "./block.png")
NoMethodError: undefined method to_blob' for #<Gosu::Window:0x00000001252708 @__swigtype__="_p_Gosu__Window">
  from (irb):6:in
initialize'
  from (irb):6:in initialize'
  from (irb):6:in
new'
  from (irb):6
  from /home/ian/.rvm/rubies/ruby-2.2.1/bin/irb:11:in `<main>'
2.2.1 :007 >
Parent - - By jlnr (dev) Date 2015-10-04 09:35
See https://github.com/gosu/gosu/issues/306

Same issue as in this thread: https://www.libgosu.org/cgi-bin/mwf/topic_show.pl?tid=1208

I haven't been able to reproduce it... :(
Parent - - By jlnr (dev) Date 2015-10-04 09:36
Oops, I can actually reproduce it now.
Parent - - By redcodefinal Date 2015-10-04 20:18
I updated the main issue thread, thanks for the quick reply. The issue was because a Gosu::Window is no longer needed to load an image.
Parent - By jlnr (dev) Date 2015-10-04 20:57
Yep, but it was still a bug in Gosu because LOTS of code still uses the old interface, and I'll probably have to support it forever :) Anyway, great to know that it works now.
Parent - By jlnr (dev) Date 2015-10-04 10:15
Fixed in Gosu 0.10.4.
Up Topic Gosu / Gosu Exchange / undefined method `to_blob' for #<Game:0x000000025c3c38 @__sw

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill