⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 0281-0284.html

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTML
字号:






<HTML>

<HEAD>

<TITLE>Developer.com - Online Reference Library - 0672311623:SAMS TEACH YOURSELF LINUX IN 24 HOURS:Playing Linux Games</TITLE>

<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>

 -->




<!-- ISBN=0672311623 //-->

<!-- TITLE=SAMS TEACH YOURSELF LINUX IN 24 HOURS //-->

<!-- AUTHOR=BILL BALL, STEPHEN SMOOGEN //-->

<!-- PUBLISHER=MACMILLAN //-->

<!-- IMPRINT=SAMS //-->

<!-- PUBLICATION DATE=1998 //-->

<!-- CHAPTER=19 //-->

<!-- PAGES=0281-0290 //-->

<!-- UNASSIGNED1 //-->

<!-- UNASSIGNED2 //-->







<P><CENTER>

<a href="../ch18/0279-0280.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0285-0288.html">Next</A>

</CENTER></P>



<A NAME="PAGENUM-281"><P>Page 281</P></A>











<H3><A NAME="ch19_ 2">

Hour 19

</A></H3>



<H2>

<A NAME="ch19_ 3">

Playing Linux Games

</A>

</H2>



<P>It's time to sit back, relax, and have some fun. Chances are that you've

skipped the rest of the book and are reading this chapter first. Well, that's

okay, because we all know the real reason we bought our computers, right? To

zap hordes of alien invaders streaming across our screen!

</P>



<P>In this hour you'll learn about two music CD players and some of the

more than 70 games you can install on your system. This hour starts with

an overview of the CD players, then moves on to information about

playing games at the console and with the X Window System.

</P>

<A NAME="PAGENUM-282"><P>Page 282</P></A>





<H3><A NAME="ch19_ 4">

Playing Music CDs with the cpd and xplaycd Commands

</A></H3>



<P>Using your computer as a stereo system may seem a bit extravagant, but it's nice to be

able to listen to music while you work. In order to do this, Linux must be configured to use

your sound card.

</P>



<TABLE BGCOLOR=#FFFF99><TR><TD>TIME SAVER</TD></TR><TR><TD>

<BLOCKQUOTE>

If you have not configured Linux to support sound, stop! In order to use

your CD-ROM drive to play music CDs, you must have sound support installed

in your kernel. See Hour 22, &quot;Red Hat Tools.&quot;

</BLOCKQUOTE>

</TD></TR></TABLE>





<P>If your sound card works with Linux, great! You can start playing music CDs right

away. If you're not using X11, you can play music CDs with Sariel Har-Peled's

cdp command, found under the /usr/bin directory. This command is a text-mode program. To use it,

put a music CD in your CD-ROM drive and type the command:

</P>



<!-- CODE SNIP //-->

<PRE>

# cdp

</PRE>

<!-- END CODE SNIP //-->



<P>If nothing happens, make sure have a symbolic link, called

/dev/cdrom, that points to your CD-ROM device&#151;for example,

</P>



<!-- CODE SNIP //-->

<PRE>

# ls -l /dev/cdrom

lrwxrwxrwx   1 root     root            3 Dec 22 08:19 /dev/cdrom -&gt; hdb

</PRE>

<!-- END CODE SNIP //-->



<P>You can create a symbolic link with the ln command. Make sure you're logged in as

the root operator and type the following:

</P>



<!-- CODE SNIP //-->

<PRE>

# ln -s /dev/XXX /dev/cdrom

</PRE>

<!-- END CODE SNIP //-->



<P>This creates the symbolic link, /dev/cdrom, which points to your CD-ROM drive device

XXX (hdb, sdb, scd, and so on). If you're not the root operator when you run first run

cdp, you may get an error message:

</P>



<!-- CODE SNIP //-->

<PRE>

# cdp

As root, please run

chmod 666 /dev/cdrom

to give yourself permission to access the CD-ROM device.

</PRE>

<!-- END CODE SNIP //-->



<P>By default, CD-ROM devices are created with a file permission of 660, and the

cdp command requires your device to be readable by anyone on your system. To fix this,

use the chmod command (discussed in Hour 21, &quot;Handling Files&quot;):

</P>

<!-- CODE SNIP //-->

<PRE>

# chmod 666 /dev/cdrom<BR>

</PRE>

<!-- END CODE SNIP //-->





<A NAME="PAGENUM-283"><P>Page 283</P></A>





<P>

Now run the cdp command. When it starts, you'll see a list of the tracks on your CD.

You should then turn on the NumLock key of your keyboard to control how you'd like to

play your CD. Table 19.1 lists the controls for playing CDs from your keyboard's

keypad.

</P>



<P>Table 19.1. The cdp command keypad controls.

