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.
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?
···
On Wed, Dec 2, 2009 at 3:16 PM, Teodor Carstea <teodorcarstea@yahoo.com> wrote:
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.
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.
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.
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.
I'm really confused.
You use Ubuntu, but you have a C:\ drive?
You use ubuntu, and therefore have access to gcc, but use the Borland
compiler instead?
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:
On 2009-12-02, Teodor Carstea <teodorcarstea@yahoo.com> wrote:
--
Copyright 2009, all wrongs reversed. Peter Seebach / usenet-nospam@seebs.net | Seebs.Net <-- lawsuits, religion, and funny pictures Fair game (Scientology) - Wikipedia <-- get educated!
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.
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.
···
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!
--
Chanoch (Ken) Bloom. PhD candidate. Linguistic Cognition Laboratory.
Department of Computer Science. Illinois Institute of Technology. http://www.iit.edu/~kbloom1/
It ain't Ruby, but you might be interested in the BOSS library
( Welcome To codedread )
which implements a bunch of the old Borland C++ libraries on top of the
modern SDL graphics library, if you plan to keep coding in C++.
--Ken
···
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!
--
Chanoch (Ken) Bloom. PhD candidate. Linguistic Cognition Laboratory.
Department of Computer Science. Illinois Institute of Technology. http://www.iit.edu/~kbloom1/
There have been several recent threads in this forum on GUI development
in Ruby, and I'd recommend reading them. I'm using JRuby and Monkeybars
for my one non-Rails project.
Heh same here actually... 10 years ago API Compsci
···
-----Original Message-----
From: news [mailto:news@ger.gmane.org] On Behalf Of Ken Bloom
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.)
Ah, nostalgia I think it was from Borland's conio, a very
well-designed library indeed. I missed it when I first moved to linux.
martin
···
On Wed, Dec 2, 2009 at 11:25 PM, Seebs <usenet-nospam@seebs.net> wrote:
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.
Well, actually this is not that obsolete. If you open an X window you
can use it exactly the same way (as long as the kind user does not
resize it for you). There is the Linux framebuffer console which works
pretty much the same (which is being obsoleted for some/most
chipsets). Yet as it is being thrown out through the door it climbs
back through the window in the form of KMS.
Writing X servers is not that uncommon, too. Linux/BSD ports on some
obscure platforms are in need of X server implementation/improvement
(ie. Nintendo DS - anyone would finish it?)
And since we will have KMS it should be much easier to throw away
Xfree86 and finally get some decent GUI system which is not patch on
patch of decades old cruft.
GRUB is currently in the process of implementing a graphics menu
system for eye candy, non-Latin language support, and non-VGA platform
support which (surprise!) has to deal with this 20 years old direct
memory access approach.
In fact, there is a windowing system (EWS) that is completely based
around emulated video memory bufffers and has no pre-made buttons,
canvases, pixmaps or anything like that. It's dead simple, fast
enough, end even has decent security.
Thanks
Michal
···
2009/12/3 Ken Bloom <kbloom@gmail.com>:
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.
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.
Eeek! I feel old. I did AP CompSci back 21 years ago. It was in Pascal then......
Matt
···
On Thu, 3 Dec 2009, Walton Hoops wrote:
-----Original Message-----
From: news [mailto:news@ger.gmane.org] On Behalf Of Ken Bloom
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.)
Heh same here actually... 10 years ago API Compsci
I liked it too. The only problem I had with it was that it only used VGA page 1 (in its TurboC incarnation). But a disassembler and few changes and it worked for both...
Matt
···
On Thu, 3 Dec 2009, Martin DeMello wrote:
On Wed, Dec 2, 2009 at 11:25 PM, Seebs <usenet-nospam@seebs.net> wrote:
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.
Ah, nostalgia I think it was from Borland's conio, a very
well-designed library indeed. I missed it when I first moved to linux.
Your IDE is irrelevant. (But consider abandoning NetBeans and using
something like KomodoEdit.)
No. That's not what this list is for. If you need that kind of
handholding, buy a book.
well, well, it is truly offensive, but it makes me go stronger and
further.
and.... I'm not gonna buy ANY books.
"The best friend for you is yourself" (Louis Armstrong)