Fedora Linux Support Community & Resources Center
  #1  
Old 23rd June 2017, 02:08 PM
tech291083 Offline
Registered User
 
Join Date: Sep 2006
Posts: 1,415
linuxfedorafirefox
Writing games in C language

Friends,

I have taught myself a bit of ANSI C. I would love to write some very basic games that can be played in a terminal only (as far as I know, C does not offer GUI support, please correct me, if I am wrong). Is there any good book on this very subject? I did search Amazon etc, but could not find anything interesting. Thanks.
__________________
fedoralinuxcommands.blogspot.com


All the forces in the world are not so powerful as an idea whose time has come - Victor Hugo
Reply With Quote
  #2  
Old 23rd June 2017, 02:40 PM
lsatenstein Online
Registered User
 
Join Date: Jun 2005
Location: Montreal, Que, Canada
Posts: 4,349
linuxfedorafirefox
Re: Writing games in C language

Quote:
Originally Posted by tech291083 View Post
Friends,

I have taught myself a bit of ANSI C. I would love to write some very basic games that can be played in a terminal only (as far as I know, C does not offer GUI support, please correct me, if I am wrong). Is there any good book on this very subject? I did search Amazon etc, but could not find anything interesting. Thanks.
C does offer GUI support. You have to do more to manage your application GUI, thats all.
__________________
Leslie in Montreal

Interesting web sites list
http://forums.fedoraforum.org/showth...40#post1697840
Reply With Quote
  #3  
Old 23rd June 2017, 03:11 PM
ocratato Online
Registered User
 
Join Date: Oct 2010
Location: Canberra
Posts: 2,649
linuxfirefox
Re: Writing games in C language

There are a variety of GUI libraries that you can use from C. GTK is probably the one to use if you want to go that way.
(GUIs are fundamentally an object based system, so C++ is probably a better choice for GUIs, so I will put that aside for now, and concentrate on command line stuff.)

I think writing a simple game for the command line would be an excellent way to learn more about programming.

The simplest command line games would be text adventure games.
( http://home.hccnet.nl/r.helderman/ad...tpataic01.html )

If you want something with a little more animation, without going full GUI, you could use the ncurses library. You could do a simple space invaders using that library.

For more sophisticated games, the SDL library is quite popular.
__________________
Has anyone seriously considered that it might be turtles all the way down?
That's very old fashioned thinking.
The current model is that it's holographic nested virtualities of turtles, all the way down.
Reply With Quote
  #4  
Old 23rd June 2017, 11:30 PM
RupertPupkin's Avatar
RupertPupkin Offline
Registered User
 
Join Date: Nov 2006
Location: Detroit
Posts: 6,645
linuxfedorafirefox
Re: Writing games in C language

Quote:
Originally Posted by tech291083 View Post
I have taught myself a bit of ANSI C. I would love to write some very basic games that can be played in a terminal only
Besides Ncurses, which orcatato mentioned, some other C libraries for terminal applications are Newt and S-Lang, both of which are in the Fedora repos (dnf install newt-devel slang-devel). S-Lang applications have kind of that old DOS/Borland-style look. For example, the JED text editor (dnf install jed) is written in S-Lang, and it looks like this:

__________________
OS: Fedora 26 x86_64 | Machine: HP Pavilion a6130n | CPU: AMD 64 X2 Dual-Core 5000+ 2.6GHz | RAM: 7GB PC5300 DDR2 | Disk: 400GB SATA | Video: ATI Radeon HD 4350 512MB | Sound: Realtek ALC888S | Ethernet: Realtek RTL8201N
Reply With Quote
  #5  
Old 25th June 2017, 10:41 PM
RupertPupkin's Avatar
RupertPupkin Offline
Registered User
 
Join Date: Nov 2006
Location: Detroit
Posts: 6,645
linuxfedorafirefox
Re: Writing games in C language

You might also want to look at the source for some of the terminal-based games in the Fedora repos. For example, look at the bsd-games pacakge:
Code:
mkdir bsdgames-src
cd bsdgames-src
dnf download --source bsd-games
rpm2cpio bsd-games-2.17-51.fc25.src.rpm | cpio -ivd
tar xzvf bsd-games-2.17.tar.gz
cd bsd-games-2.17
Then look in any of the directories under bsd-games-2.17 for the C source code. I've always found this the best way to learn.
__________________
OS: Fedora 26 x86_64 | Machine: HP Pavilion a6130n | CPU: AMD 64 X2 Dual-Core 5000+ 2.6GHz | RAM: 7GB PC5300 DDR2 | Disk: 400GB SATA | Video: ATI Radeon HD 4350 512MB | Sound: Realtek ALC888S | Ethernet: Realtek RTL8201N
Reply With Quote
  #6  
Old 11th October 2017, 01:26 PM
tech291083 Offline
Registered User
 
Join Date: Sep 2006
Posts: 1,415
linuxfedorafirefox
Re: Writing games in C language

Sorry for the late reply, but thanks a lot, friends.
__________________
fedoralinuxcommands.blogspot.com


All the forces in the world are not so powerful as an idea whose time has come - Victor Hugo
Reply With Quote
  #7  
Old 11th October 2017, 02:05 PM
ocratato Online
Registered User
 
Join Date: Oct 2010
Location: Canberra
Posts: 2,649
linuxfirefox
Re: Writing games in C language

Have you had a chance to write anything interesting ?
__________________
Has anyone seriously considered that it might be turtles all the way down?
That's very old fashioned thinking.
The current model is that it's holographic nested virtualities of turtles, all the way down.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing programs in Objective C language tech291083 Programming & Packaging 5 8th August 2012 12:09 PM
How switch language text in Fedora Games Spin xhell Fedora Spins & Remixes 0 10th June 2011 05:23 PM
Language problem (Writing in Greek) dexter8 Using Fedora 5 18th October 2009 09:32 PM
Writing in another language Part 2 (different) Epistax Using Fedora 0 12th December 2004 10:27 PM
Writing in another language Epistax Using Fedora 0 12th December 2004 04:13 AM


Current GMT-time: 03:38 (Thursday, 19-10-2017)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat