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 Is there any Gui libs that extend Gosu? By jlnr Date 2014-11-14 15:17
Umm, and am I mistaken or is it not really possible to install wxWidgets on anything but Windows anymore? There is a Mac gem, but it crashes when you run it on a modern, 64-bit Mac. :(
Topic Is there any Gui libs that extend Gosu? By jlnr Date 2014-11-14 15:04

> you can easily use gosu and wx together


Wait what?! That's always relevant! :) Doesn't wx have a main loop that you need to run (same as Gosu::Window#show)?

I was always waiting for a Ruby GUI framework to become the de-facto standard, and then I wanted to add integration with Gosu. But that doesn't seem to happen, and if wx works with Gosu without me doing anything, I should at least ship an example. (If you still have a test project floating around, let me know :) )
Topic Scrolling Background By jlnr Date 2014-11-14 05:24
You are overthinking the translate function. :) All it does is add an offset to all drawing operations that happen inside the block you pass to it. So

translate(x, y) { img.draw(a, b, z) }

is the same as:

img.draw(a+x, b+y, z)

So you can't do anything with translate that you couldn't do without it, but it can be more convenient to use it.

I would recommend that you do not move the layers around, but keep a global pair of camera_x and camera_y variables around, and then in draw you calculate the position based on these two variables. The % (modulo) operator will definitely come in handy. But I don't know if there is a good tutorial on getting started with that kind of math... :( I usually sit down with a pen and paper and play with the formula until it works.
Topic Is there any Gui libs that extend Gosu? By jlnr Date 2014-11-14 04:56
I think most games just write their menu & HUD code from scratch. I think the key to implementing any kind of GUI is to segment your apps into "states" or "scenes" so that you don't end up with the messiness of seven different menus in a single Window subclass. Most games in the Gosu Exchange forum should get this right, so you can look at them.
And if you need a complete GUI toolkit because your app needs more than plain buttons, you can always fork and improve either of the existing GUI libraries. The next user might appreciate it :)
Topic Calculating collision with isometric tiles By jlnr Date 2014-11-11 05:49
I agree with RunnerPack. This will become very messy if you want to check for collisions between straight and "diamond" boxes.

To block movement, I would not move the player and then check for collisions afterwards. Instead, if the player is moving left at 4px per frame, you could basically do:

4.times do
  self.x -= 1
  if self.blocked?
    self.x += 1
    # ...hit something to the left...
    break
  end
end


...and this for all four directions. Not super efficient, but at least easy to understand :) And the easiest way to implement this would be to make the player a single point. Whether that works depends on the game, I guess:

def blocked?
  game.map.solid_at? self.x, self.y
end
Topic Gosu 0.8.5 on Debian Wheezy By jlnr Date 2014-11-11 05:01
Hm, looks like you are right: https://packages.debian.org/search?keywords=libsdl2-ttf-dev

Not sure what to do about this. You could request a back-port, or compile it yourself, see the comments here on the top answer: http://stackoverflow.com/questions/21588379/installing-sdl2-on-linux

I can't make Gosu work with SDL 1.2, sadly. It might be easier to "just" upgrade your Debian system ;)
Topic Upgrading to Gosu 0.8.x and SDL2 By jlnr Date 2014-11-09 15:48
Ah, thanks for fixing the wiki!

Gosu has always used OpenGL - in fact, I wrote the library because I couldn't find a good 3D-accelerated 2D library at the time. (Before 0.8, Gosu only used SDL 1.x for its TTF support, the window was custom X11 code + OpenGL.) So if anything, Gosu 0.8 should be more portable :) It just seems that distributions still need to catch up with SDL 2 - the OpenGL flag should really be mandatory IMHO.
Topic Upgrading to Gosu 0.8.x and SDL2 By jlnr Date 2014-11-09 06:46
I have pushed a new preview gem that actually looks at the return value of SDL_CreateWindow and SDL_GL_CreateContext; can you please gem install gosu --pre and see if you see an exception now?
Topic Upgrading to Gosu 0.8.x and SDL2 By jlnr Date 2014-11-09 02:49
Do other SDL 2-based games work? I don't really know any, but I would guess that the SDL actually gives us a useful error message and Gosu just throws it away.

I've just double-checked and the new SDL-based Window.cpp is lacking error checking in two key places. Oops. I'll add it and come back with a new .gem file.
Topic no more than 2 simultaneous inputs? By jlnr Date 2014-11-02 04:59
I've managed to find the technical term for this limitation :)

http://en.wikipedia.org/wiki/Rollover_(key)
Topic What is Gosu::Window#show_internals? By jlnr Date 2014-11-01 12:57
Originally there only used to be Window#show, the C++ function that runs the game's main loop, and which can be safely ignored when looking at a profiler.
However, due to the way exceptions have to be handled and translated across C++ and Ruby, Gosu renames the C++ function to show_internal and defines a new method called show with additional exception handling:
https://github.com/jlnr/gosu/blob/master/lib/gosu/swig_patches.rb

tl;dr it's just Window#show in disguise. :)
Topic no more than 2 simultaneous inputs? By jlnr Date 2014-11-01 10:12
Have you tried using a different key than Z? I know that keyboards used to have bizarre limits on which keys you could press at the same time. It was usually the safest choice to use non-letter keys like shift and ctrl. Or do you have a gamepad to test this with?

In any case, this doesn't look like a problem with your code :)
Topic Why NOT to use gosu? By jlnr Date 2014-11-01 10:01

> 5) "it's not very popular because it's not very active because it's not very popular because..."


I agree, but I think the issue is not just lack of popularity with hobbyists. The Löve 2D forums are bustling with activity compared to this one, and yet I feel Löve 2D suffers from very similar issues, simply because there is no game studio using Löve 2D to make money. (Correct me if I'm wrong :))

Conversely, when I had just a single client who paid me to work on an interface for a media installation using Ruby/Gosu, Gosu's internals made leaps ahead, without much visible activity on GitHub/the forums/IRC.

If Ruby/Gosu becomes a solid choice for commercial game dev one day, then IMHO that's only because Gosu turns out to be unexpectedly useful for some kind of business operation, be it in games or in media. (Or because I win the lottery :)) Sadly, there is little money in the kind of casual 2D desktop games that Gosu is good for.

Edit: Case in point, I think the SDL is only as solid and production ready as it is because it happened to be a good library for porting AAA titles to Linux.
Topic Why NOT to use gosu? By jlnr Date 2014-10-31 10:13
First: Thanks! :)

Nobody cares about the C++ version because its interface is outdated and there are so many other libraries. In general, we C++ programmers love to reinvent the wheel instead of using libraries. :D

Ruby, on the other hand, was never a popular language for game developers. I think there are many reasons for this: It is a huge mess to distribute Ruby games. (I would argue that even web apps, Ruby's biggest strengths, are absolutely painful to deploy and maintain.) Ocra, the Ruby-to-EXE tool for Windows, depends on a single maintainer on github (big thumbs up to him!). Gosu itself is often dormant for a few months, other Ruby game dev libraries have been discontinued. You can't run Ruby in the browser, unlike Flash or HTML5. It is always easy to get to a game's source code, and many indie developers want to keep their code to themselves. And only the upcoming version of Ruby, 2.2, promises to fix the garbage collection stutter that some people experience. etc...

That said, I am quite happy with it for prototyping, and I am optimistic that I could even hide my game's source code if I spent a few days on it. (Using precompiled mruby maybe, or RubyMotion on OS X and iOS.) And even if I couldn't manage to do so, porting a Ruby game to another language (C++ & Gosu for example) is not too hard, either... So don't let any of that distract you from writing good games :)
Topic Series of tutorials on how to make a Platformer game in Gosu By jlnr Date 2014-10-29 07:47
(There is no such thing as necroposting when Gosu evolves so slowly ;))
Topic Screen Flickering By jlnr Date 2014-10-22 16:08
I have filed a new issue on GitHub for adding Window#resize(w, h, fullscreen). This issue comes up very often, and closing windows to recreate them in a different resolution has never really been supported.

