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 Using an image as an alpha channel for another image By jlnr Date 2015-12-24 07:49
Nope, not without additional OpenGL hackery. Or you can use Gosu::clip_to to render the background again, clipped to the window/door rectangle on a tile, but that's only efficient if the background is very simple (a static image, for example).

It should be easy to generate each tile/cutout combination using RMagick.
Topic Problem for install Gosu By jlnr Date 2015-12-23 08:37
The issue has been fixed in RubyGems 2.5.1. You can keep the installed 0.10.5.pre2 gem until I release 0.10.5 (hopefully before 2016), and then just gem update gosu to install the normal version.
Topic Problem for install Gosu By jlnr Date 2015-12-23 08:36
RubyGems has fixed the issue now :)
Topic Have a screen render with Gosu::Image By jlnr Date 2015-12-21 21:22
Are you using plain Gosu to render? Then it should be as easy as Gosu::scale(1, -1, 0, window.height / 2) { ...draw everything... }
Topic Have a screen render with Gosu::Image By jlnr Date 2015-12-21 15:13
Are you rendering to an OpenGL texture? If so, can you simply invert the matrix while you are rendering, so that the image data won't be inverted to begin with?
Topic (Gosu.record).draw_as_quad issue By jlnr Date 2015-12-19 13:21
Hey, thanks for reporting this issue...and for diving into the hell that is Macro.cpp :)

Gosu originally used "reading order" for coordinates everywhere: top left, top right, bottom left, bottom right. (I think this was a Direct3D thing, but I'm not sure.)
But everyone except me seems to prefer clockwise coordinates, so while Gosu uses "reading order" internally, it now accepts arguments in both(!) orders.

And here comes the bug: I forgot to translate clockwise coordinates into "reading order" in Macro::draw. I've pushed a commit and will release a new version of Gosu once I've verified that Rubygems 2.5.1 does not break my pre-compiled Windows gem anymore. In the meantime, you can just swap the parameters to Image#draw_as_quad and everything should work.
Topic Launching gosu from Ruby on Rails By jlnr Date 2015-11-30 18:48
No, that won't work. The link can only launch a Gosu game on the server (where Gosu has been installed as a dependency), not on the client.
Running Ruby/Gosu in the web browser would require a port of Gosu to http://opalrb.org/, or you could try out the Dare project: https://www.libgosu.org/cgi-bin/mwf/topic_show.pl?tid=1164
(I am not sure what the progress is on the Dare project)
Topic Launching gosu from Ruby on Rails By jlnr Date 2015-11-29 14:39
I don't understand the advantage of launching Gosu from a Rails project. If you are not running a web server, then why use Rails? If you just need all the niceties that ActiveSupport brings to Ruby's standard library, you can also require them in a plain Ruby/Gosu project:

require 'active_support'
require 'active_support/core_ext'
Topic Gosu in Slow-Motion on Windows By jlnr Date 2015-11-24 19:38
This is usually the symptom of a computer that does not run Gosu with hardware acceleration, caused by outdated graphics drivers. You could try to find other games/demos that use OpenGL for rendering (not Direct3D) and compare.
Topic OpenGL vs fake 3D By jlnr Date 2015-11-21 21:33
Oh, you'll still need to draw things up to 5 times, depending on the camera position. I just wanted to say that the math for this is simple, since you've mentioned trigonometry - but I see below that you're already using a very simple formula :)
Topic OpenGL vs fake 3D By jlnr Date 2015-11-21 09:47
I've used fake 3D boxes in a few games and was quite happy with the results. Usually, what I've done is just to calculate the x/y delta of each vertex to the screen centre, then multiplied it by 1.1 or some other value > 1.0. Then I use draw_quad to connect the original vertices and the offset vertices, drawing up to five images per box.
So if part of your problem is that your math has become tricky, you can maybe simplify it like that :)

Very simple fake 3D in action -> http://ludumdare.com/compo/2009/04/19/starferret-48h-final/
Topic Preparing a Spritesheet for Gosu By jlnr Date 2015-11-16 09:18
I don't know if any good tools for this task exist. But if I had to do this, I'd write a plain Ruby/Gosu tool that lets me drag rectangles on the graphic and cuts up the image, rearranging it into a grid of sprites where each image has the same measurements. Then you can either load it with Image.load_tiles (easy), or as a several 1024x1024 images with Image.new and use .subimage() to load specific sprites (that'll be a little faster).
Topic How do I put a delay in Animation? By jlnr Date 2015-11-16 09:01
I would also suggest using @lower_case for variables and instance variables. UpperCase is only used for constants in Ruby.
Topic Problem with Opengl now... Yeah ! By jlnr Date 2015-11-14 10:42
Is it just this test script that is broken? Have you tried the OpenGL example in gosu-examples (gem install gosu-examples, then run gosu-examples)?

I can't get this particular test to run either, but that's probably because I have no Glut on my system.
Topic Problem for install Gosu By jlnr Date 2015-11-12 09:45
Okay, forget about the pre gem :) It's not going to work for TexPlay.

