Prev: [Link] Development of Ruby VMs
Next: How to use rb_enc_str_new() to create a String with UTF-8 encoding?
From: Teodor Carstea on 2 Dec 2009 12:18 unknown wrote: > On Wed, Dec 2, 2009 at 10:49 AM, Teodor Carstea > <teodorcarstea(a)yahoo.com> wrote: >> I use Ubuntu > > Google: "ruby graphics": > http://www.greaterbostonrubyandrails.com/RubyGraphics.html THANKS! -- Posted via http://www.ruby-forum.com/.
From: Seebs on 2 Dec 2009 12:53 On 2009-12-02, Teodor Carstea <teodorcarstea(a)yahoo.com> wrote: > Well, this is the way I do it in C++: Uh. > #include <graphics.h> This header is not part of standard C++. It's a library provided by your compiler. > void main(){ This is wrong too. main() returns int. If your compiler isn't giving you a warning for that, you should probably set it to be more aggressive. > initgraph(&gdriver, &gmode, "C:\\Progra~1\\BORLANDC\\BGI"); You should be using forward slashes (they work fine on Windows in file names) and full names, not the weird DOS-style names, in all probability. > getch(); This function exists only in a non-standard library you haven't referred to, and shouldn't be getting used here anyway. If you need to make a program wait for a user to hit a key before exiting, you have done something else fundamentally wrong. > P.S.: If you have an idea, please describe it in a way you would talk to > a noob, for I'm really green. Plus, I use Ubuntu, no comment. I would recommend that you look into one of the existing graphics libraries provided by the environment. You'll note that the program described above doesn't work on your Ubuntu system. There's a bunch of graphics libraries out there. It matters a fair bit what you want, but some people have suggested gosu: http://code.google.com/p/gosu/ -s -- Copyright 2009, all wrongs reversed. Peter Seebach / usenet-nospam(a)seebs.net http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
From: Seebs on 2 Dec 2009 12:54 On 2009-12-02, Teodor Carstea <teodorcarstea(a)yahoo.com> wrote: > and.... I'm not gonna buy ANY books. Why not? > "The best friend for you is yourself" (Louis Armstrong) He'd be a better friend if he bought you some books to help you learn faster. -s -- Copyright 2009, all wrongs reversed. Peter Seebach / usenet-nospam(a)seebs.net http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
From: Marnen Laibow-Koser on 2 Dec 2009 13:38 Seebs wrote: > On 2009-12-02, Teodor Carstea <teodorcarstea(a)yahoo.com> wrote: >> and.... I'm not gonna buy ANY books. > > Why not? Well, to be fair...I usually have a similar attitude. Between the rapid change velocity of things like Rails and all the free info out there, I don't usually need the books. But with that choice come certain consequences, such as lack of handholding. I have chosen to accept those consequences. People who don't want to accept those consequences should not make that choice. > >> "The best friend for you is yourself" (Louis Armstrong) > > He'd be a better friend if he bought you some books to help you learn > faster. > > -s Best, -- Marnen Laibow-Koser http://www.marnen.org marnen(a)marnen.org -- Posted via http://www.ruby-forum.com/.
From: Ken Bloom on 2 Dec 2009 21:08 On Thu, 03 Dec 2009 00:49:57 +0900, Teodor Carstea wrote: >>C++ doesn't have a way to "initialize graphics mode" > > Well, this is the way I do it in C++: > > #include <graphics.h> > void main(){ > //initializing graphics mode > int gdriver=DETECT, gmode, errorcode; > initgraph(&gdriver, &gmode, "C:\\Progra~1\\BORLANDC\\BGI"); errorcode > = graphresult(); > if(errorcode!=grOk) { > cout<<"Graphics error!!!\n" > <<"Press any key..."; > getch(); > exit(1); > } > //... > //AND HERE IS DA MAIN PROGRAM CODE. > //... > } > > I'd like to make my ruby prog like this. Any Ideas? P.S.: If you have an > idea, please describe it in a way you would talk to a noob, for I'm > really green. Plus, I use Ubuntu, no comment. > > Thanks! Wow! That's a blast from the past! I'm guessing it's either Borland C++ for DOS (where screens actually did have "graphics mode" versus "text mode"[1]) or their library for Windows which simulated the old DOS library by opening up a window and drawing in that window. (I programmed for this emulation library 10 years ago as part of an AP computer science assignment.) I'm guessing that you're moving from your knowledge of old DOS/Windows and C++, you're moving to Linux and now you want to learn a nice shiny new language for programming in Linux, so you chose Ruby. If you're planning on writing GUI applications, you should either look at Ruby/GTK+ or QTRuby, both of which are good frameworks providing all of the standard widgets that you find in word processors, web browsers, and the like. http://ruby-gnome2.sourceforge.jp/ http://techbase.kde.org/Development/Languages/Ruby If you want full screen graphics (or full-screen graphics in a window), which is often useful for game programming, you should look at Ruby/SDL. http://www.kmc.gr.jp/~ohai/rubysdl.en.html Ultimately you should take the time to learn a little of both. [1] FWIW, Linux has this too, but you only think about it that way if you're writing an X server or programming in svgalib. For the most part that view of the world is obsolete by about 20 years. -- Chanoch (Ken) Bloom. PhD candidate. Linguistic Cognition Laboratory. Department of Computer Science. Illinois Institute of Technology. http://www.iit.edu/~kbloom1/
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 5 Prev: [Link] Development of Ruby VMs Next: How to use rb_enc_str_new() to create a String with UTF-8 encoding? |