</P>



<TABLE>



<TR><TD>

Action

</TD><TD>

Keypad Key

</TD></TR><TR><TD>

Soft exit (music continues)

</TD><TD>

0

</TD></TR><TR><TD>

Help

</TD><TD>

.

</TD></TR><TR><TD>

Back 15 seconds

</TD><TD>

1

</TD></TR><TR><TD>

Hard abort (eject CD)

</TD><TD>

2

</TD></TR><TR><TD>

Forward 15 seconds

</TD><TD>

3

</TD></TR><TR><TD>

Previous Track

</TD><TD>

4

</TD></TR><TR><TD>

Replay CD

</TD><TD>

5

</TD></TR><TR><TD>

Next Track

</TD><TD>

6

</TD></TR><TR><TD>

Stop

</TD><TD>

7

Toggle Pause/Resume

</TD></TR><TR><TD>

8

</TD><TD>

Play

</TD></TR><TR><TD>

9

</TD></TR></TABLE>



<P>The cdp command has a number of command-line options. A symbolic link, called

cdplay, can be used to play music without the cdp command's interactive screen. You can tell

cdplay to start playing music at a certain track with the play option, followed

by a track number:

</P>



<!-- CODE SNIP //-->

<PRE>

# cdplay play 3

</PRE>

<!-- END CODE SNIP //-->



<P>This command line starts the cdp program, and your music CD starts playing from

the third track. For more details about using the

cdp command, see its manual page. The cdp command is handy for playing CDs from your console or the command line of an

X11 terminal window, but if you use X11 all the time, you may want to use the

xplaycd command, found under the /usr/X11R6/bin directory.

</P>



<P>The xplaycd command, by Olav Woelfelschneider, is an X11 client you can use to play

music CDs. The program appears in a small window with the standard music CD controls,

along with horizontal stereo volume bars and a list of buttons representing the tracks on the

CD. You can raise or lower your music's volume by clicking your left mouse button ahead

of or behind the horizontal bars.

</P>



<P>One great feature of this program is the ability to reorder tracks, and even play a

track multiple times (see Figure 19.1). By clicking a track number and dragging, you

can

</P>

<A NAME="PAGENUM-284"><P>Page 284</P></A>





<P>

rearrange the play sequence of the tracks on your CD. To play a track multiple times,

click a track number with your mouse's middle button and drag the track along the CD

track sequence. When you release your mouse button, the track number is duplicated.

</P>



<P>Figure 19.1.<BR>

The xplaycd X11 client<br>

offers standard music<BR>

CD controls, along <br>

with track re-ordering <br>

and volume control.</P>

<P><a href="javascript:displayWindow('images/ch19fg01.jpg', 135, 68)"><img src="images/tn_ch19fg01.jpg"></a><BR>

</P>





<P>

The xplaycd also supports a music CD database, so you can create playlists of tracks

for your favorite CDs. If you press your right mouse button anywhere on the xplaycd

window, a menu of editing commands pops up. Use this menu to create and save your CD's

play list. The database will be saved in the

/var/lib/cddb, or CD database directory. You also

can save CDs into different categories, such as jazz, new age, and so on. For details about

using the xplaycd command, read its manual page, or the more detailed documentation under

the /usr/doc/multimedia directory.

</P>



<H3><A NAME="ch19_ 5">

Games for the Console

</A></H3>



<P>If you don't use X11, you also can have fun at the console, because you'll find an

assortment of 43 classic games you can play. Some of the games, like DOOM, have

impressive graphics. Others use simple cursor movements and characters on your display.

</P>



<P>Install the Berkeley Software Distribution, or BSD games, and you'll find: arithmetic,

atc, backgammon, battlestar, bog, caesar, canfield, cribbage, factor, fish, hangman,

mille, monop, paranoia, robots, trek, wargames, worm, and wump.

</P>



<P>If you like text-based adventure games, try the

scottfree command. This game interpreter comes with 11 adventures. Play an adventure by specifying its name on the command line.

</P>



<!-- CODE //-->

<PRE>

# scottfree 6_circus

Scott Free, A Scott Adams game driver in C.

Release 1.14, (c) 1993,1994,1995 Swansea University Computer Society.

Distributed under the GNU software license



Roll up! Roll up!



The CIRCUS is in town!



Tell me what to do ?

</PRE>

<!-- END CODE //-->



<P>This command line starts a circus text adventure. For more information about

playing these games, read the files in the

/usr/doc/scottfree and /usr/doc/mysterious directories.

</P>





<P><CENTER>

<a href="../ch18/0279-0280.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0285-0288.html">Next</A>

</CENTER></P>











</td>
</tr>
</table>

<!-- begin footer information -->









</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -