logo资料库

SFML Essentials(PACKT,2015).pdf

第1页 / 共156页
第2页 / 共156页
第3页 / 共156页
第4页 / 共156页
第5页 / 共156页
第6页 / 共156页
第7页 / 共156页
第8页 / 共156页
资料共156页,剩余部分请下载后查看
Cover
Copyright
Credits
About the Author
About the Reviewers
www.PacktPub.com
Table of Contents
Preface
Chapter 1: Getting Started with SFML
Creating windows
VideoMode
Style
ContextSettings
Disabling the mouse cursor
The game loop
Event handling
Window related events
Keyboard related events
Mouse related events
Joystick related events
Using events
Shape rendering and transformations
The render frame
Shape drawing
Shape transformation
Controlling shapes
Summary
Chapter 2: Loading and Using Textures
Loading textures
Images versus textures
Creating images
Creating textures
Rendering shapes with textures
What is a sprite?
Shapes versus sprites
Transformables and drawables
Final facts on sprites
Managing resources
Summary
Chapter 3: Animating Sprites
Capturing time
sf::Time and sf::Clock
Animating sprites
The setup
Building an animator
Using the animator
Multiple animations
Summary
Chapter 4: Manipulating a 2D Camera
What is a camera?
When should we use a camera?
How does SFML implement a camera?
Manipulating cameras with sf::View
Rotating and scaling a view
Viewports
Mapping coordinates
What is OpenGL?
Should you use OpenGL?
Using OpenGL inside SFML
OpenGL in multiple windows
Summary
Chapter 5: Exploring a World of Sound and Text
Audio module – overview
Sound versus music
Audio in action
The sf::Sound class
Introducing AssetManager 2.0
sf::Music and sf::SoundStream
sf::SoundSource and audio in 3D
Common audio features
Audio in 3D
Setting up the listener
Audio sources
Summarizing audio features
Getting started with sf::Text
AssetManager 3.0
Summary
Chapter 6: Rendering Special Effects with Shaders
sf::RenderTarget and sf::RenderWindow
Rendering directly to a texture
Shader programming
What is a shader?
Loading shaders
AssetManager 4.0
Using shaders
Setting shader uniforms
sf::Shader and OpenGL
Combining it all together
Setting up RenderTexture
Summary
Chapter 7: Building Multiplayer Games
Understanding networking
Networking in games
Transport layer – TCP versus UDP
TCP in SFML
UDP in SFML
Non-blocking sockets
Exchanging packets
Constructing a packet
Putting it all into practice
Summary
Index
www.it-ebooks.info
SFML Essentials A fast-paced, practical guide to building functionally enriched 2D games using the core concepts of SFML Milcho G. Milchev BIRMINGHAM - MUMBAI
SFML Essentials 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: February 2015 Production reference: 1170215 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-78439-732-6 www.packtpub.com www.it-ebooks.info
Credits Author Milcho G. Milchev Project Coordinator Akash Poojary Reviewers James Cowgill Mark Fielbig Stefan Schindler Commissioning Editor Edward Bowkett Acquisition Editor Harsha Bharwani Proofreaders Simran Bhogal Kevin McGowan Indexer Rekha Nair Graphics Valentina D'silva Disha Haria Content Development Editor Production Coordinator Natasha D'Souza Komal Ramchandani Cover Work Komal Ramchandani Technical Editor Narsimha Pai Copy Editors Vikrant Phadke Neha Vyas www.it-ebooks.info
About the Author Milcho G. Milchev has been a game programmer since he was in high school. He continues to work on games on a daily basis. Some of the games that he has worked on include Unholy Flesh and WhiteCity. Currently, he works for Dream Harvest, an indie game studio with a lot of talented people. They are developing their first strategy game. Milcho has also followed the development of SFML for several years and has developed his own game engine based on this library. www.it-ebooks.info
About the Reviewers James Cowgill is a computer science student at the University of York, and has set aside a year to work with the MIPS team at Imagination Technologies. Over the last 10 years, he has experimented with and learned a variety of languages including C, C++, Python, and C#. In his free time, he often works on improving the Debian Linux distribution and helping out developers of open source projects. Mark Fielbig was first introduced to game development through his love for games and his desire to learn how they worked. He started by developing and releasing numerous Flash and mobile games. Mark now holds a Masters of Computer Science degree from Stony Brook University and his interests include application development, distributed systems, and multi-tiered system architecture. www.it-ebooks.info
Stefan Schindler is a software developer and engineer. He loves C++, Python, Vim, Linux, Git, code design, and software tests. Stefan has been in the SFML community since June 2008. He was looking for a modern C++ library to finish a small university game project, which was a Tetris clone. In 2014, several people were invited to join the SFML development team to help with their progress. Stefan accepted the invitation. His likes integrating automated software tests and continuous integration. He also hosts the website and the popular IRC channel #sfml at irc.sfml-dev.org. In his free time, Stefan likes to develop libraries and gaming experiments in C++ and Python. SFGUI is one of his projects, and it is still maintained, mainly by its contributors. Stefan also likes to write articles. He has has published a couple of them under the name, Game Development Design, available for free at www.optank.org. I would like to thank Laurent Gomila for creating a wonderful C++ library that so many people love and use, and for bringing together people who would probably have never met otherwise. Thanks to my wife and daughter as well. Tina and Mia, I love you! www.it-ebooks.info
www.PacktPub.com Support files, eBooks, discount offers, and more For support files and downloads related to your book, please visit www.PacktPub.com. Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub. com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at service@packtpub.com for more details. At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks. TM https://www2.packtpub.com/books/subscription/packtlib Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books. Why subscribe? • Fully searchable across every book published by Packt • Copy and paste, print, and bookmark content • On demand and accessible via a web browser Free access for Packt account holders If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view 9 entirely free books. Simply use your login credentials for immediate access. www.it-ebooks.info
分享到:
收藏