售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Libgdx Cross-platform Game Development Cookbook
Table of Contents
Libgdx Cross-platform Game Development Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Diving into Libgdx
Introduction
Setting up a cross-platform development environment
Getting ready
How to do it…
Java Development Kit
Windows and Mac users
GNU/Linux users
Eclipse
Android SDK
Mac users
GNU/Linux users
All users
Eclipse plugins
XCode
Fixing character encoding and line endings
Making sure everything is in order
How it works…
There's more…
See also
Creating a cross-platform project
Getting ready
How to do it…
How it works…
There's more…
See also
Understanding the project structure and application life cycle
Getting ready
How to do it…
Using logging to get to know the application life cycle
Starter classes and configuration
Desktop starter
Android starter
HTML starter
iOS starter
How it works…
There's more…
Living comfortably with ApplicationAdapter
Managing a multiscreen application with Game
See also
Updating and managing project dependencies
Getting ready
How to do it…
Gradle build file primer
Updating existing dependencies
Adding Libgdx extensions
Bullet
Core
Desktop
Android
iOS
FreeTypeFont
Core
Desktop
Android
iOS
Controllers
Core
Desktop
Android
HTML5
Box2D
Core
Desktop
Android
iOS
HTML5
Tools
Core
Desktop
AI
Core
Android
HTML
Adding external repositories
Adding additional file dependencies
Managing GWT dependencies
There's more…
See also
Using source control on a Libgdx project with Git
Getting ready
How to do it…
How it works…
Basic operations
Git branches
Gitignore files
There's more…
See also
Importing and running the Libgdx official demos
Getting ready
How to do it…
How it works…
There's more…
2. Working with 2D Graphics
Introduction
Texture rendering with SpriteBatch
Getting ready
How to do it…
How it works…
2D rendering using 3D techniques
Coordinate system and camera setup
Assets location in Libgdx
Draw order
Texture filters
There's more…
See also
More effective rendering with regions and atlases
Getting ready
How to do it…
Packing PNG files into an atlas
Rendering regions of an atlas
How it works…
Atlas file format
How SpriteBatch works
A note on texture size limitations
There's more…
See also
Taking advantage of Libgdx sprites
Getting ready
How to do it…
How it works…
There's more…
Using bounds for collision detection
See also
Rendering sprite-sheet-based animations
Getting ready
How to do it…
How it works…
There's more…
Using different play modes
Checking when an animation has finished
Handling a character with many animations
See also
Understanding orthographic cameras
Getting ready
How to do it…
How it works…
There's more…
Rendering UI on top of the game world
Split screen
See also
Using ShapeRenderer for debug graphics
Getting ready
How to do it…
Rendering lines
Rendering circles
Rendering rectangles
Rendering points
Rendering triangles
How it works…
There's more…
See also
Handling multiple screen sizes with viewports
Getting ready
How to do it…
How it works…
There's more…
Getting the most out of Viewport
Working with two cameras and viewports
Floating elements
Build your own Viewport implementation
See also
3. Advanced 2D Graphics
Introduction
Achieving juicy effects with particles
Getting ready
How to do it…
The basics of Particle Editor
Rendering particle effects with Libgdx
How it works…
There's more…
See also
Frame buffers and image composition
Getting ready
How to do it…
How it works…
There's more…
Welcome to the world of shaders
Getting ready
How to do it…
How it works…
Data types
Vertex attributes
Uniforms
OpenGL ES precision specifiers
There's more…
The sepia effect
Inverted colors
Passing parameters into shader programs
Getting ready
How to do it…
How it works…
There's more…
Detecting shader compiler errors
More efficient uniform settings
2D depth of field shader
Getting ready
How to do it…
There's more…
See also
Embedding a Libgdx window into a Java desktop application
Getting ready
How to do it…
How it works…
There's more…
See also
4. Detecting User Input
Introduction
Detecting user input via event polling
Getting ready
How to do it…
How it works…
There's more…
Checking input availability
Showing the on-screen keyboard
Detecting user input via event listening
Getting ready
How to do it…
Event polling versus event listening
How it works…
There's more…
Managing multiple listeners at once
Getting ready
How to do it…
How it works…
See also
Detecting more complex gestures
Getting ready
How to do it…
How it works…
There's more…
Gesture polling
Introducing the controllers API
Getting ready
How to do it…
Including the controllers extension
Enumerating controllers
Controller state polling
Controller event listening
How it works…
There's more…
Controller mappings
Handling disconnections
See also
Input mapping for cross-platform development
Getting ready
How to do it…
Input contexts
Input profiles
Event notifications with InputActionListener
Input mapping in action
How it works…
There's more…
5. Audio and File I/O
Introduction
Playing short sound effects
Getting ready
How to do it…
How it works…
There's more…
Handling sounds individually
Changing the volume
Creating looping sounds
Managing effect priorities
See also
Audio streaming for background music
Getting ready
How to do it…
How it works…
There's more…
Checking the playback state
Looping the background music
See also
Optimizing audio files to reduce download sizes
Getting ready
How to do it…
How it works…
There's more…
See also
Procedural audio generators
Getting ready
How to do it…
How it works…
There's more…
See also
Engine sounds with dynamic audio
Getting ready
How to do it…
How it works…
There's more…
Controlling direction through panning
Music transitions
See also
The 2D space sound system
Getting ready
How to do it…
How it works…
There's more…
See also
The first approach to file handling in Libgdx
Getting ready
How to do it…
Retrieving basic information from files
Traversing tree structures
Writing to and reading from files
Copying and deleting files and directories
How it works…
There's more…
Creating temporary files
Filtering directory listings
File streaming
See also
Using preferences to store game states and options
Getting ready
How to do it…
How it works…
There's more…
See also
The XML parsing primer
Getting ready
How to do it…
How it works…
There's more…
See also
JSON serialization and deserialization
Getting ready
How to do it…
Reading objects from JSON
Writing objects to JSON
Manual JSON parsing
How it works…
There's more…
The Serializable interface
The Serializer interface
See also
6. Font Rendering
Introduction
Generating and rendering bitmap fonts
Getting ready
How to do it…
Using Hiero to generate bitmap font files
Rendering bitmap font files with Libgdx
How it works…
There's more…
See also
Baking effects into fonts using Hiero
Getting ready
How to do it…
How it works…
See also
Scaling friendly font rendering with distance fields
Getting ready
How to do it…
Generating distance field fonts with Hiero
Distance field fonts shader
Rendering distance field fonts in Libgdx
How it works…
There's more…
Dynamic font effects using distance fields
Getting ready
How to do it…
How it works…
There's more…
7. Asset Management
Introduction
Getting to know AssetManager
Getting ready
How to do it…
How it works…
There's more…
See also
Asynchronous asset loading
Getting ready
How to do it…
How it works…
There's more…
See also
Creating custom asset loaders
Getting ready
How to do it…
Writing our own asset type
Writing our own asset loader
Summarizing...
How it works…
There's more…
See also
Managing groups of assets for bigger games
Getting ready
How to do it…
Giving shape to the idea
Empowering AssetManager
How it works…
There's more…
See also
8. User Interfaces with Scene2D
Introduction
Introducing the Scene2D API
Getting ready
How to do it…
Creating a custom actor
Rendering your custom actor
Manipulating an actor
Simple actions
Complex actions
How it works…
There's more…
See also
Widget collection overview
Getting ready
How to do it…
Label
Image
Button
TextButton
ImageButton
ImageTextButton
CheckBox
TextField
List
ScrollPane
SelectBox
ProgressBar
Slider
Touchpad
Stack
Tree
SplitPane
Window
Dialog
How it works…
There's more…
See also
Creating a basic menu screen using tables
Getting ready
How to do it…
How it works…
Expand
Fill
Uniform
Sizing
Padding and spacing
Alignment
Columns and rows
Defaults
There's more…
See also
Skin customization
Getting ready
How to do it…
How it works…
There's more…
See also
Creating new widgets
Getting ready
How to do it…
Creating a widget
Using a widget
How it works…
There's more…
9. The 2D Maps API
Introduction
Creating maps with Tiled and loading them into Libgdx
Getting ready
How to do it…
Creating a basic map with Tiled
Loading and rendering a Tiled map in Libgdx
How it works…
There's more…
Adding and querying map metadata
Getting ready
How to do it…
Object layers and properties in Tiled
Querying map metadata from Libgdx
How it works…
There's more…
See also
Developing your own map loaders and renderers
Getting ready
How to do it…
There's more…
10. Rigid Body Physics with Box2D
Introduction
Introducing Box2D
Getting ready
How to do it…
How it works…
There's more…
See also
Introducing more complex shapes
Getting ready
How to do it…
Generating JSON shape data
Loading JSON shape data into Libgdx
How it works…
There's more…
See also
Introducing joints
Getting ready
How to do it…
WeldJoint
DistanceJoint
RopeJoint
FrictionJoint
RevoluteJoint
PrismaticJoint
PulleyJoint
GearJoint
WheelJoint
There's more…
See also
Real-life joints example – bike simulator
Getting ready
How to do it…
There's more…
Reacting to collisions
Getting ready
How to do it…
How it works…
There's more…
See also
Sensors and collision filtering
Getting ready
How to do it…
Sensors
Group collision filtering
Flexible collision filtering
How it works…
There's more…
See also
Querying the world
Getting ready
How to do it…
Raycasting
Area querying
How it works…
There's more…
See also
Building a physics world from level data
Getting ready
How to do it…
Defining materials
Generating the physics metadata
Populating your world
How it works…
There's more…
See also
Implementing a deferred raycaster
Getting ready
How to do it…
The RayCastManager class
Using RayCastManager
How it works…
There's more…
See also
The fixed timestep approach
Getting ready
How to do it…
Variable timestep
Fixed timestep
Fixed timestep with interpolation
There's more…
See also
11. Third-party Libraries and Extras
Introduction
Making libraries compatible with GWT
Getting ready
How to do it…
There's more…
See also
Managing platform-specific code
Getting ready
How to do it…
There's more…
Smooth animations with Universal Tween Engine
Getting ready
How to do it…
Creating your accessor
Library usage
Tween – a core class
Organizing tweens
How it works…
Dynamic 2D lighting with Box2DLights
Getting ready
How to do it…
How it works…
RayHandler
Types of lights
There's more…
Adding support for localization
Getting ready
How to do it…
Creating language files
Managing languages
Usage example
There's more…
See also
Finite state machine and messaging
Getting ready
How to do it…
Creating the agents
Usage example
How it works…
There's more…
Component-based entity systems with Ashley
Getting ready
How to do it…
How it works…
There's more…
See also
Skeletal animations with Spine
Getting ready
How to do it…
How it works…
There's more…
12. Performance and Optimizations
Introduction
Profiling your application with VisualVM
Getting ready
How to do it…
Installing VisualVM
Changing the launcher
Monitoring and profiling
How it works…
There's more…
Using Libgdx features to avoid garbage collection
Getting ready
How to do it…
Collections
Caching
Object pooling
There's more…
Avoiding unnecessary render calls with frustum culling
Getting ready
How to do it…
How it works…
There's more…
13. Giving Back
Introduction
Releasing your Libgdx game on desktop
Getting ready
How to do it…
There's more…
See also
Releasing your Libgdx game on Android
Getting ready
How to do it…
There's more…
Releasing your Libgdx game on iOS
Getting ready
How to do it…
There's more…
Releasing your Libgdx game on browsers
Getting ready
How to do it…
There's more…
Working from sources
Getting ready
How to do it…
How it works…
See also
Creating a new test for your fresh feature
Getting ready
How to do it…
Sending a pull request on GitHub
Getting ready
How to do it…
There's more…
See also
Index
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