http://github.com/jlnr/gosu/issues/255

Not that this immediately helps you :) - I think the best way around this is a separate launcher, for now.
Topic Toggle full screen By jlnr Date 2014-10-09 05:30
Not yet. Gosu 0.8 has made it a lot easier to add this later, as all Window implementations are now based on the SDL 2 library, which has support for this (AFAIK). Feel free to file a github issue for this, that's where I usually go when I have spare time :)
Topic Gosu on Raspberry Pi By jlnr Date 2014-10-07 02:01
I am calling SDL_GetMouseState once per tick to update the mouse position. The upcoming SDL 2.0.4 will have updated mouse functionality which Gosu will probably make use of, plus lots of bug fixes. So one quick fix you might try is to use the latest version of SDL 2 from Mercurial (which should be pretty close to the final 2.0.4 version by now).
Topic Gosu 0.8.4 released By jlnr Date 2014-09-29 03:13
wat :) I think I don't even want to understand this bug! Must...not...look...into...
Topic Gosu 0.8.5 released By jlnr Date 2014-09-28 13:20
This release only fixes a couple of compilation errors that have affected OS X, and possibly Linux.
Topic Using releasy By jlnr Date 2014-09-23 10:22
Can't you just run gem install bundler to install bundler? That seems like the obvious solution :)
Topic KbEscape not registering By jlnr Date 2014-09-18 13:09
o__O That sounds like one of the crazier bugs I've heard about!
Topic Gosu 0.8.4 released By jlnr Date 2014-09-18 07:13
Gosu has actually used "i386-mingw32" in past versions: http://rubygems.org/gems/gosu/versions

I don't even remember why I've changed it, I guess it must have stopped working? I also remember vaguely that in some cases, Rubygems would change the string I pass to GemSpec#platform= into another one. (It's probably normalising it.)

If you find out if any platform string is "more right", please let me know :)
Topic Ubuntu 14.04 quick start By jlnr Date 2014-09-16 22:20
Thanks for the write-up :) I have also linked it right from the wiki page: https://github.com/jlnr/gosu/wiki/Getting-Started-on-Linux
Topic Help using free transform matrix By jlnr Date 2014-09-12 00:43
You will probably have to concatenate (multiply) two matrices - one to rotate the image by 90° to make it 'fall on the ground', and another to implement a perspective transform based on Z coordinates. I am sure you can find information about both types of matrices in any book on 3D programming - there are only a handful of common matrix types, anyway. :)
Topic Resolution Issue By jlnr Date 2014-09-04 12:11
Hmm, what does "gem which gosu" or "gem which gosu.bundle" say in the ruby_racer directory? Does it find anything at all after you uninstall the other gem versions?

In recent Ruby setups, there is an extensions/ folder next to gems/. Maybe something got stuck there?

If nothing else helps, there is always rvm implode ;)
Topic Resolution Issue By jlnr Date 2014-09-04 12:10
Thanks! It's not too bad actually. Probably one "support request" per game that is posted to the Showcase. :)
Topic Gosu 0.8.4 released By jlnr Date 2014-09-03 20:42
Today the focus was on all things resolution! I'm not sure what could be more exciting :)

Gosu::available_width & Gosu::available_height can now be used to calculate the available space for a non-fullscreen window. (The return value is only accurate on OS X and Windows for now.)
Gosu::Window::show now respects needsRedraw/needs_redraw? again.
• Fix scaling errors on Retina displays, caused by a regression in Gosu 0.8.3.
Topic Resolution Issue By jlnr Date 2014-09-03 17:25
Hmm. Did you maybe run bundle --deployment (which will install the gem in a local .bundle subfolder), or do you use several versions of Ruby with rvm/rbenv? Uninstalling gems is the pretty much the only thing that gem developers are not responsible for :) Should have been a bug somewhere else...

