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 How's Gosu Work In Mobile Game By jlnr Date 2016-06-17 17:32
Hmm, kind of, but only for OS X: https://github.com/gosu/motion-gosu

I guess I should turn this into a "Getting Started with RubyMotion" page in the main Gosu wiki. It's on the To Do list, let's hope my three days off will be enough to get to it :)
Topic How's Gosu Work In Mobile Game By jlnr Date 2016-06-17 17:24
Oh wow, I didn't know about this tutorial :) The version numbers look a little ancient though, and the last commits on gosu_android have happened years ago: https://github.com/Garoe/gosu-android

But if you are going to give it a try, let me know how it goes. I will probably give RubyMotion's implementation of Ruby a try first, because I have heard quite a few bad things about Ruboto's startup time.
Topic [libgosu.org-Forum] Can't set an avatar By jlnr Date 2016-06-17 17:16
Thanks! I've put it on my To Do list (which doesn't mean too much :(). As a workaround, you should be able to use gravatar.com to set an avatar.
Topic How's Gosu Work In Mobile Game By jlnr Date 2016-06-15 09:20
Good question. I'd probably cut my rate to something like 40€/h because I'm working on Open Source, yay! (But not lower because I expect JNI/GC debugging to be painful :))

Considering that my own macOS/iOS RubyMotion game is only half finished and no one else has ever used RubyMotion with Gosu on an App Store, I'm wary of making any guarantees. A good first step would be to compile your game for RubyMotion on iOS, I think you can even deploy on device now with the free edition? That might give you (and me!) an idea of how stable that part of Gosu is right now.
Topic How's Gosu Work In Mobile Game By jlnr Date 2016-06-12 11:31
If by mobile you mean iPhone and iPad:

The C++ version works the same way it works on OS X, by creating a new Xcode project and importing Gosu via CocoaPods: https://github.com/gosu/gosu/wiki/Getting-Started-on-OS-X

The Ruby version can be used on iOS with RubyMotion, which is free if you can live with a branded splash-screen. This (woefully incomplete/ugly) board game on GitHub has an example project in the ios folder: https://github.com/jlnr/Trikus

I honestly don't even know where to start documenting either process, so feel free to just ask questions on this board and I might turn the answers into Wiki pages.

Android is not supported right now. I guess it'd take one weekend to get the C++ version running smoothly on Android, and then a full week to wrap it for RubyMotion.
Topic Issue with Ruby.app for Ruby / Gosu games By jlnr Date 2016-06-05 20:51
Works on my Mac, same OS. If you open a Terminal and run Ruby.app/Contents/MacOS/Ruby, do you see anything that could explain the issue?

I'll also try it in a fresh OS X VM that doesn't have any developer stuff installed.
Topic Gosu and automake By jlnr Date 2016-05-23 10:13
To be honest, I'm not sure. Most people (including me) only seem to be using Ruby/Gosu on Linux, not the C++ version.

How are games on Linux usually distributed? I guess I should finally install Steam in my Linux VM...

The cleanest way (to me) would be to build a .deb archive for both Gosu and your game, for which there is a shell script in the cmake/ folder that I haven't really tested. That should at least cover all Debian derivates.
Topic Gosu 0.10.7 released By jlnr Date 2016-05-22 20:26
np :)
Topic Gosu 0.10.7 released By jlnr Date 2016-05-22 15:59
Yep, the ||= operator does the caching here.

It will work for any image (except record-ed ones), unlike gl_tex_info etc. which can fail for very large images.
Topic Gosu 0.10.7 released By jlnr Date 2016-05-21 22:32
If all you need is get_pixel, then you can probably just load a Gosu::Image, call to_blob on it (be sure to cache the result) and parse the binary data. Something like:

class Gosu::Image
  def [](x, y) # Returns a binary string with r/g/b/a as the characters
    @blob ||= self.to_blob
    if x < 0 or x >= width or y < 0 or y >= height
      "\0\0\0\0" # return transparent pixels by default; you could also return nil
    else
      @blob[(y * width + x) * 4, 4]
    end
  end
end
...
some_image[x, y] # to read a pixel
Topic Gosu + RubyMotion? By jlnr Date 2016-05-21 09:02
If anyone is still finding this thread via Google - Gosu has supported RubyMotion for a while now, check out this example project: https://github.com/jlnr/Trikus

It's a normal MRI project, and there are RubyMotion wrapper projects in osx/ and ios/. They use the RubyMotion-CocoaPods bridge to install C++ Gosu. (No Android, sorry...)
Topic Gosu and automake By jlnr Date 2016-05-21 08:42
Hm, I actually thought the CMake setup would build a static library, but that doesn't seem to be the case. Sorry!

I know nothing about autoconf, but you should be able to use a system-wide Gosu installation in every unixy build system by passing pkg-config --cflags gosu and pkg-config --libs gosu to the compiler and linker, respectively.
Topic (Small?) Feature Request By jlnr Date 2016-05-21 08:36
I've replied to the this feature request on GitHub: https://github.com/gosu/gosu/issues/330

Writing a Shape class that imitates Gosu::Image shouldn't be too hard based on Gosu.draw_quad, which does not need the Window reference :)
Topic Gosu 0.10.7 released By jlnr Date 2016-05-20 23:17
The biggest improvement in Ruby 2.0 for me was not ever having to start files with # Encoding: UTF-8 ever again :) (UTF-8 is the default now.)

Ruby 2.1/2.2 have introduced new syntax for named arguments, but I haven't really seen them in the wild yet.
Topic Inuhh Shinvasion - Yet another jump'n'run By jlnr Date 2016-05-09 14:03
Looking forward to the game!

I've been thinking about the CptnRuby code recently, is there anything that you wish was better or more complete about it?
Topic Problem installing Gosu in Ruby 2.3 By jlnr Date 2016-04-27 23:05
Oops, my fault, thanks for reporting this. Please try again.
Topic Mouse issue with Linux By jlnr Date 2016-04-25 07:42
Hey bestguigui, good and bad news if you are still waiting for a fix here.

Ubuntu 16.04 ships with SDL 2.0.4. But only on Linux, the new SDL_GetGlobalMouseState is (practically) broken. SDL 2.0.5 will fix this, but since 2.0.3->2.0.4 took over a year, I'm not holding my breath.

So what I did is try to improve the mouse logic so that your mousing code works on all versions of Linux. The only limitation is that I still cannot update mouse_x and mouse_y while the mouse is outside the window.

In any case, the hack I've suggested above is not necessary anymore.
Topic Gosu 0.10.7 released By jlnr Date 2016-04-25 07:39
Also, I've made sure that everything works on the new and shiny Ubuntu 16.04.
Topic Gosu 0.10.7 released By jlnr Date 2016-04-25 07:36
A grab bag of fixes and updates:

• Windows: Support for Ruby 2.3.0
• Linux: Improve mouse getters/setters
• Ruby: Fix Gosu::random not being random
• All: Update stb_image, stb_image_write, stb_vorbis
• Mac: Reduce Gosu::Font artefacts
• Ruby: Fix compilation issues with Ruby 1.9.3

This is the first release of Gosu that uses both Travis CI and AppVeyor to ensure that things work as expected. Yay, green badges at the bottom! Cross-platform refactoring was a pain before this.

Also, the RubyMotion/iOS version works really well! I hope I can finish my game soon and document how to port stuff to iOS :)
Topic Getting (& Keeping) libgosu & C++ Games Compiling in MSYS2 By jlnr Date 2016-04-18 18:45

> My post contains two lists. Which one needs libsndfile?


To be honest, I'm not even sure. It seems that only Gosu itself should need it. Sometimes linking a game requires a dependency .lib though, and I haven't taken the time to work out why. I usually go with trial & error, like a pro. :/ So, if everything builds and sound works, then don't worry.

> What if we made a "Getting Started on Windows" page that linked to separate MSVC and Mingw pages?


Sounds good! Can you create new wiki pages as a non-org member? If not, I can simply make you a member.

One thing that worries me a little is the amount of Linux distros, Ruby versions, C++ compilers etc. Gosu is built with. But I've already opened a gazillion tabs in the background to sign up for free CI services. It seems like this will be an evening well spent. If I understand things right, Appveyor even lets you automate MinGW builds (for free!), which would make me feel much better about having a MinGW Makefile in Gosu's git repository proper. But first I'll set up Travis for Linux builds.
Topic "undefined method 'draw' for nil:NilClass (NoMethodError)" ? By jlnr Date 2016-04-16 07:20
Ha, I hadn't even seen this tutorial before. Nice :) I've gotten to the point where the player is first shown on the screen. There are two issues with this Tutorial that can lead to errors.
At one point in the example code, @sprite is mis-spelled as @spirte, and this would cause a NoMethodError, because @spirte is not assigned and instance variables (starting with @) are nil by default. The other issue is that the order in which things have to be called is important. GameWindow#initialize has to set $window to point to itself BEFORE creating the SceneMap`.

This is the code that I have so far, all in one file for simpler pasting: http://pastie.org/10799532

And by the way, there's no reason to use Ruby 1.9.3 with Gosu anymore. Ruby 1.8 through 2.2 are all supported, only 2.3 is missing right now :)
Topic One Hit KO By jlnr Date 2016-04-08 08:30
That looks like it feels really good to play, if that makes sense. Does everything in this video already work, or is some of it just added for show? It looks like it wouldn't need much more work to be playable :)
Topic What's wrong with this music? By jlnr Date 2016-04-04 11:58
You mean, it is also broken? Okay, that is good insofar as stb_vorbis is probably not the problem.

I wonder if Gosu stubbornly assumes 22 kHz audio, but your file is 48 kHz or so? Can you try to export it with a lower kHz frequency? I don't have Audacity handy right now.
Topic Getting (& Keeping) libgosu & C++ Games Compiling in MSYS2 By jlnr Date 2016-04-04 09:37
1. The DirectX SDK used to be required up until Gosu 0.8.0. Now this is all handled by SDL2.lib, which wraps this for us.

delayimp.lib is MSVC-specific and does not really matter.

2. I'm curious about glu32, does it break if you omit this library? Gosu doesn't really use it.

I think you forgot libsndfile in your list, but otherwise it looks fine.

> It would be great if there was an up-to-date (per platform?) list of every library needed for both Gosu itself and Gosu apps. Something to add to the wiki, maybe?


I think the list of dev dependencies can live on the Wiki page for the respective platform, as with GettingStartedOnLinux. If you compile Gosu with MSVC, gosu.git includes all the required .lib files (SDL2, OpenAL, libsndfile), so this only applies to Compiling-in-Windows-using-MinGW. (Which should probably be renamed to be more in line with the other GettingStartedOn... pages)

Not sure where to list the runtime dependencies. Does the MSYS/MinGW build need libraries at runtime that the MSVC build doesn't? Are pthread and stdc++ statically linked?
Topic What's wrong with this music? By jlnr Date 2016-04-04 08:57
Hrm, this might be related to Gosu switching to stb_vorbis instead of libogg/libvorbis in Gosu 0.10.x. I'll open a GitHub issue. Does the WAV version sound right?

Edit: https://github.com/gosu/gosu/issues/322
Topic Gosu's Font error By jlnr Date 2016-04-04 08:55
The easiest way is to use "gem uninstall gosu" to uninstall your current version, then "gem install gosu -v 0.9.2" to install the old version instead. To reinstall the latest version, you can simply run "gem update gosu" later.
Topic Gosu's Font error By jlnr Date 2016-04-01 22:57
Can you please retry with Gosu 0.9.2 and see if it works? The only difference is that you'll have to explicitly call super(640, 480, false) in initialize. I wonder if it has to do with the new compiler I'm using for Gosu 0.10.x.

I have noticed that some builds of Ruby itself are not compatible with Windows XP anymore. I don't think Ruby 1.9.3 should be affected, though.
Topic hotswapping code with pry By jlnr Date 2016-04-01 22:53
It sounds as if you should avoid calling SomeWindow.new.show in your .rb file, and instead you should find a way to patch the currently running window. I don't have much experience with pry, though.

I've recently used flgr's "again" gem for live code reloading and it worked quite well:

https://www.libgosu.org/cgi-bin/mwf/topic_show.pl?tid=1219

This is the git repo - it says it's a RubyMotion game, but it also works in plain Ruby:

https://github.com/jlnr/monstris

(Now if I could only find the time to finish the actual game...)
Topic Getting (& Keeping) libgosu & C++ Games Compiling in MSYS2 By jlnr Date 2016-03-27 21:39
Awesome, congrats on the working build :)
Topic Getting (& Keeping) libgosu & C++ Games Compiling in MSYS2 By jlnr Date 2016-03-27 18:29
I remembered that it is "/subsystem:console" in the Visual C++ compiler, and that brought up this result: http://stackoverflow.com/questions/7474504/compiling-a-win32-gui-app-without-a-console-using-mingw-and-eclipse
Topic Getting (& Keeping) libgosu & C++ Games Compiling in MSYS2 By jlnr Date 2016-03-24 19:45
Sweet! :) Thanks for digging into this. I think putting the whole Makefile into the wiki wouldn't be such a bad idea - it makes it even easier to contribute to it.
Topic Getting (& Keeping) libgosu & C++ Games Compiling in MSYS2 By jlnr Date 2016-03-20 15:17

> Does that also mean I don't need the three Ogg/Vorbis .DLLs when I distribute my games?


Yep! Gosu still needs libsndfile.dll, though.
Topic Getting (& Keeping) libgosu & C++ Games Compiling in MSYS2 By jlnr Date 2016-03-20 00:02
Ah right, the MinGW Makefile precedes the switch from libogg/libvorbis to stb_vorbis.c. We should probably fix this in master too.

The only thing I found about the pthread error is this: https://github.com/rust-lang/rust/issues/29649

But I'm not sure how that translates to your setup.
Topic Getting (& Keeping) libgosu & C++ Games Compiling in MSYS2 By jlnr Date 2016-03-19 19:58
Is it maybe as simple as passing -lstdc++ to the linker? It looks like it can't find anything from the standard library :)

If C++11 is a problem, you can retry with the last C++98 version of Tutorial.cpp:

https://github.com/gosu/gosu/commit/7c00e01f03cc88ae67248a824e2a4b5da79b9977
Topic Gosu and video settings By jlnr Date 2016-03-16 23:14
Welcome, glad you're enjoying Gosu!

Both options should perform exactly the same in terms of speed, but 2) will use less video memory. Thanks to bestguigui for the explanation :)

The rule of thumb with Ruby/Gosu is that the bottleneck is usually Ruby itself, not the rendering in OpenGL/Gosu. If you add lots of code to handle scaling factors based on the user's display quality settings, you might end up making the game slower for everyone because of all the calculations that happen in Ruby. AI and collision detection, for example, are easily more expensive than rendering in a typical Ruby/Gosu game.
Topic Image scaling problem? (FULLSCREEN) By jlnr Date 2016-02-26 15:33
0.10.6 is out and hopefully addresses this bug.
Topic Gosu 0.10.6 released By jlnr Date 2016-02-26 15:32
This is a tiny hotfix update for the Windows fullscreen bug reported here:

https://www.libgosu.org/cgi-bin/mwf/topic_show.pl?tid=1264
Topic Mouse issue with Linux By jlnr Date 2016-02-24 21:20
Also, I'm not sure if I remember the issue correctly, but I think you cannot set both mouse_x and mouse_y in the same tick before SDL 2.0.4, right? Wouldn't it work well enough if you set mouse_x in every even frame, and mouse_y in every odd frame? Or you only reset the value which has moved the furthest from the screen centre? Ugly hacks and gamedev go hand in hand ;)
Topic Image scaling problem? (FULLSCREEN) By jlnr Date 2016-02-22 16:45
Sorry for the delay, I've tested it on Windows and you are right. I can also confirm that it has already been broken in Gosu 0.10.4. Everything works as expected on OS X.

I've filed a ticket here:

https://github.com/gosu/gosu/issues/318

I hope this high priority bug gives me an excuse to spend a couple of evenings on Gosu. In the meantime, I'm sorry for this blatant error!
Topic Animate image after key press By jlnr Date 2016-02-22 16:20
Yep, exactly. A few minor nitpicks:
- You don't any of these semicolons in Ruby :)
- In draw, you want to iterate over the boxes and .draw each of them. You can use a for ... in loop for that, but @box.each { |b| b.draw } is more common in Ruby. It can even be shortened to @box.each(&:draw).
- Method names usually use_underscores() instead of javaCase()
- You don't need to pass false to super in initialize anymore, that's Gosu's old interface (which still works). The new way is super(w, h) or super(w, h, fullscreen: some_boolean)
- In button_down, you can use button_id_to_char to see which number was pressed:
  def button_down(id)
    ch = Gosu::button_id_to_char(id)
    if ch =~ /^[0-9]$/ then # Regexp to test for 0-9
      index = (ch.to_i + 1) % 10
      box[index].move = true
    end
  end

That has the advantage of also working with the numpad.

Also, sorry for the troublesome forum markup! I really wish it was Markdown.
Topic Using KbUp and KbDown in a TextInput on a Mac By jlnr Date 2016-02-22 08:09
Nooooooo, don't break my up/down keys on OS X!! ;)

I think we could add an callback like filter() except that it is called for arrow/modifier combinations? Feel free to fork gosu and give it a try. Compiling Gosu is as easy as:

cd my-gosu-fork
export GOSU_RELEASE_VERSION=0.99.0 # whatever
rake gem
gem install pkg/gosu-0.99.0.gem


Hope that helps!
Topic Mouse issue with Linux By jlnr Date 2016-02-21 13:24
It always depends on the Linux distribution, but for Ubuntu, SDL 2.0.4 will be available in the 16.04 update. So at least there is a solution on the horizon... :)

And you can always manually install SDL 2.0.4 from source, by using the ./configure && make && sudo make install dance, but I have never done that on Ubuntu and I don't know if Gosu would pick up the custom SDL installation by default.
Topic Image scaling problem? (FULLSCREEN) By jlnr Date 2016-02-20 23:51
That's really curious. I wonder if it has anything to do with your DPI settings? Are you running Windows 7 at 100%, 125% or 150% font scale? (It's somewhere in the display settings.)

I'll give it a try on my Windows 7 VM ASAP.
Topic Capture window to image? By jlnr Date 2016-02-20 23:49
2D graphics operations are outside of Gosu's scope. Implementing Window#to_image would be much easier than replicating all of Gosu's drawing operations in software :)

I've opened a ticket: https://github.com/gosu/gosu/issues/317

...but progress is suuuper sloooow right now. =/
Topic Capture window to image? By jlnr Date 2016-02-20 10:37
Saving a Gosu::Image to disk is easy, image.save('filename.png').

Capturing the screen is not possible with Gosu alone. Spooner has written the Ashton gem which can do it:

https://github.com/Spooner/ashton

...but I'm not sure if it still works. It has been unmaintained for a while.
Topic Image scaling problem? (FULLSCREEN) By jlnr Date 2016-02-20 10:36
Nope. Can you please post a screenshot? Which operating system and which version of Gosu are you using?
Topic Image scaling problem? (FULLSCREEN) By jlnr Date 2016-02-20 00:27
Gosu::available_height returns the height available for running games in *windowed* mode, so if you are on Windows, this will be the same as Gosu::screen_height minus space for the start menu/task bar at the bottom.
You should be seeing a black bar at the top and bottom each, and you are probably looking for Gosu::screen_width and Gosu::screen_height instead.

And if you want to stretch images without :retro => true and without producing a grid effect, :tileable => true was designed exactly for that purpose :) Hope that helps!
Topic Rosettacode.org By jlnr Date 2016-02-03 09:07
Nice! :)
Topic Procedural terrain generator works! well . . . sorta. By jlnr Date 2016-01-30 10:46
I have not built mip-maps before, but I'd try to generate the different mip-map levels during development using RMagick or some other tool. Less code, better results, because it does not simply skip pixels :)
(Or maybe Gosu should just let you enable mip-mapping with a flag...but so far this has not been a common request.)
Topic Procedural terrain generator works! well . . . sorta. By jlnr Date 2016-01-29 09:06
So are these black thin lines between tiles intentional? I am surprised that they're there :O

Also no idea about the black triangles. If you can build a small test case and it turns out that draw_quad cannot handle some coordinates well, I'll gladly look into it. In the meantime, can you add some runtime tests to make sure that the corners of adjacent tiles always match?

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill