Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Forum
1 2 3 4 5 Previous Next  
Search
Topic Ashton causes window to go blank By RunnerPack Date 2015-03-09 19:51
I thought this, too, but I modified the "bloom" demo that comes with Ashton to include a black line, and it seemed to work fine. How did you test to find out it didn't work?

Your buffer workaround seems to work, which is confusing because Ashton's Window#post_process already uses a buffer system.

Now I have to figure out why the interleaved image is so blurry...
Topic Ashton causes window to go blank By RunnerPack Date 2015-03-08 18:49
Hi, Spooner, (or anyone willing to take a look)

I have a problem with Ashton, and I wonder if you could shed some light, when you get a chance.

I'll preface this by saying that Ashton seems to work fine on my system; the examples all display perfectly, and even other things I've made work, up to now... This leads me to believe I'm just doing something silly, but I cannot find out what that is! I've even looked through Ashton's code to see what might be happening, to no avail.

Here's the gist: https://gist.github.com/runnerpack/6d51f5b40eff1bf1107a#comment-1408520 (Note: the comment explains what I'm trying to do.)

Any insight you can offer will be greatly appreciated.
Topic Enemy should trigger a bullet By RunnerPack Date 2015-02-26 04:36
That's okay... it happens to the best of us :D
Topic Enemy should trigger a bullet By RunnerPack Date 2015-02-25 18:40
Actually, passing a block to Array.new does create separate objects. I think it's functionally identical to your second example.

This can be readily tested in IRB:

irb(main):005:0> bullets = Array.new(5) { Numeric.new }
=> [#<Numeric:0x2cdaf38>, #<Numeric:0x2cdaf20>, #<Numeric:0x2cdaf08>, #<Numeric:0x2cdaef0>, #<Numeric:0x2cdaed8>]


As you can see, five objects with different IDs are created.
Topic Image.new gives unknown error By RunnerPack Date 2015-01-17 00:52
Well, I did say it was a guess ;)
I think that error comes directly from the library (FreeImage?) used to load the image. If it's opening the right file, that error usually means it can't load the file, for some reason, e.g. unsupported (sub)format, damaged file, etc., but I've downloaded both block.png and tile.png, and a minimal program loads and displays either one perfectly fine (even from a relative path). I'm out of ideas :/

EDIT: jlnr beat me to it on FreeImage, and found the real problem :P
Topic Image.new gives unknown error By RunnerPack Date 2015-01-16 23:06
Just a guess, but it's probably not finding the PNG file. You should generate an absolute filename based on the path of the script (e.g. using __FILE__).
Topic Create Blur effect? Window.record? By RunnerPack Date 2015-01-10 08:24
If you just want a fixed, permanent trail sticking out in one direction from an image, you're probably better-off pre-rendering it in a paint program and saving it as a PNG. Sounds kinda boring to me, though...
Topic Display XML tags in font.draw By RunnerPack Date 2015-01-02 21:24
It supports entities, e.g. "&lt;" for "<", so just substitute them for the real characters.
Topic Problems installing: "SDL2/SDL_ttf.h: No such file" By RunnerPack Date 2014-12-31 22:31
Any time, shadowfirebird. I was about to post that (I think) 0.8.0 was the first version using SDL2, and that 0.7.50 would be worth a try. Maybe that'll help someone else, if they're unable to install SDL2.
Topic Problems installing: "SDL2/SDL_ttf.h: No such file" By RunnerPack Date 2014-12-31 18:28
It looks like it's looking for "SDL2/SDL_ttf.h", and you only have "SDL/SDL_ttf.h" (unless that was a typo in your message).
Topic No Sound? Help T.T By RunnerPack Date 2014-12-13 02:53
Yes, I kind of thought that might have been what you meant, after I posted. No harm done, so you're forgiven ;)

In the meantime, I applied lol_o2's fix, and Gosu does indeed work great with 2.1-x64, so... yay! :D

I'll need to come up with some kind of benchmark to see if it was worth all the rigmarole ;)
Topic No Sound? Help T.T By RunnerPack Date 2014-12-12 19:50
Any time; glad to be of help.
Topic No Sound? Help T.T By RunnerPack Date 2014-12-12 19:34
I just tried to "gem update gosu" and it can't find 0.8.7. I even tried to force the version number, and I got an "access is denied" message.

If you just want to wait and release 0.8.7 with some other, less windows-specific fixes, I can just use something like lol_o2's cludge to get it working in the mean time.
Topic No Sound? Help T.T By RunnerPack Date 2014-12-12 04:50

