SFML Blueprints
eBook - ePub

SFML Blueprints

Maxime Barbier

Compartir libro
  1. 298 páginas
  2. English
  3. ePUB (apto para móviles)
  4. Disponible en iOS y Android
eBook - ePub

SFML Blueprints

Maxime Barbier

Detalles del libro
Vista previa del libro
Índice
Citas

Preguntas frecuentes

¿Cómo cancelo mi suscripción?
Simplemente, dirígete a la sección ajustes de la cuenta y haz clic en «Cancelar suscripción». Así de sencillo. Después de cancelar tu suscripción, esta permanecerá activa el tiempo restante que hayas pagado. Obtén más información aquí.
¿Cómo descargo los libros?
Por el momento, todos nuestros libros ePub adaptables a dispositivos móviles se pueden descargar a través de la aplicación. La mayor parte de nuestros PDF también se puede descargar y ya estamos trabajando para que el resto también sea descargable. Obtén más información aquí.
¿En qué se diferencian los planes de precios?
Ambos planes te permiten acceder por completo a la biblioteca y a todas las funciones de Perlego. Las únicas diferencias son el precio y el período de suscripción: con el plan anual ahorrarás en torno a un 30 % en comparación con 12 meses de un plan mensual.
¿Qué es Perlego?
Somos un servicio de suscripción de libros de texto en línea que te permite acceder a toda una biblioteca en línea por menos de lo que cuesta un libro al mes. Con más de un millón de libros sobre más de 1000 categorías, ¡tenemos todo lo que necesitas! Obtén más información aquí.
¿Perlego ofrece la función de texto a voz?
Busca el símbolo de lectura en voz alta en tu próximo libro para ver si puedes escucharlo. La herramienta de lectura en voz alta lee el texto en voz alta por ti, resaltando el texto a medida que se lee. Puedes pausarla, acelerarla y ralentizarla. Obtén más información aquí.
¿Es SFML Blueprints un PDF/ePUB en línea?
Sí, puedes acceder a SFML Blueprints de Maxime Barbier en formato PDF o ePUB, así como a otros libros populares de Computer Science y Programming Games. Tenemos más de un millón de libros disponibles en nuestro catálogo para que explores.

Información

Año
2015
ISBN
9781784398477

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

SFML Blueprints

Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: May 2015
Production reference: 1220515
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78439-847-7
www.packtpub.com

Credits

Author
Maxime Barbier
Reviewers
Nolwenn Bauvais
Jason Bunn
Tom Ivanyo
Vittorio Romeo
Richa Sachdeva
Michael Shaw
Commissioning Editor
Edward Bowkett
Acquisition Editor
Shaon Basu
Content Development Editor
Akashdeep Kundu
Technical Editors
Tanmayee Patil
Shiny Poojary
Mohita Vyas
Copy Editors
Trishya Hajare
Aditya Nair
Shambhavi Pai
Merilyn Pereira
Aarti Saldanha
Project Coordinator
Milton Dsouza
Proofreaders
Safis Editing
Jonathan Todd
Indexer
Tejal Soni
Graphics
Abhinash Sahu
Production Coordinator
Aparna Bhagat
Cover Work
Aparna Bhagat

About the Author

Maxime Barbier has recently finished his studies and is now a software engineer in Strasbourg, France. He loves programming crazy things and has been experimenting and sharing them with the open source community on GitHub since 2010. Also, he really likes game programming.
As his favorite technology is C++, he has become an expert in it because of his work. He has also developed several libraries with this language, and some of them are used in this book. Game programming is his hobby, and he really likes the challenges involved in such a project. He also loves sharing his knowledge with other people, which was the main reason he wrote this book and also the reason for his activity in the open source community.
Since 9 years, he has been working on different projects such as Anka Dreles, which is a pen and paper role-playing game, and is putting in effort to convert it into a computer game.
He also loves sailing and was a sailing teacher for several years while studying. His dream is to be able to combine sailing and computer sciences by traveling around the world.
Before sta...

Índice