LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Getting Back Into Hobby Programming, Searching For Square One (https://www.linuxquestions.org/questions/linux-newbie-8/getting-back-into-hobby-programming-searching-for-square-one-575788/)

Pete Holland Jr. 08-08-2007 11:47 PM

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?

chrism01 08-09-2007 03:30 AM

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".

maroonbaboon 08-09-2007 09:38 PM

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.

Just my :twocents:


All times are GMT -5. The time now is 02:49 AM.