Not logged inGosu Forums
Forum back to Help Search Register Login
Up Topic Gosu / Gosu News / Gosu 0.10.7 released
- - By jlnr (dev) Date 2016-04-25 07:36
A grab bag of fixes and updates:

• Windows: Support for Ruby 2.3.0
• Linux: Improve mouse getters/setters
• Ruby: Fix Gosu::random not being random
• All: Update stb_image, stb_image_write, stb_vorbis
• Mac: Reduce Gosu::Font artefacts
• Ruby: Fix compilation issues with Ruby 1.9.3

This is the first release of Gosu that uses both Travis CI and AppVeyor to ensure that things work as expected. Yay, green badges at the bottom! Cross-platform refactoring was a pain before this.

Also, the RubyMotion/iOS version works really well! I hope I can finish my game soon and document how to port stuff to iOS :)
Parent - - By jlnr (dev) Date 2016-04-25 07:39
Also, I've made sure that everything works on the new and shiny Ubuntu 16.04.
Parent - - By bestguigui Date 2016-05-18 17:06
Not really related to Gosu, but anyway. Is that worth it to upgrade Ruby to 2.3 ? I'm still using 1.9, mostly for gems issues.
Parent - By lol_o2 Date 2016-05-18 18:33
Depends on what gems are you using. I use Ashton and Chipmunk and they both work with 2.2.4, so with 2.3 they should too.
Newer Ruby should be faster, but rather not as significantly as 1.8 -> 1.9. You might also look what new features are from 1.9 to 2.3 to see if there's something interesting. I upgraded from 1.9 so long ago that I don't remember what has changed, really.
Parent - - By jlnr (dev) Date 2016-05-20 23:17
The biggest improvement in Ruby 2.0 for me was not ever having to start files with # Encoding: UTF-8 ever again :) (UTF-8 is the default now.)

Ruby 2.1/2.2 have introduced new syntax for named arguments, but I haven't really seen them in the wild yet.
Parent - - By bestguigui Date 2016-05-21 09:07 Edited 2016-05-21 09:28
Thank you for your answers !

Great for UTF-8, because my crazy native language uses a lot of accents (I'm french) !

I cannot install texplay, failed to create native extensions, even if I did install the devkit... This is one of the reasons I prefered the 1.9 version :(
Seems like I have to install manually Freeglut, which is not something I like because I'm afraid it will be harder to distribute as an executable after that.
Parent - - By lol_o2 Date 2016-05-21 10:45
I was successful to replace Texplay with Ashton in all of my projects. I doubt any of them is still maintained, but Ashton is much faster and has more features. It works fine with newest Gosu on 2.2.4 (2.3 too probably), but there's a problem that you need to perform any Texture/Shader operations in draw method. Well, at least for me it was a problem, because I had to move lots of code from update to draw. Other than that, every feature is working.
Parent - - By bestguigui Date 2016-05-21 19:49
Thank you, I'll give it a try. All I need is a get_pixel method, so in the worse case I'll add Chunky_png to my project, because the image that I need to read from will not be displayed on screen.
Parent - - By jlnr (dev) Date 2016-05-21 22:32 Edited 2016-07-05 23:36
If all you need is get_pixel, then you can probably just load a Gosu::Image, call to_blob on it (be sure to cache the result) and parse the binary data. Something like:

class Gosu::Image
  def [](x, y) # Returns a binary string with r/g/b/a as the characters
    @blob ||= self.to_blob
    if x < 0 or x >= width or y < 0 or y >= height
      "\0\0\0\0" # return transparent pixels by default; you could also return nil
      @blob[(y * width + x) * 4, 4]
some_image[x, y] # to read a pixel
Parent - - By bestguigui Date 2016-05-22 13:49 Edited 2016-05-22 15:29
Raaaah that is for sure awesome ! But, can you please confirm to me what you mean by "cache" in this context ? I guess that since you're using the ||= operator, you just keep the .to_blob result as an instance variable, not to call it each time.

And will it work for any Gosu::Image, or only power of two images ? Because I had some issues in the past trying to use the to_blob method.

EDIT : I tried, and it works great ! Thank you !
Parent - - By jlnr (dev) Date 2016-05-22 15:59
Yep, the ||= operator does the caching here.

It will work for any image (except record-ed ones), unlike gl_tex_info etc. which can fail for very large images.
Parent - - By bestguigui Date 2016-05-22 16:01
Oh yes, that was gl_tex_info that used to fail sometimes ! Thanks !

Gosu is really becoming huge, can't believe for how long you're dealing with it, thanks for you being so brave !
Parent - By jlnr (dev) Date 2016-05-22 20:26
np :)
Up Topic Gosu / Gosu News / Gosu 0.10.7 released

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill