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 10:16 Hi all! I'm a beginner. I need to include graphics mode in my program, I dunno how. I can do it in C++, but I can't in Ruby. Example: a ball falls down. Da program calculates it's coordinates and it works. But I wanna see it. For now I can see just an array of (x,y) values. Help me to make a graphic view using theese coordinates. In C++ I know I need just to initialize graphics mode. But I'm really green how to do it in Ruby. Help! -- Posted via http://www.ruby-forum.com/.
From: Marnen Laibow-Koser on 2 Dec 2009 10:19 Teodor Carstea wrote: > Hi all! I'm a beginner. > > I need to include graphics mode in my program, I dunno how. I can do it > in C++, but I can't in Ruby. > Example: a ball falls down. Da program calculates it's coordinates and > it works. But I wanna see it. For now I can see just an array of (x,y) > values. Help me to make a graphic view using theese coordinates. In C++ > I know I need just to initialize graphics mode. C++ has nothing like that -- there is no such thing as "graphics mode". Perhaps you're using a particular graphics library? > But I'm really green how > to do it in Ruby. > > > > Help! Same way as in C++: find a graphics library you like, learn to use it. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen(a)marnen.org -- Posted via http://www.ruby-forum.com/.
From: Paul Smith on 2 Dec 2009 10:19 On Wed, Dec 2, 2009 at 3:16 PM, Teodor Carstea <teodorcarstea(a)yahoo.com> wrote: > Hi all! I'm a beginner. > > I need to include graphics mode in my program, I dunno how. I can do it > in C++, but I can't in Ruby. > Example: a ball falls down. Da program calculates it's coordinates and > it works. But I wanna see it. For now I can see just an array of (x,y) > values. Help me to make a graphic view using theese coordinates. In C++ > I know I need just to initialize graphics mode. But I'm really green how > to do it in Ruby. Initialize graphics mode? C++ doesn't have a way to "initialize graphics mode", but some library, provided by the system or a 3rd party will do so. Unsurprisingly, you need a library to do the same in Ruby. What library are you using when you do this in C++? You could use a similar library in Ruby - Rubygame? Ruby/SDL? > > > > Help! > -- > Posted via http://www.ruby-forum.com/. > > -- Paul Smith http://www.nomadicfun.co.uk paul(a)pollyandpaul.co.uk
From: Teodor Carstea on 2 Dec 2009 10:49 >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! -- Posted via http://www.ruby-forum.com/.
From: Marnen Laibow-Koser on 2 Dec 2009 10:57 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> Where did you get this header? What does it contain? I don't think this is standard in C++. But we're getting off topic. > 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? Yes. Please read my earlier posts. > 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. What is that supposed to mean? > > Thanks! Best, -- Marnen Laibow-Koser http://www.marnen.org marnen(a)marnen.org -- Posted via http://www.ruby-forum.com/.
|
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? |