ruby -e "require 'gosu'"
C:/Ruby21-x64/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:128:in require': cannot load such file -- ../lib64/2.1/gosu.so (LoadError)
        from C:/Ruby21-x64/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:128:in
rescue in require'
        from C:/Ruby21-x64/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:39:in require'
        from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/gosu-0.8.6-x64-mingw32/lib/gosu.rb:16:in
<top (required)>'
        from C:/Ruby21-x64/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:128:in require'
        from C:/Ruby21-x64/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:128:in
rescue in require'
        from C:/Ruby21-x64/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:39:in require'
        from -e:1:in
<main>'

But, AFAICT, the file it's trying to load is actually there, and it's a valid, executable file. Does it need an absolute path, instead of a relative one, perhaps?
Topic No Sound? Help T.T By RunnerPack Date 2014-12-11 19:30

> What is the output of ruby -e "puts RUBY_PLATFORM"?


x64-mingw32

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


That got it to install, but there seems to be a problem with gosu itself.

Actually, I wasn't able to update rubygems, at first. Even when I included the "--source" thing, I still got the SSL connect error. I solved it by getting "cacerts.pem" from: http://curl.haxx.se/docs/caextract.html and putting it in the "C:\Ruby21-x64\lib\ruby\2.1.0\rubygems\ssl_certs" folder.

Even though "gem" reports gosu as being installed, I get a LoadError when I try to 'require' it (even if I "require 'rubygems'" first):

D:\devgosu>ruby -e "require 'gosu'"
C:/Ruby21-x64/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in require': cannot load such file -- gosu.so (LoadError)
        from C:/Ruby21-x64/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in
require'
        from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/gosu-0.8.6-x64-mingw32/lib/gosu.rb:16:in rescue in <top (required)>'
        from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/gosu-0.8.6-x64-mingw32/lib/gosu.rb:11:in
<top (required)>'
        from C:/Ruby21-x64/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:128:in require'
        from C:/Ruby21-x64/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:128:in
rescue in require'
        from C:/Ruby21-x64/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:39:in require'
        from -e:1:in
<main>'


I looked for 'gosu.so' and found it in "C:\Ruby21-x64\lib\ruby\gems\2.1.0\gems\gosu-0.8.6-x64-mingw32\lib64\2.1", which seems to be where "C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/gosu-0.8.6-x64-mingw32/lib/gosu.rb" is looking for it, and it appears to be a proper, 64-bit, Windows PE DLL, so I'm confused.
Topic No Sound? Help T.T By RunnerPack Date 2014-12-11 06:13
Sorry to hijack this thread, but I'm having a related problem (and I also want to help test the 64-bit Gosu).

I am also running Win 7 64-bit, but I have no problem with sounds in any recent version of Gosu under (32-bit) Ruby 1.9.x (I have Realtek audio hardware). However, I can't try the new 64-bit Gosu, because 'gem' refuses to install it. Here's the error message:

C:\Ruby21-x64\bin>.\gem ins gosu --source http://rubygems.org
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing gosu:
        ERROR: Failed to build gem native extension.

    C:/Ruby21-x64/bin/ruby.exe extconf.rb
This gem is not meant to be installed on Windows. Instead, please use:
gem install gosu --platform=i386-mingw32

extconf failed, exit code 1

Gem files will remain installed in C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/gosu-0.8.6 for inspection.
Results logged to C:/Ruby21-x64/lib/ruby/gems/2.1.0/extensions/x64-mingw32/2.1.0/gosu-0.8.6/gem_make.out


So, taking a cue from the "--platform=" thing, I tried using --platform=x64-mingw32, but there was no change in the response.

So, what am I supposed to tell 'gem' to get it to install the 64-bit version of Gosu? Could this be caused by Ruby 2.1 and its devkit not being on the path (or that the 32-bit stuff is on the path)? I installed the 64-bit devkit according to the FAQ, and it seemed to work. Would using "pik" to manage the two versions help? (I don't feel comfortable going "all-in" with either Ruby 2.x or 64-bit, at this time.)

Also, does anyone know how to fix the SSL certificate problem (in Windows) so I can stop using the --source http://rubygems.org work-around?
Topic Calculating collision with isometric tiles By RunnerPack Date 2014-11-11 00:25
Well, obviously there will have to be some kind of coordinate scaling involved, or you could use floats to hold the sprite positions, and just truncate (floor) to get the integer tile coordinate (and, when projecting to the screen, multiply by how many pixels "wide" a tile is; i.e. from one side to its parallel side, not from corner to corner).
If you want to (or have to) work with sprite positions in pixels, you could reverse-project the pixel position (i.e. the center of the bottom edge of the light-blue rectangle) back to the map coordinates for testing (which will also require some scaling/truncation).
Topic Calculating collision with isometric tiles By RunnerPack Date 2014-11-10 19:06
You're making a lot of unnecessary work for yourself trying to do collision testing in "screen-space". Just keep the player's position in the same, rectangular coordinate system you're using for the map (the "0/0", etc.), test for collisions with simple array operations, then project the player's position to screen-space for drawing, afterward.
Topic Gosu collision classes By RunnerPack Date 2014-09-29 17:01
My point wasn't to give the game the ability to alter the time-step "on the fly". I just thought it would be better to have the time-step match whatever the programmer already chose for Gosu's update rate. This way, there is only one place to make the change, so they will always match.

Thanks for that bit of insight into physics engines, though.
Topic Gosu 0.8.4 released By RunnerPack Date 2014-09-29 00:09
I think the problem might be the way "gem.bat" (included with the RubyInstaller) calls the gem Ruby script. I just used a mingw bash shell (included as part of the RubyInstaller devkit) to run "gem update" – i.e. I ran the Ruby script directly – and it installed Gosu 0.8.5 without complaint. I then ran "gem list" and it showed both versions of Gosu as being for "x86-mingw32". So, I guess I just won't use gem.bat anymore. Sorry to bother you :D
Topic KbEscape not registering By RunnerPack Date 2014-09-18 17:15
Great! Glad you figured it out. I also have Intel HD, and the hotkey function was one of the first things I disabled, merely for CPU cycle conservation reasons (I also use the old "Win9x" theme instead of Aero ;).
Topic Gosu 0.8.4 released By RunnerPack Date 2014-09-18 06:13
I have a problem concerning RubyGems and "platforms".

In the last few versions of Gosu (I think starting with 0.8.0) when I try to "gem update" or "gem install gosu", it says something about the gem not being for my platform, and to use "--platform=i386-mingw32". Since I thought that was the version of Ruby I was using (the output of "ruby -v" even includes the string "i386-mingw32") I started digging around in rubygems to see what was going on, or at least how I could make that the default. I found out that rubygems keeps a list of supported platforms, so I ran "gem env". This produces, among other things, the platforms list: "ruby" and... "x86-mingw32"?!
I'm guessing the problem is that the Gosu gem now targets "i386-mingw32" instead of "x86-mingw32". If this is the case, is there a specific reason for the change? For example, is this the platform returned by the rubygems included with the latest 1.9.x or 2.x RubyInstallers?

I searched the RubyInstaller github for this issue and came up empty. I'm not even sure it's their fault rather than that of the rubygems maintainers themselves. Even if it is, I don't even have the latest build of 1.9.3, let alone 2.x, and I thought that might be my problem, so I want to upgrade before posting an issue.

EDIT: I just updated rubygems, and it still shows the same list of platforms. I'm thinking this is where the problem lies, and I should complain to them about it…
Topic KbEscape not registering By RunnerPack Date 2014-09-18 03:30
The only thing I can think of is Windows or some program is trapping the Esc key for some reason.

I tried your code, and I get ID 41 for Escape (Win7 x64, same Ruby/Gosu versions)

Have you tried #button_up to see if it catches the release code?

Does Fn+Esc do anything?

You could try a keyboard testing program, just to rule out hardware damage (although if that was the problem, the onscreen keyboard would still work).
Topic Making portions of a quad transparent? By RunnerPack Date 2014-09-15 01:14
You should really be thanking the geniuses responsible for Gosu and Texplay, but I'm glad I was able to help in some small way :D

I can't wait to play the completed game; it looks quite interesting!
Topic Making portions of a quad transparent? By RunnerPack Date 2014-09-14 20:43
As you've discovered, you cannot manipulate the images this way after they've been drawn to the screen. You have to modify the actual pixel data of a Gosu::Image; specifically the alpha channel. The gems "texplay", "rmagick", and "ashton" all allow you to do this. I'll leave it to you to decide which of these best fits your requirements. There are ways of doing it with Gosu alone using Image#to_blob, but the gems I mentioned will likely be more performant in a real-time simulation/game.

Besides actually working, the added benefits of this method are two-fold: 1) you'll be able to make anti-aliased tunnels, rather than simply fully transparent tunnels in fully opaque "dirt" (assuming that this is supposed to be dirt), and 2) you won't have to keep track of all those quads. It will be sufficient to keep track of the positions of the orange sprites.
Topic Gosu collision classes By RunnerPack Date 2014-09-02 23:53
Hey, this is great! Thanks for sharing!

Tiny suggestion: Add one argument to pass a Gosu::Window to Collision_Manager's constructor, and use its #update_interval instead of hard-coding the delta-time. It could also be used for "debug drawing", if one wanted to add that (it would be pretty easy to convert your existing example code).

Also, I noticed some references to "lights" in the readme, which was a little confusing at first (copy/paste error?)
Topic Gosu 0.8.0 released By RunnerPack Date 2014-08-21 22:12
Can't you just use the mouse position as a virtual joystick and change rotation speed according to the distance from the center of the screen?

EDIT: Also, I noticed that the mouse position is no longer updated when the cursor is outside of the window. I guess this is logical, and probably even simplifies certain tasks, but the former behavior was actually kind of handy in a couple of programs where I only cared about the angle of the mouse relative to the center of the window. I'm not complaining, and I don't think it's worth putting in an option or changing it back. However, if it is an easy change, a good compromise might be to go back to detecting the mouse outside the window, but clipping the coordinates to the client area.
Topic How do I create simple lightning? By RunnerPack Date 2014-07-20 23:24
Wow, nice work! I haven't looked at the code, but if it's as easy to integrate as it says in the readme, I definitely have some uses for this! Thanks for sharing.
Topic RubyMotion coming soon on Android By RunnerPack Date 2014-05-30 06:19
It sounds pretty impressive, but the $200 price tag is a bit steep... It would take a lot of app purchases, banner taps, or microtransactions to pay that back!

I do want a solution for Ruby on Android – especially if Gosu is ported, too – but preferably one more in-keeping with the open nature of Ruby itself (and libraries like Gosu). That blog goes into surprising detail about how they pulled theirs off (including which open-source software they used – namely LLVM) so the feat should, in theory, be reproducible as FOSS. Of course, it would also be possible to offer it for a more reasonable price, perhaps using crowd-funding to get it off the ground.
Topic Preview: Gosu on Raspberry Pi (SDL 2 based) By RunnerPack Date 2014-05-02 19:15
That's okay about Gosu only using one core; the BPi is still over twice as fast as the RPi, even with one core tied behind its back! ;)
Besides, there are plenty of non-Gosu things the other core could be used for. Maybe something to do with custom input hardware or computer vision (PS Move?).
Topic Preview: Gosu on Raspberry Pi (SDL 2 based) By RunnerPack Date 2014-05-02 04:30
I hope SDL 2 supports the GPU on the Banana Pi, as well; now or in the future. Gosu on a 1GHz dual-core ARM7 with 1GB of RAM sounds SWEET! (pardon the pun ;) If it works, I am DEFINITELY building a game-console/arcade cabinet with one! (I'm not sure it's worth it on the RPi...)
Topic Are retro-style supported? By RunnerPack Date 2014-03-02 06:50
Try Gosu::enable_undocumented_retrofication
Topic hackable game editor project? By RunnerPack Date 2014-02-23 19:14
Oh, so I completely missed the point, then... Well, the only thing I have that's even remotely related is a SketchUp plugin that exports ActionScript3 (Flash) source for Box2D physics objects. I doubt if any of it would be useful in this case. I do look forward to seeing anything you end up sharing, though.
Topic hackable game editor project? By RunnerPack Date 2014-02-21 17:17
I'm glad you figured it out.

As for an "off-the-shelf" game editor that supports this, that I don't know. Frankly, if you're looking for an all-in-one solution for making games, you've come to the wrong place :p Gosu is great at what it does, but it has very specific design goals which don't generally include much "hand-holding"...

For those who don't want to engineer their own solution, there are things like Unity, Construct 2, Stencyl, and the like. One of those probably has something you can use. In fact, I wouldn't be surprised to see something that automated this entire process – just drop images into it and get usable physics "objects" out of with no work at all. It's probably going to cost you, though.
Topic hackable game editor project? By RunnerPack Date 2014-02-21 17:05
Hey, that's cool; I didn't know GIMP could export the path like that (I haven't used it much, and it was a long time ago).

I actually used a commercial program (Vector Magic) to do the conversion, but there are free alternatives. Inkscape, for example, has bitmap tracing. I don't know how it performs, but it's probably good enough for this.
Topic hackable game editor project? By RunnerPack Date 2014-02-18 06:02
I used PaintShop Pro 8, but Paint.NET or, like you said, The GIMP, would work if you want something free. Of course, if you want to try automating it, there's always ImageMagick. You could probably do it in Ruby with Gosu and Texplay, too.
Topic hackable game editor project? By RunnerPack Date 2014-02-18 02:30
Why not let the computer do (most of) the work? Just turn your image into a silhouette, scale it down to the resolution of your grid (or use the "Pixelate" function, if you have one), and do a threshold to get the "solid" bits where you want them. You can either use the low-resolution bitmap for collision directly, or run it through a vectorization program. In fact, you could vectorize the full-size silhouette and reduce the number of edges to something manageable.

I made an illustration:

[https://dl.dropboxusercontent.com/u/5754740/Picachu%20Collision%20Map.png]

And here is the resulting vector file (SVG).
Topic Gosu for HTML5? By RunnerPack Date 2014-01-25 01:11
It's not quite ready (only runs Ruby 1.8.7, and slowly at that) but it might be a good direction in which to focus effort:
https://github.com/replit/emscripted-ruby
Topic Music and solid ground By RunnerPack Date 2014-01-10 00:11
Not exactly collision related, but somewhat on-topic...

If you ever want to graduate to proper gravity simulation (for jumping) without learning a physics engine (like Chipmunk), you can't beat Hugo Elias' page about modeling physical phenomena: http://freespace.virgin.net/hugo.elias/models/m_main.htm

It's not much more involved than your method, but the results are far more realistic. Here's a quick'n'dirty implementation to get you started: https://gist.github.com/runnerpack/8344513

Note the @maxjumps variable. Set it to something greater than one to allow jumping in mid-air (once you collect the right power-up, of course ;)

@jlnr: it's always true, and it always subtracts 20 from @y :)
Topic Profiling time consumption on method calls By RunnerPack Date 2013-12-31 07:05
Whenever you need to do something in Ruby, check RubyGems.org first. It's pretty easy to filter out the Rails noise and find what you're after. I found MethodProfiler after a quick browse, but if that doesn't get the job done, there are a few other likely suspects.
Topic axial input from gamepad thumbstick By RunnerPack Date 2013-12-20 06:09
I found this: http://sourceforge.net/projects/wgois/ but the only Ruby binding I could find (https://github.com/abexsoft/ruby-ois) is Linux-only :(

Anybody know what would be required to modify the binding to be cross-platform? Maybe someone more familiar with SWIG could make a new binding?
Topic Help needed to install Gosu on Ubuntu By RunnerPack Date 2013-10-31 06:09
What version of Ruby are you running? Try putting this above the 'require "gosu"' line:

begin; require 'rubygems'; rescue; end
Topic Drawing animation until it's completed By RunnerPack Date 2013-10-24 01:53
I was interested too, so I looked it up:

http://stackoverflow.com/questions/1961030/ruby-ampersand-colon-shortcut
Topic How to clear image in main window? By RunnerPack Date 2013-10-17 01:44
Some of us still are...  -_-' ' '
Topic How to clear image in main window? By RunnerPack Date 2013-10-14 20:05
I think you might be confused about how Gosu works... The window isn't a persistent canvas you have to manage on your own. The Window#draw method is called periodically, and everything you tell it to draw within that method is drawn on a fresh, blank surface. If you want an image to stay on the screen, you just have to tell Gosu to draw it. If you don't want it to be visible, don't draw it. Looking at the examples should make it clear.

Also, for your above code to work, you'll have to call Cheese#draw (which means: "the draw method of an instance of the Cheese class") within your Window's draw method. When you update the Cheese instance's x and y coordinates, it will move to the new position on the screen automatically.
Topic CloudyUi and NeutralCursor By RunnerPack Date 2013-10-08 02:05
These are very cool! I will definitely be using them some time in the future...
Topic Game Application Icon By RunnerPack Date 2013-09-12 23:44
Well, from what I know of Windows, it's probably not going to accept a raw RGBA (ARGB?) chunk when it's expecting an Icon resource. There's probably some Windows API function for generating an Icon from a blob of pixels – which is what I assumed you were using when I suggested #to_blob. How exactly are you using #to_blob with the above code?
Topic Game Application Icon By RunnerPack Date 2013-09-11 00:07
Have you tried Image#to_blob?
Topic Second Generation Chingu Example Loader - Vastly Upgraded By RunnerPack Date 2013-08-22 05:46
My suggestion (unless they're used for other stuff; I haven't tried the program, yet): PgUp / PgDn
Topic require 'gosu' not finding existing .so file By RunnerPack Date 2013-07-24 05:37
My suggestion: just use Ruby 1.9.3 from RubyInstaller.org. It's known to be compatible, and runs plenty fast enough for most Gosu games. Don't forget the devkit if you want to use source-only gems. Leave 2.x to the "early adopters" until they work out the bugs ;)

Besides, it doesn't even differ much from 1.9.3 (See: http://stackoverflow.com/questions/15799687/what-are-the-major-differences-between-ruby-1-9-3-and-ruby-2-0-0)

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill