售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
SFML Blueprints
Table of Contents
SFML Blueprints
Credits
About the Author
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
Errata
Piracy
Questions
1. Preparing the Environment
C++11
SFML
Installation of a C++11 compiler
For Linux users
For Mac users
For Windows users
For all users
Installing CMake
For Linux users
For other operating systems
Installing SFML 2.2
Building SFML yourself
Installing dependencies
Linux
Other operating systems
Compilation of SFML
Linux
Windows
Code::Blocks and SFML
A minimal example
Summary
2. General Game Architecture, User Inputs, and Resource Management
General structure of a game
The game class
Game loops
The frame rate
Fixed time steps
Variable time steps
Minimum time steps
Move our player
The player class
Managing user inputs
Polling events
Real-time events
Handling user inputs
Using the Action class
Action target
Event map
Back to action target
Keeping track of resources
Resources in SFML
The texture class
The image class
The font class
The shader class
The sound buffer class
The music class
Use case
RAII idiom
Building a resources manager
Changing the player's skin
Summary
3. Making an Entire 2D Game
Turning our application to an Asteroid clone
The Player class
The levels
The enemies
The meteors
The flying saucers
Modifying our application
The World class
The hierarchical entity system
The entity component system
Designing our game
Prepare the collisions
The Entity class
The Player class
The Enemy class
The Saucer class
The Meteor class
The Shoot class
Building a Tetris clone
The Stats class
The Piece class
The Board class
The Game class
Summary
4. Playing with Physics
A physics engine – késako?
3D physics engines
2D physics engines
Physics engine comparing game engine
Using Box2D
Preparing Box2D
Build
Install
Pairing Box2D and SFML
Box2D, how does it work?
Adding physics to a game
The Piece class
The World class
The Game class
The Stats class
Summary
5. Playing with User Interfaces
What is a GUI?
Creating a GUI from scratch
Class hierarchy
The Widget class
The Label class
The Button class
The TextButton class
The Container class
The Frame class
The Layout class
The VLayout class
Adding a menu to the game
Building the main menu
Building the pause menu
Building the configuration menu
Using SFGUI
Installing SFGUI
Using the features of SFGUI
Building the starting level
Summary
6. Boost Your Code Using Multithreading
What is multithreading?
The fork() function
The exec() family functions
Thread functionality
Why do we need to use the thread functionality?
Using threads
Adding multithreading to our games
Summary
7. Building a Real-time Tower Defense Game from Scratch – Part 1
The goal of the game
Building animations
The Animation class
The AnimatedSprite class
A usage example
Building a generic Tile Map
The Geometry class as an isometric hexagon
VLayer and Layer classes
VMap and Map classes
Dynamic board loading
The MapViewer class
A usage example
Building an entity system
Use of the entity system
Advantages of the entity system approach
Building the game logic
Building our components
Creating the different systems
The level class
The game class
The Team GUI class
Summary
8. Build a Real-time Tower Defense Game from Scratch – Part 2, Networking
Network architectures
Peer-to-peer architecture
Client-server architecture
Client
Server
Network communication using sockets
UDP
TCP
Selector
The Connection class
The goal of the Connection class
Creating a communication protocol
Using the sf::Packet class
RPC-like protocol
The NetworkEvent class
Modifying our game
Server
Building the Server entry point
Reacting to players' actions during a match
Synchronization between clients and the server
The Client class
Connection with the server
The Level class
Adding data persistence to the game
What is ORM?
Using cpp-ORM
Turning our object persistent
Saving an object in a database
Loading an object from the database
Summary
Index
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