0.8.4 is out now, as well. One thing that I've noticed is that brew install sdl2 --HEAD works a lot better here than the current stable version.
Topic Resolution Issue By jlnr Date 2014-09-03 12:44
I would suggest running gem uninstall gosu until all versions are gone, then installing Gosu 0.8.2, which should hopefully fix this issue.

There is a tiny bug in Gosu 0.8.3 that can cause this issue on a Retina MacBook Pro. In related news, I've just spent all of this morning trying to get some advanced features of Gosu to work on a Retina Mac: https://github.com/jlnr/gosu/issues/244 :) But your issue should already be fixed, and I'll try to push 0.8.4 ASAP.
Topic Gosu 0.8.3 released By jlnr Date 2014-08-28 22:06
Two more tiny fixes. Overall, the SDL 2 transition was pretty smooth. Hurray!

• All: Mouse wheel constants is not swapped anymore, thanks to d3vkit for reporting this on GitHub.
• Linux: Gosu now works with outdated versions of SDL. In particular, it can now be installed on OpenSuSE again.

Next stops: Updated .app wrapper & 64-bit gems for Windows.
Topic Hot and Cold - Ludum Dare 30 entry By jlnr Date 2014-08-25 15:52
Oh wow. I guess making sure fonts render (mostly) the same on all platforms is a good challenge for Gosu 1.0 :) Not something that I can fix right now. In this case, I guess you would have to render all text at a higher resolution and then scale it down to make it look better on OS X.
Topic Hot and Cold - Ludum Dare 30 entry By jlnr Date 2014-08-25 15:41
I know, I wish Gosu support MIDI files, but MIDI playback is weird on all platforms, especially Linux. From the SDL2_mixer documentation:

> Timidity:
>   Mixer supports playing MIDI format files using software wavetable via an old version of timidity. This requires you to have a GUS compatible set of sound patches on your system. By default, the library looks for these patches on Win32 in C:\timidity, and on UNIX in /usr/local/lib/timidity/.


I think it would be easier to convert MIDI files to XM or a similar format, and integrate MikMod into Gosu on all platforms.
Topic Hot and Cold - Ludum Dare 30 entry By jlnr Date 2014-08-25 08:47
:D I guess the concept would work if the levels were complicated enough that you'd bump into the mana limit really quick. Like having a maze of fires & barrels, and only one way through it that you can afford. I still really like the perspective (and want to write a game in that perspective myself now :P)

Great to see that full screen mode works! But the perspective is a little distorted on my 21:9 screen. Edit: You can simply pass 336, 192 straight into super and have Gosu do all the scaling for you - it even adds black bars at the top/bottom or left/right sides for you, and of course the mouse coordinates will (should) be translated accordingly. Worked fine for me here in a quick test.

The font is a little hard to read on OS X - makes me wonder if Gosu needs a flag to disable anti-aliasing?

Did you simply run Ocra on it for the Windows build? I'm relieved that it worked! :)
Topic Gosu 0.8.2 released By jlnr Date 2014-08-24 20:16
Sweet! Love the perspective :)
Topic Gosu 0.8.2 released By jlnr Date 2014-08-24 20:14
Right, so far I have only compiled Gosu for 32-bit. But if my hack works, I should be able to push out a 64-bit gem soon.
Topic Gosu 0.8.2 released By jlnr Date 2014-08-24 18:51
Gosu::screen_width & Gosu::screen_width now return the correct values before a Window has been created
• Windows: Experimental support for Ruby 2.0.0! :)

Note: The current Ruby 2.0 installer won't be able to find the pre-compiled Windows gem, please run gem update --system before installing Gosu. Please let me know if the gem works with complex projects, I have only been able to test it with the Tutorial game so far.
Topic Gosu 0.8.0 released By jlnr Date 2014-08-23 16:20
Re: cursor issues, let's wait for SDL 2.0.4 :) Shouldn't be too long, they're already beta-testing.

https://github.com/jlnr/gosu/issues/240
Topic Gosu 0.8.0 released By jlnr Date 2014-08-22 22:47
I'll lurk around the Ludum Dare blog this weekend, but I already have too many unfinished projects on my hand :) Good luck finding some free time!

The biggest question will be, what state is Ocra in currently? I wonder if it can build a Ruby/Gosu EXE - haven't tried in a while...
Topic Gosu 0.8.0 released By jlnr Date 2014-08-22 22:36
Another option would be to offer an interface to this SDL functionality: https://wiki.libsdl.org/SDL_SetRelativeMouseMode

But for everything else I'd still like to "fix" the mouse behaviour. :)

There is also this function, but it's part of the yet-unreleased SDL 2.0.4: https://wiki.libsdl.org/SDL_GetGlobalMouseState
Topic Gosu 0.8.0 released By jlnr Date 2014-08-22 05:28
Oh wow, I didn't notice that! I really liked the old behaviour. Even the fact that you could have a negative mouse_x and all that.

Thanks for pointing it out - I mostly use Tutorial.rb and an iOS game to make sure everything still works, and there are so many parts of Gosu that are under-tested... :)
Topic Gosu 0.8.0 released By jlnr Date 2014-08-21 18:30
That's interesting. How did the code work before? I assume you calculate last_mouse_x - mouse_x in every update cycle and then reset the cursor to the centre – why would this not work in the new version?

That doesn't really sound like a big hack, I think that's what other games are doing as well :)
Topic Gosu 0.8.1 released By jlnr Date 2014-08-20 21:40
Fixed, but I need to test it on Windows before I release 0.8.2. I'll see if I can somehow sneak support for Ruby 2.x in...
Topic Gosu 0.8.1 released By jlnr Date 2014-08-20 06:29
Okay, THAT is a good hack. :D

I have to admit that I totally forgot about screen_width/screen_height yesterday. I have to see if it is an issue with the SDL or not. Will try to push 0.8.2 tonight.
Topic Gosu 0.8.0 released By jlnr Date 2014-08-19 21:45
You are right. I use some copy & pasted code to extract the font name out of TTF files that hasn't changed in years. In fact, it is so old that I am getting HTTP error 500 from github while trying to dig into the file's history before 2011. :D

The code has always opened the TTF file for exclusive(!) read access. This must have lead to non-deterministic bugs, because even an Explorer window in the background might sometimes open files to query some meta-data, which would cause CreateFile to fail.

Anyway, fixed in 0.8.1.
Topic Gosu 0.8.1 released By jlnr Date 2014-08-19 21:42
This fixes three major bugs in Gosu 0.8.0:

• Revert to old, working OpenAL32.dll
• Mouse wheel events are not broken anymore
• Fix TTF loading code (which has been broken forever)
Topic Gosu 0.8.0 released By jlnr Date 2014-08-19 20:30
Hmm, can you please attach the font to a post here? I'd like to play around with this bug :)

Edit: Never mind, your github project is result #1 for the filename. :D
Topic Gosu 0.8.0 released By jlnr Date 2014-08-19 20:19
Still testing, but  Gosu::Song works in C++. No surprise, it's a Ruby-only bug. :)
Topic Gosu 0.8.0 released By jlnr Date 2014-08-19 20:15
I have just received a second bug report about loading fonts, with the exact error message as yours, but in Gosu 0.7.50 - and passing an absolute path name worked. It has to use forward slashes, though ("C:/dir/file.ttf"). What a bizarre bug.
Topic Gosu 0.8.0 released By jlnr Date 2014-08-19 19:51
Hmmm, it is interesting that custom fonts would break - none of the code for that has changed. Can you please try loading the font with an absolute path name? Maybe SDL 2 changes the current directory?

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill