Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Forum
1 2 3 4 5 6 7 8 9 10 Previous Next  
Search
Topic Raspberry Ruby - Could not initialize OpenGL By jlnr Date 2015-06-22 15:14
I've diffed the sources for Gosu 0.8.0 (which I know worked on Raspbian) and 0.8.7.2 and couldn't find anything that should cause this issue. =/ I wonder if anything in SDL 2 or Raspbian has changed since then. The only advice I can give is to compile an OpenGL ES 1.x demo that uses SDL 2 and see if it works on your machine. Sorry! I've already given away my Pi.
Topic Draw inside an existing HWND or NSView and second monitor By jlnr Date 2015-06-22 08:55
1) Ruby/Gosu uses SDL 2 to create the window for rendering OpenGL. There is a SDL_CreateWindowFrom() function that can create an SDL window from HWND and NSWindow, but I don't know how it would work with an NSView, especially when OpenGL is thrown into the mix.

2) nope :(

Considering that wrapping up Ruby/Gosu apps as .app/.exe files is a bit of a hack anyway...I think this is out of the scope of what Gosu can do. Sorry!
Topic Raspberry Ruby - Could not initialize OpenGL By jlnr Date 2015-06-22 08:45
I wonder if I have broken something in Gosu 0.9.x - I didn't have a chance to test this version on a Raspberry Pi. Can you please try using Gosu 0.8.x? If that helps, I'll need to grab a Raspi again and debug Gosu 0.9.x. Thanks.
Topic Gosu 0.9.2 released By jlnr Date 2015-06-15 08:53
I see. I've been meaning to finally replace enable_undocumented_retrofication with a new flag during image creation, e.g. Image.new("tile.png", :retro => true), same for load_tiles etc.; would this help?

(It's gotten a lot easier to actually implement this based on the new interface :) )
Topic Gosu 0.9.2 released By jlnr Date 2015-06-15 08:17
I've tried to reproduce this issue but it all looks good here. Does this gist work for you?

https://gist.github.com/jlnr/a42235af10f75159f2d9

It is creating a 12x2 sized image (pure white) and drawing it all over the screen. Or is it because your borders are separate images?
Topic Gosu 0.9.2 released By jlnr Date 2015-06-14 21:36
Ooohh, SDL 2.0.4 is coming closer! Can't wait: http://forums.libsdl.org/viewtopic.php?t=11294
Topic Gosu 0.9.2 released By jlnr Date 2015-06-14 21:35
Ouch! It's on my list. Hopefully updating to SDL 2.0.4 "soon" will fix the issue :)
Topic Gosu and RubyMotion (on OS X, for now) By jlnr Date 2015-06-14 21:23
I've been playing around with Gosu and RubyMotion lately, and I thought I'd share what the experience was like. RubyMotion is a commercial implementation of Ruby running on Apple's Objective C runtime (OS X, iOS), and on Android. I've only tried it on OS X so far.

To run Ruby/Gosu code in RubyMotion, I had to wrap Gosu in two thin layers of code. First, a set of Objective C classes that call C++ code - this part is called GosuKit, and in theory you could use it to write Gosu games in Objective C and Swift (but why...). It looks like this:

https://github.com/gosu/motion-gosu/blob/master/GosuKitTests/GosuKitTests.m

It is possible to call GosuKit from RubyMotion, but the method names are very un-Ruby-like: GSKImage.new.drawAtX(x, y: 5, z: 45...) and so on. So there is a second layer of paint called "motion-gosu" that wraps the GosuKit Objective-C classes in the familiar Gosu 0.9 interface:

https://github.com/gosu/motion-gosu/blob/master/motion/image.rb

It's not 100% complete - TextInput, custom OpenGL and loading images from "blobs" are all missing. Also, motion-gosu is not backward compatible at all - every step away from the new Gosu 0.9 results in an exception.

With these two things in place, I was able to get my old game Peter Morphose to run (half the levels, anyway). It's a very chaotic codebase, mostly translated to Ruby from Delphi source files written in 2001 - but it only took a few changes to get it to work in RubyMotion! That's pretty sweet :)

https://github.com/jlnr/petermorphose/tree/motion

Thoughts:
• RubyMotion does not use garbage collection. If you want to have circular references between objects, you have to use WeakRef - otherwise you'll leak memory. Auditing an existing Ruby codebase for circular references sounds frustrating.
• Everything about RubyMotion is extremely unforgiving. In one case I've passed :additive instead of the newer :add to Image#draw and had to use lldb (the low-level Objective C debugger) to figure out what was going on. So I'd always develop my game using "standard" Ruby/Gosu and then only wrap it up for release with RubyMotion.
• I'm not sure if you can keep your existing directory Ruby/Gosu structure and just add a RubyMotion Gemfile, Rakefile etc? I moved everything around to match the RubyMotion default structure.

iOS is next, obviously. My long-term goal is to run the same (unreleased) Ruby game on iOS and Android devices.
Attachment: Monstris.app.zip (2062k)
Topic Gosu 0.9.2 released By jlnr Date 2015-06-08 16:31
Cool thanks, will take a look. Maybe it's an SDL issue anyway :)
Topic Gosu 0.9.2 released By jlnr Date 2015-06-08 16:01
Thanks! Does it happen only in 0.9.x, or also 0.8.x? Do you have an example script for me to try?
Topic Benchmarks? By jlnr Date 2015-06-04 07:14
Gosu 0.9.2 and 0.8.7.2 have the same rendering backend. Even Gosu 0.7.x, which didn't use libSDL to open the window, used effectively the same OpenGL code internally. But still, go ahead and benchmark all the combinations you are interested in, maybe there are a few surprises :)

FWIW I saw this question on StackOverflow a (long) while ago: http://stackoverflow.com/questions/1784138/why-rubygame-and-gosu-are-slower-than-pure-opengl
Topic Loading Tiles By jlnr Date 2015-06-02 17:55
1. You don't need to pass a window reference around anymore in Gosu 0.9 :)
2. In Gosu 0.9, you can also omit the third argument, "false", to the Window's super constructor.
3. I think you should be fine if you replace this line:
        @tile.draw(x, y, 0)
with:
        @tile.draw(x * TILE_WIDTH, y * TILE_HEIGHT, 0)
x and y are indices into the arrays here, and by multiplying them with your constants you can convert them to pixels.
Topic Ruby.app 0.9.2 released By jlnr Date 2015-05-30 13:54
Long overdue, but here it is:

https://github.com/gosu/ruby-app/releases

Now bundles Ruby 2.2.1 instead of 2.1.2, and Gosu 0.9.2 instead of 0.7.50.

Please let me know if there are any issues with this version of the app wrapper.
Topic Will opengl gem work fine with Gosu 0.9.1? By jlnr Date 2015-05-29 08:57
The changes in Gosu 0.9 are really mostly superficial. I'm not sure why Ashton broke - but chances are that raw OpenGL will still work.
Topic Will opengl gem work fine with Gosu 0.9.1? By jlnr Date 2015-05-29 08:54
Yes! Thanks for reminding me to update the reference to ruby-opengl on the libgosu.org homepage.
Topic Gosu 0.9.2 released By jlnr Date 2015-05-25 11:54
I guess it would be possible to render to a texture and then scale it up, but I still haven't looked into render-to-texture at all.

My expectation was that it should actually look better if you render it at a higher resolution directly, but I'm not sure if that's true.

What kind of artefacts, by the way? Are you using the :tileable parameter to ensure crisp tile boundaries?
Topic Gosu 0.9.2 released By jlnr Date 2015-05-25 11:11
Awesome, good to know that Gosu by itself works.

I'd love to fork and fix both Ashton and Releasy, but before I get to Gosu 1.0 or so, I don't see it happening :(
Topic Gosu 0.9.2 released By jlnr Date 2015-05-24 19:10
Note: SDL_GetGlobalMouseState is only available in SDL 2.0.4, which is still not out by now (pending tickets: https://bitly.com/sdl204-todo). So it probably only fixes mouse_x and mouse_y if you use brew install sdl2 --HEAD on OS X.

Next up: Updated Ruby.app for OS X, if I don't receive any bug reports for 0.9.2 in the next days. Then CMake build files, and I'm playing around with RubyMotion as well.
Topic Gosu 0.9.2 released By jlnr Date 2015-05-24 19:07
Another tiny release to keep everything going – support for the current version of Ruby on Windows, and two fixes for things that actually used to work in Gosu 0.7.

• Windows: Support for Ruby 2.2.x
• Allow macro recording outside of Window::draw
• All: Use new SDL_GetGlobalMouseState function if available (this function tracks the mouse position even when it leaves the window)
Topic Gosu 0.9.0 released By jlnr Date 2015-05-17 13:38
You can either lazily record it inside the Window#draw call tree, or wait for me to fix this issue here: https://github.com/jlnr/gosu/issues/277

I wasn't sure if anyone already used record outside of draw, so I didn't make it a priority for 0.9.0 - oops. I'll try to address this later today.
Topic Gosu 0.9.1 released By jlnr Date 2015-05-17 10:03
Three bug fixes:

• Ruby: Fixes freeze-at-exit bug on Windows (thanks to RunnerPack for reporting this)
• Ruby: Fixes one uninitialised variable that could affect text alignment
• Ruby: Fixes backwards compatibility in Font#initialize
Topic Gosu Examples 1.0.3 released By jlnr Date 2015-05-17 09:47
Fixed - will push Gosu 0.9.1 in a bit. Thanks for reporting this!
Topic Gosu Examples 1.0.3 released By jlnr Date 2015-05-17 09:01
I write these errors myself using puts - if you don't have the rmagick gem installed, you won't see the RMagick related examples in the list. Same for OpenGL or Chipmunk.

Edit: I can reproduce this. Oops.
Topic Gosu Examples 1.0.3 released By jlnr Date 2015-05-17 01:04
(Versions 1.0.0, 1.0.1 and 1.0.2 was me being an idiot with the $LOAD_PATH, and have been yanked. 1.0.3 is the first public version.)
Topic Gosu Examples 1.0.3 released By jlnr Date 2015-05-17 00:39
I've moved all the Ruby example games into a separate Ruby gem: https://github.com/gosu/gosu-examples

Now you can simply run gem install gosu-examples and then gosu-examples to open a list of examples. The 'S' hotkey opens each example in a new text editor window.

Please let me know what you think—hopefully this will be easier to find (and maintain!) than the examples/ folder in previous Gosu gems.
Topic Gosu 0.9.0 released By jlnr Date 2015-05-16 23:37
Ouch, Gosu::Font#initialize does not seem to be backwards compatible. I'll see what other bugs I find until tomorrow and release v0.9.1 then.
Topic Gosu 0.9.0 released By jlnr Date 2015-05-16 23:11
This version finally implements the new, cleaner interface I had originally planned for Gosu 0.8.0. (This release does not introduce any other major features, nor does it fix any bugs.)

Basically, instead of this:

Gosu::Image.new(some_window, "filename", true)

...you can now write:

Gosu::Image.new("filename", tileable: true)

This does not rely on any global variables or other hacks - Gosu::Image is really independent from Gosu::Window now. All the constructors and factory methods have been completely refactored. All the rendering primitives, from draw_line to rotate(4) { ... }, now live directly inside the Gosu module, e.g. Gosu::draw_line(...).

The new interface has been documented in rdoc already: https://www.libgosu.org/rdoc/

Please let me know if anything that works in Gosu 0.8.x does not work in Gosu 0.9.x. In theory, this version should be 100% backwards compatible.
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:

https://github.com/jlnr/gosu/wiki/Getting-Started-on-OS-X
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.


https://www.libgosu.org/rdoc/ 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 Ruby.app 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: https://github.com/jlnr/gosu/wiki/Getting-Started-on-OS-X

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:

https://github.com/jlnr/gosu/issues/267

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 Image.new 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.

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill