Résumé
If you are new to programming for the Palm and are looking for a solid introduction, this is the book for you. Developed by computer science professors, books in the for the absolute beginner series teach the principles of programming through simple game creation. You will acquire the skills that you need for more practical Palm programming applications and will learn how these skills can be put to use in real-world scenarios. Best of all, by the time you finish this book, you will be able to apply the basic principles you've learned to the next programming language you tackle!
With the instructions in this book, you'll learn to:- Create loops to repeat behavior
- Use the graphic mode to draw shapes and add a help system
- Store and retrieve data within a database
- Use variables and constants to handle information
- Create two-dimensional arrays
Contents
IntroductionChapter 1: Writing and Compiling PocketC Programs:
The Bad Joke Program
The Waiter Program
Saying Hello to the World
The Hello World Program
Adding Comments to Your Code
The main() Function
The alert() Function
Ending the main() Function
Dealing with Errors in the Code
Running Your Program
Compiling on the Desktop with PDE
Transferring Compiled Programs to the Palm
Using Palm's Emulator on the Desktop
Summary
Chapter 2: Variables, Input, and Output: The Name
Game
The Name Game Program
Basic String Variables
Working with Strings
String Concatenation
Thoughts on the alert() Function
Using the puts() Function
Using the Newline Character
Using wait() to Pause the Program
Using the sets() Function
Using the getsd() Function
Using the getsi() Function
Starting Up the Program
Introducing the Integer
Setting Up the Screen
Breaking Up Strings: substr(), strleft(), strright()
Getting a New Page
Extracting from the Middle of a String
Changing Strings: strupr(), striwr()
Getting Information about Strings: strient(), strstr()
The Name Game Program
Getting User Input
The String Manipulations
Chapter 3: Data and Decisions: The Morse Code
Program
The Morse Code Translator
Using Numeric Values
Variable Types in PocketC
Casting Variables
Conditions
Comparing Multiple Values with Else If
Comparing Multiple Values with Switch
Getting Random Percentages
Making Sound with the Tone Statement
Back to the Morse Code Program
Reading a Graffiti Stroke
Generating the Morse Code Signal
Chapter 4: Repeating Behavior and Larger Programs:
The Micro Football Game
Introducing the Micro Football Game
Designing a Program: The STAIR Process
Tool Identification
Generating an Algorithm
Implementation
Refining Your Program
Using a For Loop to Repeat a Given Number of Times
Returning a Value from a Function
Writing the Football Game
The Splash Screen
The Play Selection Menu
Managing the Opponent's Behavior
The runPlay Function
Displaying the Score
The main() Function
Chapter 5: Using the Graphics Mode: The
Sketcher
The Sketcher Program
Using the Graphics Mode
Graphics Mode
The Graphics Screen
Setting the Form Title
Writing Text with the text() Function
Changing the Text Characteristics with textattr(), textwidth(), and textalign()
Drawing Rectangles with the rect() and frame() Functions
Using Constants in Your Code
Creating Macros with #define
The Key Checker Program
The Event Demo Program
Variations of the event() Function
Getting Informatiion from the System
The drawRect() Function
The Help System
Starting the Event Loop
Handling the Pen Events
Handling the Character Events
Chapter 6: Creating Bitmap Graphics: The Space Rescue
Game
The Space Rescue Game
Bitmap Graphics
Using the Bitmap Studio Program to Generate an Image
Working with Arrays
Setting Up Some Constants
Initializing the Ship Array
The Main Loop
Putting Some of the Code in a Library
Importing the Libraries
Setting Up the Program
The Main Loop
The Event Loop
The moveShip() Function
The deltaV() Function
The pointRec() Function
The main() Function
Looking for Rectangle Overlaps: The Collision Detection Program
The Collision Function
The main() Function of the Collision Detection Program
The main() Function of Space Rescue
The deltaV Function
The moveShip() Function
The setManDir() Function
The moveMan() Function
The checkRendezvous() Function
Chapter 7: Adding a Graphical User Interface: The Mad
Lib Game
The Mad Lib Game
Using Ccontrols
Installing and Running the Ccontrols System
The Types of Controls Available
Responding to GUI Events
Building a More Complex Example
Adding a Label to the Screen
Generating Source Code
Examining the Main Memo Created by Ceditor
Examining the Controls Memo
Managing Events in the Don't Click Program
Modifying the Code
The makeStory() Function
Examining the Control-Building Code
Modifying the Event Loop
Chapter 8: Creating a Smart Opponent: The Tic-Tac-Toe
Game
The Tic-Tac-Toe Game
Creating a Heuristic
Drawing the Game Board
The checkHits() Function
Reusing the pointRec Function
The Square Checking Functions
Drawing the X and O Characters
The housekeeping Function
The main() Function
Looking for a Winner with If Statements
Working with the Winning Combination Array
Comparing the Board with the Winning Combos
Returning the Best Square
Presenting the Best Square
Chapter 9: Memo Access: The Life Game
Conway's Game of Life
Disadvantages of Memos
The Make Chart Program
Memo Functions
Reusing the pointRec() Function
Setting Up Buttons
Creating the Board
Showing the Board
Loading a Pattern from a Memo
Saving a Pattern to a Memo
Editing a Pattern
Showing the Neighborhood
Counting a Cell's Neighbors
Calculating the Next Generation
The main() Function of the Life Game
Chapter 10: Databases and Pointers: The Password
Keeper
The Password Keeper Program
Sequential Data Access
Creating a Database
Opening an Existing Database
Writing to a Database
Reading from a Database
Closing the Database
Problems with Sequential Access
Fixed-Length Strings
Creating Menus in Ccontrols
Accessing Menu Events
Initializing the Database
Creating the Controls
Creating the Menus
Getting a Record from the Database
Storing a Record to the Database
Moving to the Next Record
Moving to the Previous Record
Moving to the First and Last Records
Clearing the Database
Checking for the Database Owner
Searching for a Record
Responding to Menu Action
The main() Function
Chapter 11: Using the PToolbox Library: The
Animator
The Animator
Working with Files and Images
Enhancing Copying and Pasting
Working with Colors
Setting a Color Depth
The Color Draw Program
Displaying a Color Dialog Box
Adding a Flood Fill
Using a Custom Pattern
Copying Buffers
Copying Rectangles
Animating the Database
The Buffer DB main() Function
Counting the Number Of Records
Initializing the Program
Saving and Loading Images
Moving to Previous and Next Frame
Drawing a Polygon
Viewing the Animation
Copying Part of the Frame
Pasting from the Clipboard
Checking for Menu Input
The Main Event Loop
Looking for Menu Events
Chapter 12: Designing Data for Programs: The Pocket
Battle Game
The Pocket Battle Game
Design Principles
Unit Class Data
Map Data
Relating the Different Types of Data
Creating Complex Data Types in PocketC
Making the Global Variables
Creating the Menu
Creating the Direction Buttons
Initializing the Unit Class Data
Buying the Units
Initializing the Unit Data
Initializing the Map Data
Drawing the Map
Printing the Units
Placing the Units
Drawing the Units
Displaying the Online Help
Saving the Map
Loading the Map
Checking the Menus
Setting the dx and dz Variables
Getting a Move Direction from the User
Calculating Combat
Calculating the Move for One Unit
Managing All of the Unit Movement
Starting a New Game
The main() Function
A Final Word
Index
L'auteur - Andy Harris
Andy Harris earned a degree in Special Education from Indiana University/Purdue University-Indianapolis (IUPUI). He taught young adults with severe disabilities for several years. He also taught himself enough computer programming to support his teaching habit with freelance programming.
Those were the exciting days when computers started to have hard drives, and some computers connected to each other with arcane protocols. He taught programming in those days because it was fun.
Eventually, Andy decided to teach computer science full time, and he still teaches at IUPUI. He lectures in the applied computing program and runs the streaming media lab. He also teaches classes in whatever programming language is in demand at the time. He has developed a large number of online video-based courses and international distance education projects.
Andy has written several books on various computing topics and languages including Java, C#, mobile computing, JavaScript, and PHP/MySQL.
Andy welcomes comments and suggestions about his books. He can be reached at aharris@cs.iupui.edu.
Autres livres de Andy Harris
Caractéristiques techniques
PAPIER | |
Éditeur(s) | Prima Publishing |
Auteur(s) | Andy Harris |
Parution | 01/10/2001 |
Nb. de pages | 434 |
Format | 18,7 x 23,2 |
Couverture | Broché |
Poids | 807g |
Intérieur | Noir et Blanc |
EAN13 | 9780761535249 |
ISBN13 | 978-0-7615-3524-9 |
Avantages Eyrolles.com
Consultez aussi
- Les meilleures ventes en Graphisme & Photo
- Les meilleures ventes en Informatique
- Les meilleures ventes en Construction
- Les meilleures ventes en Entreprise & Droit
- Les meilleures ventes en Sciences
- Les meilleures ventes en Littérature
- Les meilleures ventes en Arts & Loisirs
- Les meilleures ventes en Vie pratique
- Les meilleures ventes en Voyage et Tourisme
- Les meilleures ventes en BD et Jeunesse