Game Programming Using Qt: Beginner's Guide

A complete guide to designing and building fun games with Qt and Qt Quick 2 using associated toolsets
Preview in Mapt

Game Programming Using Qt: Beginner's Guide

Witold Wysota, Lorenz Haas

2 customer reviews
A complete guide to designing and building fun games with Qt and Qt Quick 2 using associated toolsets
Mapt Subscription
FREE
$29.99/m after trial
eBook
$10.00
RRP $43.99
Save 77%
Print + eBook
$54.99
RRP $54.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$10.00
$54.99
$29.99 p/m after trial
RRP $43.99
RRP $54.99
Subscription
eBook
Print + eBook
Start 30 Day Trial

Frequently bought together


Game Programming Using Qt: Beginner's Guide Book Cover
Game Programming Using Qt: Beginner's Guide
$ 43.99
$ 10.00
C++ GUI Programming with QT5 Book Cover
C++ GUI Programming with QT5
$ 35.99
$ 10.00
Buy 2 for $20.00
Save $59.98
Add to Cart

Book Details

ISBN 139781782168874
Paperback512 pages

Book Description

Qt is the leading cross-platform toolkit for all significant desktop, mobile, and embedded platforms and is becoming more popular by the day, especially on mobile and embedded devices. Despite its simplicity, it's a powerful tool that perfectly fits game developers’ needs. Using Qt and Qt Quick, it is easy to build fun games or shiny user interfaces. You only need to create your game once and deploy it on all major platforms like iOS, Android, and WinRT without changing a single source file.

The book begins with a brief introduction to creating an application and preparing a working environment for both desktop and mobile platforms. It then dives deeper into the basics of creating graphical interfaces and Qt core concepts of data processing and display before you try creating a game. As you progress through the chapters, you’ll learn to enrich your games by implementing network connectivity and employing scripting. We then delve into Qt Quick, OpenGL, and various other tools to add game logic, design animation, add game physics, and build astonishing UI for the games. Towards the final chapters, you’ll learn to exploit mobile device features such as accelerators and sensors to build engaging user experiences. If you are planning to learn about Qt and its associated toolsets to build apps and games, this book is a must have.

Table of Contents

Chapter 1: Introduction to Qt
The cross-platform programming
A journey through time
New in Qt 5
Choosing the right license
Summary
Chapter 2: Installation
Installing the Qt SDK
Time for action – installing Qt using an online installer
Setting up Qt Creator
Time for action – loading an example project
Time for action – running the Affine Transformations project
Building Qt from sources
Time for action – setting up Qt sources using Git
Time for action – configuring and building Qt
Summary
Chapter 3: Qt GUI Programming
Windows and dialogs
Time for action – creating a Qt Desktop project
Time for action – implementing a tic-tac-toe game board
Qt meta-objects
Time for action – functionality of a tic-tac-toe board
Time for action – adding properties to the board class
Designing GUIs
Time for action – designing the game configuration dialog
Time for action – polishing the dialog
Time for action – the logic of the dialog
Time for action – the main window of the application
Time for action – adding a pull-down menu
Time for action – creating a toolbar
Time for action – filling in the central widget
Time for action – putting it all together
Summary
Chapter 4: Qt Core Essentials
Text handling
Time for action – a simple quiz game
Data storage
Time for action – implementing a device to encrypt data
Time for action – serialization of a custom structure
Time for action – implementing an XML parser for player data
Time for action – the player data JSON serializer
Time for action – implementing a JSON parser
Summary
Chapter 5: Graphics with Qt
Raster painting
Time for action – custom-painted widgets
Time for action – transforming the viewport
Time for action – drawing an oscillogram
Time for action – making oscillograms selectable
Time for action – optimizing oscillogram drawing
Time for action – developing the game architecture
Time for action – implementing the game board class
Time for action – understanding the ChessView class
Time for action – rendering the pieces
Time for action – making the chess game interactive
Time for action – connecting the game algorithm
OpenGL
Time for action – drawing a triangle using Qt and OpenGL
Time for action – scene-based rendering
Time for action – drawing a textured cube
Time for action – shaded objects
Summary
Chapter 6: Graphics View
Graphics View architecture
Time for action – creating a black, rectangular item
Time for action – reacting to an item's selection state
Time for action – making the item's size definable
Time for action – creating items with different origins
Time for action – rotating an item
Time for action – adding an item to a scene
Time for action – rendering the scene's content to an image
Time for action – transforming parent items and child items
Time for action – putting it all together!
Time for action – creating an item where transformations can easily be seen
Time for action – implementing the ability to scale the scene
Time for action – implementing the ability to move the scene
Time for action – taking the zoom level into account
The jumping elephant or how to animate the scene
Time for action – creating an item for Benjamin
Time for action – making Benjamin move
Time for action – moving the background
Time for action – using properties, signals, and slots with items
Time for action – using animations to move items smoothly
Time for action – keeping multiple animations in sync
Time for action – making the coins explode
Widgets inside Graphics View
Optimization
Summary
Chapter 7: Networking
QNetworkAccessManager
Time for action – downloading a file
Time for action – displaying a proper error message
Time for action – writing the OOP conform code using QSignalMapper
Time for action – showing the download progress
Connecting to Google, Facebook, Twitter, and co.
Time for action – using Google's Distance Matrix API
Time for action – constructing the query
Time for action – parsing the server's reply
Controlling the connectivity state
Communicating between games
Time for action – realizing a simple chat program
The server – QTcpServer
Time for action – setting up the server
Time for action – reacting on a new pending connection
Time for action – forwarding a new message
Time for action – detecting a disconnect
The client
Time for action – setting up the client
Time for action – receiving text messages
Time for action – sending text messages
Improvements
Using UDP
Time for action – sending a text via UDP
Summary
Chapter 8: Scripting
Why script?
The basics of Qt Script
Time for action – creating a Qt Script editor
Time for action – sandboxed script evaluation
Integrating Qt and Qt Script
Time for action – employing scripting for npc AI
Time for action – storing the script
Time for action – providing an initialization function
Time for action – implementing the heartbeat event
Alternatives to JavaScript
Time for action – writing a Qt wrapper for embedding Python
Time for action – converting data between C++ and Python
Time for action – calling functions and returning values
Summary
Chapter 9: Qt Quick Basics
Fluid user interfaces
Declarative UI programming
Time for action – creating a button component
Time for action – adding button content
Time for action – sizing the button properly
Time for action – making the button a reusable component
Event handlers
Time for action – making the button clickable
Time for action – visualizing button states
Time for action – notifying the environment about button states
Time for action – dragging an item around
Time for action – rotating and scaling a picture by pinching
Using components in Qt Quick
Time for action – a simple analog clock application
Time for action – adding needles to the clock
Time for action – making the clock functional
Time for action – preparing Canvas for heartbeat visualization
Time for action – drawing a heartbeat
Time for action – making the diagram more colorful
Qt Quick and C++
Time for action – self-updating car dashboard
Time for action – grouping engine properties
Extending QML
Time for action – making CarInfo instantiable from QML
Time for action – creating a regular polygon item
Time for action – creating an item for drawing outlined text
Summary
Chapter 10: Qt Quick
Bringing life into static user interfaces
Time for action – scene for an action game
Time for action – animating the sun's horizontal movement
Time for action – making the sun rise and set
Time for action – improving the path of the sun
Time for action – adjusting the sun's color
Time for action – furnishing sun animation
Time for action – animating the car dashboard
Quick game programming
Time for action – character navigation
Time for action – another approach to character navigation
Time for action – generating coins
Time for action – implementing simple character animation
Time for action – animating characters using sprites
Time for action – adding jumping with sprite transitions
Time for action – revisiting parallax scrolling
Time for action – collecting coins
Time for action – vanishing coins spawning particles
Summary

What You Will Learn

  • Install Qt on your system
  • Understand the basic concepts of every Qt game and application
  • Develop 2D object-oriented graphics using Qt Graphics View
  • Build multiplayer games or add a chat function to your games with Qt's Network module
  • Script your game with Qt Script
  • Program resolution-independent and fluid UI using QML and Qt Quick
  • Control your game flow as per the sensors of a mobile device
  • See how to test and debug your game easily with Qt Creator and Qt Test

Authors

Table of Contents

Chapter 1: Introduction to Qt
The cross-platform programming
A journey through time
New in Qt 5
Choosing the right license
Summary
Chapter 2: Installation
Installing the Qt SDK
Time for action – installing Qt using an online installer
Setting up Qt Creator
Time for action – loading an example project
Time for action – running the Affine Transformations project
Building Qt from sources
Time for action – setting up Qt sources using Git
Time for action – configuring and building Qt
Summary
Chapter 3: Qt GUI Programming
Windows and dialogs
Time for action – creating a Qt Desktop project
Time for action – implementing a tic-tac-toe game board
Qt meta-objects
Time for action – functionality of a tic-tac-toe board
Time for action – adding properties to the board class
Designing GUIs
Time for action – designing the game configuration dialog
Time for action – polishing the dialog
Time for action – the logic of the dialog
Time for action – the main window of the application
Time for action – adding a pull-down menu
Time for action – creating a toolbar
Time for action – filling in the central widget
Time for action – putting it all together
Summary
Chapter 4: Qt Core Essentials
Text handling
Time for action – a simple quiz game
Data storage
Time for action – implementing a device to encrypt data
Time for action – serialization of a custom structure
Time for action – implementing an XML parser for player data
Time for action – the player data JSON serializer
Time for action – implementing a JSON parser
Summary
Chapter 5: Graphics with Qt
Raster painting
Time for action – custom-painted widgets
Time for action – transforming the viewport
Time for action – drawing an oscillogram
Time for action – making oscillograms selectable
Time for action – optimizing oscillogram drawing
Time for action – developing the game architecture
Time for action – implementing the game board class
Time for action – understanding the ChessView class
Time for action – rendering the pieces
Time for action – making the chess game interactive
Time for action – connecting the game algorithm
OpenGL
Time for action – drawing a triangle using Qt and OpenGL
Time for action – scene-based rendering
Time for action – drawing a textured cube
Time for action – shaded objects
Summary
Chapter 6: Graphics View
Graphics View architecture
Time for action – creating a black, rectangular item
Time for action – reacting to an item's selection state
Time for action – making the item's size definable
Time for action – creating items with different origins
Time for action – rotating an item
Time for action – adding an item to a scene
Time for action – rendering the scene's content to an image
Time for action – transforming parent items and child items
Time for action – putting it all together!
Time for action – creating an item where transformations can easily be seen
Time for action – implementing the ability to scale the scene
Time for action – implementing the ability to move the scene
Time for action – taking the zoom level into account
The jumping elephant or how to animate the scene
Time for action – creating an item for Benjamin
Time for action – making Benjamin move
Time for action – moving the background
Time for action – using properties, signals, and slots with items
Time for action – using animations to move items smoothly
Time for action – keeping multiple animations in sync
Time for action – making the coins explode
Widgets inside Graphics View
Optimization
Summary
Chapter 7: Networking
QNetworkAccessManager
Time for action – downloading a file
Time for action – displaying a proper error message
Time for action – writing the OOP conform code using QSignalMapper
Time for action – showing the download progress
Connecting to Google, Facebook, Twitter, and co.
Time for action – using Google's Distance Matrix API
Time for action – constructing the query
Time for action – parsing the server's reply
Controlling the connectivity state
Communicating between games
Time for action – realizing a simple chat program
The server – QTcpServer
Time for action – setting up the server
Time for action – reacting on a new pending connection
Time for action – forwarding a new message
Time for action – detecting a disconnect
The client
Time for action – setting up the client
Time for action – receiving text messages
Time for action – sending text messages
Improvements
Using UDP
Time for action – sending a text via UDP
Summary
Chapter 8: Scripting
Why script?
The basics of Qt Script
Time for action – creating a Qt Script editor
Time for action – sandboxed script evaluation
Integrating Qt and Qt Script
Time for action – employing scripting for npc AI
Time for action – storing the script
Time for action – providing an initialization function
Time for action – implementing the heartbeat event
Alternatives to JavaScript
Time for action – writing a Qt wrapper for embedding Python
Time for action – converting data between C++ and Python
Time for action – calling functions and returning values
Summary
Chapter 9: Qt Quick Basics
Fluid user interfaces
Declarative UI programming
Time for action – creating a button component
Time for action – adding button content
Time for action – sizing the button properly
Time for action – making the button a reusable component
Event handlers
Time for action – making the button clickable
Time for action – visualizing button states
Time for action – notifying the environment about button states
Time for action – dragging an item around
Time for action – rotating and scaling a picture by pinching
Using components in Qt Quick
Time for action – a simple analog clock application
Time for action – adding needles to the clock
Time for action – making the clock functional
Time for action – preparing Canvas for heartbeat visualization
Time for action – drawing a heartbeat
Time for action – making the diagram more colorful
Qt Quick and C++
Time for action – self-updating car dashboard
Time for action – grouping engine properties
Extending QML
Time for action – making CarInfo instantiable from QML
Time for action – creating a regular polygon item
Time for action – creating an item for drawing outlined text
Summary
Chapter 10: Qt Quick
Bringing life into static user interfaces
Time for action – scene for an action game
Time for action – animating the sun's horizontal movement
Time for action – making the sun rise and set
Time for action – improving the path of the sun
Time for action – adjusting the sun's color
Time for action – furnishing sun animation
Time for action – animating the car dashboard
Quick game programming
Time for action – character navigation
Time for action – another approach to character navigation
Time for action – generating coins
Time for action – implementing simple character animation
Time for action – animating characters using sprites
Time for action – adding jumping with sprite transitions
Time for action – revisiting parallax scrolling
Time for action – collecting coins
Time for action – vanishing coins spawning particles
Summary

Book Details

ISBN 139781782168874
Paperback512 pages
Read More
From 2 reviews

Read More Reviews

Recommended for You

Qt5 C++ GUI Programming Cookbook Book Cover
Qt5 C++ GUI Programming Cookbook
$ 35.99
$ 10.00
Mastering Qt 5 Book Cover
Mastering Qt 5
$ 35.99
$ 10.00
Qt 5 Blueprints Book Cover
Qt 5 Blueprints
$ 39.99
$ 10.00
Application Development with Qt Creator - Second Edition Book Cover
Application Development with Qt Creator - Second Edition
$ 26.99
$ 10.00
C++ Game Development Cookbook Book Cover
C++ Game Development Cookbook
$ 35.99
$ 10.00
Modern C++ Programming Cookbook Book Cover
Modern C++ Programming Cookbook
$ 39.99
$ 10.00