Questions tagged [libgosu]

Gosu is a 2D game development library for the Ruby and C++ programming languages.

See homepage at http://www.libgosu.org/

See Ruby documentation at https://www.rubydoc.info/github/gosu/gosu/

118 questions
2
votes
1 answer

Could not parse audio file track1.m4a

Interrupt message: C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/gosu-1.4.3/lib/gosu/compat.rb:116:in `initialize': Could not parse audio file track1.m4a (RuntimeError) : Couldn't open track1.m4a I'm trying to open some tracks in Ruby using Gosu, but the…
LycoReco2007
  • 127
  • 7
2
votes
1 answer

Centre text in ruby/libgosu

I am trying to centre text in ruby/gosu. However all answers I have come across use deprecated methods. This is the code I've made from those answers. Any help on how to make it work with current versions? if @track_listing < album.tracks.length …
Kyle Sharp
  • 167
  • 2
  • 9
2
votes
1 answer

Increment an onscreen counter with a ruby/gosu window

I am trying to make a very simple click counter and I am stuck on getting the click counter to increment, both onscreen and in the code itself. require 'rubygems' require 'gosu' module ZOrder BACKGROUND, MIDDLE, TOP = *0..2 end WIN_WIDTH =…
Kyle Sharp
  • 167
  • 2
  • 9
2
votes
1 answer

Optimization of Gosu Rendering Technique

I'm writing a game for the first time using the Gosu ruby gem as the graphics library. I think I understand generally that the logic for updating game state and the logic for updating / rendering should be segregated, and I've done my best efforts…
Alex Dovzhanyn
  • 1,028
  • 6
  • 14
2
votes
1 answer

Why does ruby-prof list "Kernel#`" as a resource hog?

I'm using ruby-prof to figure out where my CPU time is going for a small 2D game engine I'm building in Ruby. Everything looks normal here aside from the main Kernel#` entry. The Ruby docs here would suggest that this is a function for getting the…
taylorthurlow
  • 2,953
  • 3
  • 28
  • 42
2
votes
2 answers

undefined method `-' for nil:NilClass (NoMethodError)

I can't work out how to fix it so it takes ten away from the health class variable, as it says that it is an error. /home/will/Code/Rubygame/objects.rb:61:in `attacked': undefined method `-' for nil:NilClass (NoMethodError) from ./main.rb:140:in…
Will
  • 23
  • 1
  • 5
2
votes
1 answer

(Ruby:Gosu) Gosu drawing shape images with sprites

i am making a simple game using Gosu, however i do not want to use external sprites for my game and i would rather draw images using code, is it possible to use code drawn images as if they were external images. Note: i only want to draw basic…
Boris
  • 75
  • 8
2
votes
2 answers

Cannot print a text with Gosu in Ruby (crash)

I'm trying to learn some basics of Gosu. I can display images but when i try with text the application crashed. Here's a simple code i'm trying to run. require 'gosu' class GameWindow < Gosu::Window def initialize(width=320,…
2
votes
1 answer

Undefined Method (NoMethodError) ruby and Gosu

I'm having a problem calling the x position and y position of a Player. When I call the origin_object.x and origin_object.y with the class Projectile it gives me this error: asteroids.rb:35:in `update': undefined method `x' for…
Juan Pablo
  • 161
  • 2
  • 5
2
votes
2 answers

High CPU Usage in Gosu Drawing Program with Ruby

I have been tinkering with making a drawing application in Gosu using Ruby, but am running into some high CPU usage. I know one possible cause. First, I am simply adding a primitive to an hash every time the user clicks the mouse button (or if they…
cyclingLinguist
  • 334
  • 1
  • 5
  • 16
1
vote
2 answers

debian dependencies for gem gosu

I'm trying to gem install gosu but I'm getting a lot of compiler messages about missing header files, including sndfile.h. Is there a list of debian packages that are needed to compile the gosu gem?
David Nehme
  • 21,379
  • 8
  • 78
  • 117
1
vote
1 answer

Ruby Gosu: how can I save the actual Window/Screen in an image file?

I am trying make a screenshot functionality of the actual state of the Window/Screen. How can I achieve this using Ruby Gosu?
fguillen
  • 36,125
  • 23
  • 149
  • 210
1
vote
1 answer

How to draw a text with unicode character on the main window using Gosu Ruby?

I'm trying to output text to the main window with unicode character like that def initialize super 800, 800 self.caption = 'Chess' @font = Gosu::Font.new(self,…
steimo
  • 170
  • 1
  • 2
  • 10
1
vote
1 answer

Display number of times click on screen using Gosu.button_down

I am working on a ruby program using Gosu. I want to display the number of mouse click times every time I click on a button on the screen. Please help me with this. Thank you so much require 'rubygems' require 'gosu' module ZOrder BACKGROUND,…
dangerzone
  • 25
  • 4
1
vote
2 answers

Why is Docker CMD running as chronos in GKE?

I have a pod and NodePort service running on GKE. In the Dockerfile for the container in my pod, I'm using gosu to run a command as a specific user: startup.sh exec /usr/local/bin/gosu mytestuser "$@" Dockerfile FROM…
rmf
  • 625
  • 2
  • 9
  • 39