Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

578
Views
Ruby Gosu: ¿cómo puedo guardar la ventana/pantalla real en un archivo de imagen?

Estoy tratando de hacer una función de captura de pantalla del estado real de la ventana/pantalla. ¿Cómo puedo lograr esto usando Ruby Gosu?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Usa el método Gosu.render de Gosu

 require "gosu" class Window < Gosu::Window def initialize(*args) super end def draw Gosu.draw_rect(100, 100, 100, 100, Gosu::Color::YELLOW) end def button_down(id) render("screenshot.png") if id == Gosu::KB_F12 end def render(filename) Gosu.render(600, 600, retro: false) do # Put drawing code here, ie draw end.save(filename) end end Window.new(600, 600, false).show

También puede usar Gosu.render sin una ventana si lo desea:

 require "gosu" image = Gosu.render(600, 600, retro: false) do Gosu.draw_rect(100, 100, 100, 100, Gosu::Color::YELLOW) end image.save("image.png")
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!