From: niels wolf Date: 2003-04-10T02:33:57+09:00 Subject: Re: [Q] Ruby for graphics thanx. yep i had a look and opengl was what i found also. i'm sitting on winxp. but want to write for the server, so linux/unix. so i was looking for something "native", so i can test and develop on my machine and set it on the server without bugs or changings. niels ----- Original Message ----- From: "Bill Kelly" To: "ruby-talk ML" Sent: Wednesday, April 09, 2003 7:20 PM Subject: Re: [Q] Ruby for graphics > Hi Dominik and Neils, > > From: "Dominik Werder" > > > > I would like to do some graphics programming on my own, but I don't know > > which API to use.. > > May I ask you what software you use and on which OS? > > From: "niels wolf" > > > > hm, just some stupid question. new to ruby. what is to use for graphic > > manipulation?? > > > I'm personally using RUDL (Ruby bindings to libsdl: > [ http://froukepc.dhs.org/rudl/ ]), and also a little OpenGL. > > Currently the RUDL FAQ lists some problems running under > non-windows operating systems. I'm using Ruby 1.6.6 on win2k. > > However I believe the OpenGL bindings definitely work on Linux. If > you're on Windows, and using the Pragmatic Programmers installer for > Ruby, OpenGL support should already be installed for you. Otherwise, > see the RAA: [ http://raa.ruby-lang.org/list.rhtml?name=opengl ] > > RUDL provides support for loading images as textures or sprites, > drawing them to the screen, full-screen mode or windowed, some > basic graphics primitives, and I think audio and joystick support > (but I haven't tried the latter two.) > > Here's one of the simpler examples that comes with RUDL, for > loading a sprite and bouncing it around on the screen: > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > require 'RUDL'; include RUDL > > display = DisplaySurface.new([640, 480]) > ball = Surface.load_new('media/bounce.bmp') > lastrect = [0,0,0,0] > > loop { > break if EventQueue.poll.type == QuitEvent > pos = [(Timer.ticks%1024-512).abs, ((Timer.ticks+200)%704-352).abs] > rect = display.blit(ball, pos) > display.update([rect.union(lastrect)]) > display.fill([0, 0, 0], lastrect = rect) > } > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > As for image manipulation libraries, I haven't used any with > Ruby yet. Last I looked, there appeared to be some available > for Linux (imlib2 bindings, ImageMagick bindings, etc.) but I > didn't see much for Windows. That may have changed... try > looking on RAA: > [ http://raa.ruby-lang.org/cat.rhtml?category_major=Library;category_minor=Gra phics ] > > > > Hope this helps, > > Bill > > >