Getting Back Into Hobby Programming, Searching For Square One
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Getting Back Into Hobby Programming, Searching For Square One
I hope I don't seem like I'm rambling on, I just want to provide enough information so that everyone knows where I'm coming from. I will not be considered a pro in any aspect of this for a long time. ;-)
Last year, I decided, after a long time away from computer programming, to get back into the hobby (previous experience: BASIC on the Timex/Sinclair 1000 and IBM PCjr, some 6502 assembly for the original Atari line-up). So I got myself some books on C++, which I understand to be the universal programming language. It's been coming along bit by bit. I learn more by doing, though, and am looking to try a couple of things. But first, I need some guidance.
Okay, I am still learning in text mode. This is more than fine for the moment. As it is, the screen is basically doing the line printer thing--prints a line, scrolls screen, prints line, scrolls, etc. I grew up playing and making text mode games. It was the programming equivalent of stock car racing--16 colors, 256 characters, go nuts. Not only would I like to relive those old days, but text mode, I would imagine, has the advantage of being nearly universally compatible. I can compile the code with nearly no changes (assuming I use the standard extended ASCII set) on Linux, Mac, or Windows. Nothing that would, say, have the boys from id shaking in their boots, but enough to make some goofy fun stuff.
When I try to search for stuff for text mode programming, I get things like editing C++ code in vi or such, and the books I find explaining some things date back to Win95. There has to be something a little more recent out there. So I'm hoping someone here can help with a few questions. Is there a book or online resource that explains text mode things like repositioning the cursor onscreen and changing text colors? Also, is there a Linux compiler that can produce executables for Win and Macs (compilers for Linux under Linux is pretty much a given), assuming I'm not trying anything that requires a graphics mode or sound drivers or such?
Not really my area of expertise, but I think for text mode ctrl, man/google 'ncurses'.
I think the Linux compiler (gcc) has cross-compilation options/libs.
Again, try google for "gcc + mac cross-compile".
IIRC 'graphics' programming on a Sinclair or Atari involved 'peeking' and 'poking' values out of/into screen locations according to (x,y) coords. So chrism01's suggestion to use ncurses would certainly give you similar facilities in a terminal window. But using C++ to do that seems a bit like learning to fly a Boeing 747 to do some crop dusting
If you want portability you would be better off with Java, which also has nice graphics/gui libraries and can also run as an applet in a web browser.
For the fun side consider Pygame. Like Basic, python is an interpreted language. Generally you can do things much faster, with much less code compared to C++ or Java. Pygame will also give you sprites, smooth animation and sound, all cross-platform. As interpreted code, it will run without change under different OS.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.