I forgot that you can just download the .gem files from RubyGems.org. For example, here is TexPlay for 32-bit Windows:

https://rubygems.org/gems/texplay/versions/0.4.3-x86-mingw32

Just click "Download" in the lower right corner.

Same for Gosu:

https://rubygems.org/gems/gosu/versions/0.10.4-x86-mingw32

Then run gem install <path_of_downloaded_gem> (you can just drag the .gem file from the Explorer into cmd to insert the path). Et voila! :)
Topic Problem for install Gosu By jlnr Date 2015-11-11 20:47
Does it work if you first install Gosu (with --pre, as before, not with --platform) and then install Texplay?
Topic Problem for install Gosu By jlnr Date 2015-11-11 09:44
I don't think there will be a Texplay update anytime soon, and the current gem is only precompiled for 32-bit Ruby on Windows, anyway. In the Rubygems issue thread above, it seems that 32-bit Ruby might be unaffected by the issue altogether.

Does downgrading to a 32-bit Ruby fix everything for you (for now)?
Topic Problem for install Gosu By jlnr Date 2015-11-10 23:38
The issue is caused by this bug in Rubygems 2.5.0: https://github.com/rubygems/rubygems/issues/1369

To work around the issue, I've pushed a Gosu 0.10.5.pre2 gem that is ONLY available for Windows. So if you run gem install gosu --pre now, gem has no chance but to install the Windows version.
Topic Problem for install Gosu By jlnr Date 2015-11-08 21:28
Ah, I see. Updating Rubygems itself has broken Gosu here too. =( I hope all I have to do to fix this is to release a new gem. Hope to try that tomorrow.
Topic Question about opengl texture coordinates By jlnr Date 2015-11-07 15:43
Thanks for analysing the issues with gl_tex_info. I am a complete idiot when it comes to OpenGL, so I'm glad that the feature even works as well as it apparently does!
Fixing the first issue would be relatively easy by introducing a :single_texture => true flag in the Image constructor. (This would also fix the second issue.) I don't have the time to release a new Gosu version in the next days, though :(
As for the second issue, you are right that Gosu uses inverted Y coordinates - but at least it does so consistently (y=0 is always the top). Here are the calculations for gl_tex_info:

https://github.com/gosu/gosu/blob/master/src/Graphics/TexChunk.cpp#L11-L14

If you want to translate the coordinates to a bottom-to-top coordinate system, you can use 1 - tex_info.top and 1 - tex_info.bottom.

I guess you could even add a few helper methods on Image or GLTexInfo to wrap away all these calculations.
Topic Problem for install Gosu By jlnr Date 2015-11-07 15:30
Can you please try upgrading Rubygems itself (gem update --system)? gem install should install the right architecture (pre-compiled) even without the --platform parameter, but every few years there is a bug that breaks this logic. Sigh :(
Topic Some Gosu requests By jlnr Date 2015-11-05 09:07
Yes, try this: "Hello <c=ff00ff>World!</c>"

I'm afraid the syntax is VERY poorly documented, but for now this should do the trick :)
Topic Passing around window 2: Electric Bugaloo By jlnr Date 2015-10-26 15:58
Yes, that was usually necessary because the Player class wanted to load images, and Image.new required a window reference. That is not the case in Gosu 0.9+.

In any case, the easiest workaround was to use a global variable called $window throughout your app, and set it in YourWindowClass#initialize (right after the super call). You could also use the Singleton module from the Ruby standard library, but I am not sure if it has any practical advantage over a global variable.
Topic Passing around window 2: Electric Bugaloo By jlnr Date 2015-10-26 11:25
Did you perhaps copy the wrong link there?

I think you are referring to the interface changes in Gosu 0.9+. Previously, you had to pass a Window reference to Gosu::Image.new etc. (for 10 years!) - that has changed in Gosu 0.9, half a year ago.

The old overloads are documented in Gosu's rdoc, and are not likely to go away anytime soon:

https://www.libgosu.org/rdoc/Gosu/Image.html#initialize-instance_method

I would guess that at least 95% of all Gosu code ever written still uses the old interface.

If you see a tutorial that uses the old interface, maybe you can help the author migrate it to the new one? I've been meaning to to ping the authors of the various Gosu Tutorial translations, but I haven't found the time yet.
Topic RPG Paper Maker (a 3D game editor) By jlnr Date 2015-10-18 09:59
Imagine that the implementation of Window#show looks like this (pseudocode):

def show
  show_OS_window_on_screen()
  while not self.closed?
    self.button_down(x) for each x that the OS reports
    self.update()
    self.draw()
    sleep(16ms)
  end
  hide_OS_window()
end


When you create a second window and call .show on it from within button_down, you will have two nested while loops, one for each window, and the outer loop will be stuck until the inner while loop completes. So the first window never has a chance to clean up and hide itself.
The only way around this is to wait for the first call to Window#show to return (doesn't matter if you've manually called close or if the user clicks the X), and only then show the second window. So, more like:

Launcher.new.show
puts "the first window has been closed now"
GameWindow.new.show


The global variable was just an example for you could pass data between both windows. I don't know what your launcher actually does, so please ignore that bit.
Topic Problem with Delta-Time Physics in a windowed Gosu (Ruby) By jlnr Date 2015-10-18 09:51
This also happens when the user closes their laptop and opens it up on the next day. I think limiting dt is the way to go, but to be honest I haven't ever built a dt based game.
Topic RPG Paper Maker (a 3D game editor) By jlnr Date 2015-10-11 21:14
button_down is called in the main loop that Launcher#show starts. So basically the launcher window will be stuck forever in its loop, waiting for the whole main Window#show loop to finish. The call stack will be (among others) main > Launcher#show > Launcher#button_down > Window.show.
You'll have to store the launcher settings into some sort of global variables, then let the launcher close itself, and then create the new window. Something like:

Launcher.new.show # stores settings in global $settings_from_launcher
# .show returns at some point because .close was called
Window.new($settings_from_launcher).show


(Assuming that the point of the launcher is to decide on settings)

Hope that helps (and works-haven't tested it)!
Topic RPG Paper Maker (a 3D game editor) By jlnr Date 2015-10-11 15:37
Which version of Gosu do you use? Closing and opening windows should work fine in the current version, the only limitation being that you can only .show one window at a time.
Topic RPG Paper Maker (a 3D game editor) By jlnr Date 2015-10-10 15:57
Wow, the indoor screenshot looks awesome, and the transition to battle even more so!

Also liked this rotation demo in the forum thread: http://img107.xooimage.com/files/6/9/8/maison-45ee599.gif

Let me know if you encounter any problems in Gosu! Great work. (And I'm a little jealous at how busy the RPG Maker forums are :P)
Topic Gosu 0.10.3 released By jlnr Date 2015-10-10 11:30
Awesome! Thanks for reporting.
Topic Gosu 0.10.3 released By jlnr Date 2015-10-04 20:59
That's strange, which was the last version of Gosu on which it worked? 0.10.2, 0.10.3 or 0.10.4? Can you provide a minimal example? (Probably just an empty window with one call to Gosu.draw_rect?)
Topic undefined method `to_blob' for #<Game:0x000000025c3c38 @__sw By jlnr 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.
Topic Gosu 0.10.4 released By jlnr Date 2015-10-04 10:17
Another release with only a single bugfix:

• Ruby: Fix compatibility with Gosu 0.8 interface (Gosu::Image#initialize; GitHub issue #360)
Topic Chingu Animations -- Error: Undefined Method "to_blob" By jlnr Date 2015-10-04 10:16
Oh man, in retrospect that was a really silly oversight on my part. Anyway, should be fixed in Gosu 0.10.4.
Topic undefined method `to_blob' for #<Game:0x000000025c3c38 @__sw By jlnr Date 2015-10-04 10:15
Fixed in Gosu 0.10.4.
Topic undefined method `to_blob' for #<Game:0x000000025c3c38 @__sw By jlnr Date 2015-10-04 09:36
Oops, I can actually reproduce it now.
Topic undefined method `to_blob' for #<Game:0x000000025c3c38 @__sw By jlnr 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... :(
Topic Another flag to Gosu::Image creation to handle it single By jlnr Date 2015-10-03 16:31
Creating subimages is probably cheap enough that you can do it in every tick. Images are not much more than a refcount to the texture, plus u/v values.
Doubled is not possible right now, though :(
Topic Gosu 0.10.3 released By jlnr Date 2015-09-30 20:57
Hey everyone,

I didn't really plan on releasing another version of Gosu so quickly, but this issue came up several times on this forum:

• Fix black/white empty window before Gosu::Window#show is called (issue #280)

Let me know if the fix works, and whether it has broken anything else.

I guess it's time to add features again, instead of squishing bugs! Nice :)
Topic Another flag to Gosu::Image creation to handle it single By jlnr Date 2015-09-27 17:38
I've created a new GitHub issue here: https://github.com/gosu/gosu/issues/300

But here's a workaround you can try in the meantime:

If you load the image using Image.new, then use image.subimage(x,y,w,h) to create a Gosu::Image representing a portion of the image, and then call gl_tex_info on the new (sub-)image, you should get the correct u/v values (0.0 to 1.0) in .left/.right/.top/.bottom.
You only need to take care not to create an image >1022x1022px with Image.new, because when an image is split up across several textures, subimage and gl_tex_info won't work.
Topic Some Gosu requests By jlnr Date 2015-09-24 04:56
Gosu's button constants are integers (Fixnums):

https://github.com/gosu/gosu/blob/master/Gosu/Buttons.hpp#L127-L141

It would probably be best to pick two random unused Fixnums for new constants, to avoid collisions.
Topic Gosu load images in separate thread By jlnr Date 2015-09-20 13:38
I'd suggest lazily generating these images during development, and then at some point you write them all out to PNG files. That way your players don't need to have ImageMagick installed on their machines.
Topic TextInput keys entry By jlnr Date 2015-09-20 13:37
Which OS and which version of Gosu do you use? And which keyboard (US, French, ...)?

I've opened a new issue for text input bugs on OS X, maybe I can fix some more bugs at the same time: https://github.com/gosu/gosu/issues/299
Topic Some Gosu requests By jlnr Date 2015-09-16 09:30
Oh, I didn't know that about TexPlay. =/
Topic Some Gosu requests By jlnr Date 2015-09-15 21:57
Hi and welcome :)

1. Instead of rewriting methods on Gosu::Window with class_eval, you can just add a setter to your own Window subclass:

class MyWindow < Gosu::Window
  ...
  attr_accessor :cursor
 
  def initialize(...)
    ...
    # Neither default cursor, nor a custom cursor image - I think this makes for nicer code than ""
    @cursor = false
  end

  def needs_cursor?
    @cursor.nil?
  end

  def draw
    ...
    if @cursor then
      # This is a bit of a hack - it's probably better to cache cursors indefinitely in a Hash
      @cursor_image ||= Gosu::Image.new(@cursor)
      @cursor_image.draw mouse_x, mouse_y, 1000000
    end
  end
end


2. No, Magick::Image is a bitmap in memory, Gosu::Image is an OpenGL texture, or something similar. But you can convert RMagick images to Gosu using Gosu::Image.new(rmagick_image).

(And I feel I have to point out that releasing games that depend on RMagick is going to be complicated =/ Deploying Texplay is a lot easier.)

3. Gosu::screen_width and Gosu::screen_height are your friend.

Thanks for the feedback! I'll try to look at the asynchronous image loading soon-ish, as well.
Topic Murderers By jlnr Date 2015-09-15 21:39
Nice, another Ludum Dare entry! :) Was surprised to spot quite a few Gosu entries this time around.

Pixel Monster by shawn42: http://ludumdare.com/compo/2015/08/23/pixel-monster-done/

They Came in the Night by Kakuremino: http://ludumdare.com/compo/ludum-dare-33/?action=preview&uid=8853

I've also spotted Aglæca by philomory: http://ludumdare.com/compo/ludum-dare-33/?action=preview&uid=1112

And here is my entry, Monstris: http://ludumdare.com/compo/ludum-dare-33/?action=preview&uid=114

(Sorry for hijacking this thread a little...! :) )
Attachment: level2.png - Color Monster (39k)
Attachment: 1112-shot0-1440410176.png - Aglæca (95k)
Attachment: 8853-shot1-1440371123.png-eq-900-500.jpg - They Came in the Night (42k)
Attachment: 114-shot0-1440467321.png - Monstris (246k)
Topic The Variety - small sci-fi game By jlnr Date 2015-09-14 14:44
Nice work, the sun looks great!
Topic Gosu 0.10.2 released By jlnr Date 2015-09-13 15:56
Ah, too bad. I think I know how to fix it, though.
Topic Gosu 0.10.2 released By jlnr Date 2015-09-13 15:20
For those of you who experienced white flickering on startup with Gosu 0.9.x+ (Windows) - has the SDL update fixed this?
Topic Gosu 0.10.2 released By jlnr Date 2015-09-13 15:18
Another boring maintenance release :)

• All: Fix many common text rendering artefacts
• Mac: Fix compilation error on OS X 10.11 El Capitan
• Windows: Update to SDL 2.0.4 RC 2
• All: Add experimental Window#tick method to potential integration with GUI toolkits (see Tk thread in Gosu Exchange)

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill