Not logged inGosu Forums
Forum back to Help Search Register Login
Up Forum
1 2 3 4 5 6 7 8 9 10 Previous Next  
Topic Gosu 0.8.7(.2) released By jlnr Date 2015-05-16 21:25
Gosu 0.8.0 and later are not self-contained (sadly) - see this wiki page for a list of required libraries:
Topic Tutorials, somewhere? By jlnr Date 2015-05-02 23:23
Or you could just use Ruby 2.1 on Windows, that sounds like the easier plan :)
Topic Tutorials, somewhere? By jlnr Date 2015-05-02 09:36

> Gosu not working with Ruby 2.2 for some reasons that are not clear to me

I assume you are on Windows. I need to pre-compile Gosu for each version of Ruby, and I haven't done this for Ruby 2.2 yet. (Maybe I'm wrong and 2.1 and 2.2 are actually compatible, who knows...)

> All the ones I found are outdated and will make the interpreter trow out errors at some point

Give us examples and we have a chance to fix these errors :)

> Also, the documentation seems to be absent. works, so there's a reference at least.

You are right that documentation is really, really lacking, but there's not much that I can do right now. If I had more time to work on Gosu, I would still try to work down the known issues on GitHub before I'd write another tutorial. Typical Open Source priorities, I guess. Sorry - if you ever figure out how to use Gosu and write down the results, let me know and I'll link to it.
Topic Encrypt and update all the things! By jlnr Date 2015-03-23 04:14
Since we all post lots of unsandboxed code here, I figured it'd be a good idea to switch this site to HTTPS. If the free certificate causes any trouble for you people, please let me know.

I've also updated and fixed the board software. Subscriptions, RSS & file attachments should work again. Oops.

The Windows ZIP archives, Linux source tarballs and the OS X for Gosu 0.8.x are still broken/missing. Just how many moving parts can one library have? :)
Topic Ubuntu, geany By jlnr Date 2015-03-19 04:37
Good to hear :)

If you see that error, have you maybe written require gosu instead of require 'gosu'? Or maybe you tried to access gosu::Image instead of Gosu::Image? Ruby is basically complaining that there is no thing called gosu when you are trying to use it.
Topic Upgrading from older Gosu to Gosu 7.47 By jlnr Date 2015-03-17 04:59
Sorry for the slow response. I've just gone through the steps and they work for me, but it is important to open the newly created .xcworkspace file, not the .xcodeproj. If I try to compile the latter, I receive the same error.

What CocoaPods does is essentially create a new .xcodeproj for Gosu, and link it together with your project in the .xcworkspace file. HTH :)
Topic Ubuntu, geany By jlnr Date 2015-03-17 04:41
Well, did you follow the steps for Ubuntu on the Wiki page that is referenced in the error?

You shouldn't have to download Gosu either, gem install gosu does all that for you :) The Ruby version does not require the C++ version to be installed, it is self-contained.
Topic Inception (2d top down survival shooter) By jlnr Date 2015-03-11 07:54
:( I didn't figure out how to exit the first level. Do you have to kill ALL the zombies?

In any case, it's a fun Crimsonland-style game, but the player's collision detection could need some work :) Sometimes the player stops a few steps away from a wall, but then when you rotate a little you can almost move into the wall. Feels like a simple bounding box would work better.
Topic How to compile tutorial? By jlnr Date 2015-03-07 09:57
So much for "this month" - sorry about that. I've fixed a bunch of different issues, the Tutorial-Touch example works for me now after I run pod install.

My own C++ game still has some scaling issues on iOS, but I hope they're not bugs in Gosu...
Topic Upgrading from older Gosu to Gosu 7.47 By jlnr Date 2015-03-07 07:09
There is no Gosu.framework anymore. Can you please follow this guide and set up Gosu using CocoaPods:

It's a bit unusual for a C++ project, but it has been working pretty well for me. My deployment target is 10.7, I use the gnu11 standard and libc++ (which is sadly incompatible with OS X 10.6.8 and below).

The biggest pain point was finding a version of boost that works. brew install boost149 and adding /usr/local/opt/boost149/include to my target's header search paths did the trick.
Topic Window.record can't store Window.draw_triangle ? By jlnr Date 2015-02-25 03:00
Hey, that seems to be a bug in how triangles are handled inside record (which does not render to a bitmap, but into an OpenGL vertex array). I've created a github issue:

As a workaround, you can use draw_quad instead of draw_triangle and repeat the third coordinate/colour:

      draw_quad(width/10, height/10, Gosu::Color::RED,
                width*9/10, height/2, Gosu::Color::GREEN,
                width/2, height*9/10, Gosu::Color::BLUE,
                width/2, height*9/10, Gosu::Color::BLUE)

This is what Gosu will probably do internally soon, GL_TRIANGLES and GL_LINES are not worth all the special cases in the rendering backend.
Topic How to compile tutorial? By jlnr Date 2015-02-16 01:16
One thing you can try is to check out the latest 0.7.x tag. I am still working on fixing all the build files in Gosu 0.8.x. Sorry for the delay, I'm traveling now, but I'll look into it at some point this month.
Topic Gosu 0.8.7(.2) released By jlnr Date 2015-02-09 20:40
There isn't - but I agree that Gosu's button_id model too simplistic. :) Rewriting Gosu's input interface has always been on my long-term wish list, but I didn't have a good plan for it, and gamepads have generally been a mess back then (USB gamepads from various no-name vendors).
Thankfully, SDL 2 has added support for high-level "Game Controllers", and Gosu can simply provide a thin wrapper around their interface. Yay! Less thinking and more grunt work for me. I don't have a time line, but contributions are welcome.
Topic mouse movement By jlnr Date 2015-01-25 22:25
Thanks for sharing this! Some code feedback-

You can safely delete the MouseTrap#initialize method. You can set instance variables even if they have never been used or declared in initialize.

In fact, you don't need instance variables at all :) You can simply use local variables in #update(window) (basically delete all the @ signs).

window.width is not necessarily the width of the window in pixels. If you try to create a 8000x6000px Gosu::Window, Gosu will automatically scale the window down to fit on the screen. However, window.width will still return 8000 so that your calculations stay intact. This would break your script.
You can use GetClientRect instead to retrieve the size of the window's contents in pixels.
Topic Gosu 0.8.7(.2) released By jlnr Date 2015-01-18 23:28
This is a minor Ruby-only release while I keep working on the CMake build system for C++.

Two fixes:
• All: Improve gamepad support by using the SDL_GameController API
• Windows: Fix LoadError in Ruby 2.1.x x64 gem

SDL_GameController provides a streamlined interface for accessing common gamepads. For example, the Xbox 360 controller reports six axes (plural of axis, not ax…) when you query it over USB: x/y of each analog joystick, plus both analog shoulder buttons. The D-Pad is reported not as a single "hat", but as four completely unrelated buttons. This doesn't match Gosu's heuristic which maps axes and hats to the four directions, and buttons to GpButton0 through GpButton15.

SDL_GameController knows about common gamepads and maps them to sane values. In the case of the Xbox 360 controller, both analog sticks and the D-Pad are translated into the four directions, and only actual buttons are mapped to the GpButton* constants.
Topic Isometric City Generator By jlnr Date 2015-01-18 23:10

> When I start the record the width and height I supply doesnt seem to matter at all, as long as it is > 0.

It matters if you want to query image.width or image.height, and when you rotate the image around its centre or use Image#draw_quad. If you don't plan on doing either of these things, you can just pass 1, 1.

> Even weirder when I draw the image at 0,0 the top of the image is off the top of the screen, which doesn't really make any sense.

I agree that it's not intuitive, but there is no elegant 'fix', and it might actually have creative uses. :)

EDIT: It's a pleasure, thanks for playing with Gosu!
Topic Isometric City Generator By jlnr Date 2015-01-18 21:35
Hey! Definitely the right place to post this and ask questions.

Performance: Instead of storing things in an array, you can group "slices" of the city into a macro by using Window#record { lots_of_rendering_here }. This will return an image that captures all rendering code in the block into OpenGL vertex array for efficient reusing. (Efficient enough that you shouldn't have to worry about skipping obscured blocks.)
Of course, this is yet another way of saving things to memory - but Ruby just isn't efficient enough to do all the calculations at 60 FPS. And record is definitely cleaner than taking a screenshot of the window.

Z-order issues: Assuming that no block can contain two things at once, can't you just draw the whole box with the Z-position of the block that is the furthest away from the camera? Pretty hard (but fun) to reason about it without playing with the code :)
Topic Transparent window background By jlnr Date 2015-01-18 21:06
Interesting! I didn't expect this to be possible after my short trip into Raspberry Pi land.

If you want to see this feature in Gosu, you can lobby to get it fixed in SDL 2 and I'll add a short wrapper in Gosu. Window#shape=(image) or such. But only if it works on at least one platform :)
Topic Transparent window background By jlnr Date 2015-01-18 10:03
I would be surprised if it was supported on the Raspberry Pi, as I couldn't even get 'normal' windowed mode to work :)

And a general SDL 2 tip - the stable v2.0.3 is pretty old. Sometimes things work better if you build from source.
Topic Transparent window background By jlnr Date 2015-01-17 10:20
Good question. In Ruby: not directly.

In C++, it might be possible by calling SDL_SetWindowShape. I don't know if this even works on all platforms, though. I have never seen a non-rectangular window on OS X :)

The last time I've tried to do something like this (for a kiosk system, anyway) I've launched a video player in full-screen mode and placed it over the game window.

oli.ok has also written an extension for Gosu once that streamed a video file onto an OpenGL texture (i.e. Gosu::Image). This allowed for all kinds of crazy effects, but was a Linux-only, one-off project.
Topic gives unknown error By jlnr Date 2015-01-17 00:40
That's a libfreeimage error, the only one the library ever seems to return :)

As RunnerPack has pointed out, it's usually caused by the image file not being there. You are trying to load "block_shade,png" with a comma instead of a dot.

You can use relative filenames just fine, but you need to be sure to run the game from the right directory if you do. E.g. you cannot cd into content and then run ruby ../game.rb.
Using paths relative to __FILE__ can protect you against this. It all depends on how you distribute your game, I guess.
Topic Low quality textures on Raspberry Pi By jlnr Date 2015-01-15 19:18
If both SDL_Image and FreeImage (Gosu) lead to bad image quality, then no...

I think I'm out of ideas. Just don't use gradients ;P
Topic Low quality textures on Raspberry Pi By jlnr Date 2015-01-15 18:47
Do you think it might be the image loading code? Gosu uses libfreeimage - what did your C++ test use, SDL_image?

FWIW the screenshot in your post to looks a lot worse here than the image three postings up - but that might just be a side-effect of you uploading the image to imgur. Their compression is extremely lossy.
Topic Low quality textures on Raspberry Pi By jlnr Date 2015-01-15 17:14
This is really curious. Gosu only uses SDL 2 to set up an OpenGL ES context, all rendering is handles by OpenGL.

Does the image look good if you open it in a web browser on the Raspberry Pi?
Topic Low quality textures on Raspberry Pi By jlnr Date 2015-01-15 10:26
Nope - this project is all about displaying large images and as far as I know, it works just fine:

Can you provide a screenshot or photo of what you are seeing?
Topic Create Blur effect? Window.record? By jlnr Date 2015-01-10 11:03
Oh, permanent :)

In that case record is indeed relevant. But it does not render to a texture, it only groups a lot of Image#draw calls into a vertex array, so it is not unlimited. And you cannot add to an existing, recorded macro.

Ashton has render-to-texture functionality, but I don't know how well it works:

Only that would allow your simulation to go on forever.
Topic Create Blur effect? Window.record? By jlnr Date 2015-01-09 23:15
If you want objects to leave a trail, you can just remember the last (up to) 10 positions and draw the object at that place, but with a colour that has an ever-decreasing alpha channel. You can also try increasing or decreasing the size of images as they fade out, using the scale_x and scale_y parameters. (No code, sorry...)

For a true blur effect, you would probably have to look into GLSL shaders based on Spooner's Ashton library. I've never tried this myself, though.

Window#record does not help here, it mostly exists to speed up batch rendering of thousands of images, typically map tiles.
Topic Creating Game Loop By jlnr Date 2015-01-04 23:30
Fair enough. It should be easy to expose each part of Window#show in Ruby now, thanks to the new unified SDL backend, and that would make it possible to implement other kinds of loops. Feel free to open an issue here: - but as you can see, I am not even close to catching up with all the existing ideas. :/
Topic Creating Game Loop By jlnr Date 2015-01-04 11:43
Sadly, that's not possible in Ruby/Gosu. Out of curiosity, are you trying to integrate Gosu with EventMachine or a GUI toolkit?
Topic Display XML tags in font.draw By jlnr Date 2015-01-03 12:56
You can't, that's a bit of a problem with Gosu currently. :( By default, Gosu only supports <, > and &.
Topic No Sound? Help T.T By jlnr Date 2014-12-13 00:24
Oops, that wasn't very clear. Yes, you will be able to install 0.8.7 once it's out! Which it isn't yet :) Sorry.

The C++ build files are in a pretty bad state, so I'll try to polish those a little before releasing 0.8.7.
Topic No Sound? Help T.T By jlnr Date 2014-12-12 16:31
See my answer to lol_o2 - I've been able to reproduce and fix the issue. Thanks for reporting this!
Topic No Sound? Help T.T By jlnr Date 2014-12-12 16:31
I don't understand the bug but I've fixed it. :) You should be able to install 0.8.7 without any further trouble.
Topic No Sound? Help T.T By jlnr Date 2014-12-12 09:56
I think the first step would be to verify that the actually works. For that I usually require it from irb using an absolute filename, then I verify that,100,false).show() shows a window as expected.

If the works and it's only that require can't find it, maybe you could play around with the path - it might be something really silly like the difference between / and \? (So far I've been lucky and / has worked consistently)

Sorry for the trouble, anyway. I can't believe that there is only ONE!! distribution of Ruby 2.1-x64 for Windows and even that behaves differently on different machines %)

(And I also had to do the SSL certificate dance...)
Topic No Sound? Help T.T By jlnr Date 2014-12-11 20:08
If you look at C:\Ruby21-x64\lib\ruby\gems\2.1.0\gems\gosu-0.8.6-x64-mingw32\lib\gosu.rb you can see that it tries to require the version-specific binary first, and then below rescue LoadError it tries to fall back to (which is built by the extconf.rb on other platforms).

If you comment out the rescue LoadError and the line directly below it, what is the error message?
Topic No Sound? Help T.T By jlnr Date 2014-12-11 09:46
What is the output of ruby -e "puts RUBY_PLATFORM"?

I am using the x64 RubyInstaller build of Ruby 2.1, but no DevKit. The only thing I did before installing Gosu was gem update --system.
Topic Gosu 0.8.6 released By jlnr Date 2014-12-10 20:25
Cool, good news!

Re: LoadError, I'll wait for a second person to report this error before I look into it...might be my fault :)
Topic No Sound? Help T.T By jlnr Date 2014-12-10 19:46
Can you please try the 64-bit version of Ruby 2.1.5 from I have just released a 64-bit version of Gosu that uses an updated OpenAL32.dll. The next 32-bit version will also have a more recent DLL, but I didn't want to re-release the 32-bit gem of 0.8.6 just for that.
Topic Gosu 0.8.6 released By jlnr Date 2014-12-10 19:43
x64 is out now, please let me know if it works as expected. Ruby 2.1.x only.
Topic No Sound? Help T.T By jlnr Date 2014-12-08 23:32
I was curious if you'd have a Creative audio chip and you do. They're the company behind OpenAL (mostly), so I wonder if that makes it somehow use different code on your computer? Maybe some hardware acceleration that fails, because I use a custom build of OpenAL soft? Hmm.
Topic Ruby: Gosu 0.8.5 on Ubuntu 12.04 By jlnr Date 2014-12-08 22:50
Thanks! And I've just noticed that it's pretty similar to my experience on the Raspberry Pi. Man, I'm looking forward to a time when every Linux distro comes with a stable SDL 2 package. :)
Topic No Sound? Help T.T By jlnr Date 2014-12-07 20:52
Do you know the specs (mostly, the mainboard) of your machine? I am really at a loss how to debug this :) It seems Wurm Online uses OpenAL Soft just as I do. The only difference I can imagine is that they might be using a 64-bit version.
Topic No Sound? Help T.T By jlnr Date 2014-12-07 17:54
That's curious. Do you happen to own any of these games? Do they work?

I don't understand why OpenAL is so problematic on Windows... :(
Topic Gosu 0.8.6 released By jlnr Date 2014-12-06 23:00
Thanks for testing and that's great to hear :) The x64 version is a bit more involved. To support a new Ruby version, I only need to extend Gosu a little, and this is now a well-documented process (phew):

For the x64 version, I will also need to hunt down each of Gosu's dependencies in 64-bit. Most libraries offer a precompiled x64 DLL nowadays though, so I'm almost there. :)
Topic Gosu 0.8.6 released By jlnr Date 2014-12-06 20:39
Just another maintenance release:

* Windows: Add support for Ruby 2.1.x
* All: Check SDL 2 return values when creating the Window (helpful when there is no OpenGL capable video driver)

Also, the release process is a little messed up. There have been no 0.8.x source tarballs so far. The new directory structure in 0.8.0 also broke the CMake setup. I'll try to fix these issues and follow up with a working 0.8.6 source tarball. Hopefully that will make it easier to get C++ Gosu into package managers such as Homebrew (see
Topic Ruby: Gosu 0.8.5 on Ubuntu 12.04 By jlnr Date 2014-12-06 15:53
Hey. Thanks for the cookbook!

If you have a minute, you could apply some Markdown formatting and add it here:

That's the canonical place for Linux build instructions, and I think anyone can edit the page (might require a github account?) :)
Topic homebrew formula By jlnr Date 2014-12-06 11:38
Okay, I think this has to be a long-term effort. Until C++ Gosu has been packaged for all common Linux distributions (which are more conservative than Homebrew), I should probably not mess with the self-contained Ruby gem. :/ Nobody wants to sudo make install a random C++ library on a clean install of Ubuntu.

So I shall focus on CMake for C++ for now...
Topic homebrew formula By jlnr Date 2014-12-06 01:34
The CMake build files used to support the Mac, but I'm not sure how I would even verify that. I should probably take a day off with a good book and learn CMake; the only command-line build tool I know anything about is Rake. :)

The extconf.rb would definitely be a lot more "normal", if there was a C++ libgosu.dylib to link against.

And if I ever want to ship precompiled Mac gems again, with no dependencies on Homebrew - that is still technically possible. (Just painful.)

I'm pretty much sold on the idea of splitting up my repository and turning the C++ core into a proper library. I'll try to abuse the Ludum Dare weekend for that. :) Thanks again for the work & PR! It's also great to see that Homebrew's PR review system is thorough and helpful.
Topic homebrew formula By jlnr Date 2014-12-05 13:05
Thanks! Nice hack :) If I can't find a way to get rid of the sdl2-from-homebrew dependency, maybe it would be better to move C++ Gosu (cleanly) into homebrew and provide a thin Ruby wrapper as a separate gem? I could probably clone my repository on github and call the C++ part libgosu. Hmm, I like that.

One alternative on OS X is to use CocoaPods (the podspec only lives in Gosu's repository for now). But there's no conflict here - brew installs Gosu on a Mac computer, pod includes it (statically) in a Mac app.
Topic Gosu Warriors By jlnr Date 2014-12-04 18:22
Wow, this is beautiful! *downloads code*

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill