Kivy Blueprints
eBook - ePub

Kivy Blueprints

Mark Vasilkov

Buch teilen
  1. 282 Seiten
  2. English
  3. ePUB (handyfreundlich)
  4. Über iOS und Android verfügbar
eBook - ePub

Kivy Blueprints

Mark Vasilkov

Angaben zum Buch
Buchvorschau
Inhaltsverzeichnis
Quellenangaben

Häufig gestellte Fragen

Wie kann ich mein Abo kündigen?
Gehe einfach zum Kontobereich in den Einstellungen und klicke auf „Abo kündigen“ – ganz einfach. Nachdem du gekündigt hast, bleibt deine Mitgliedschaft für den verbleibenden Abozeitraum, den du bereits bezahlt hast, aktiv. Mehr Informationen hier.
(Wie) Kann ich Bücher herunterladen?
Derzeit stehen all unsere auf Mobilgeräte reagierenden ePub-Bücher zum Download über die App zur Verfügung. Die meisten unserer PDFs stehen ebenfalls zum Download bereit; wir arbeiten daran, auch die übrigen PDFs zum Download anzubieten, bei denen dies aktuell noch nicht möglich ist. Weitere Informationen hier.
Welcher Unterschied besteht bei den Preisen zwischen den Aboplänen?
Mit beiden Aboplänen erhältst du vollen Zugang zur Bibliothek und allen Funktionen von Perlego. Die einzigen Unterschiede bestehen im Preis und dem Abozeitraum: Mit dem Jahresabo sparst du auf 12 Monate gerechnet im Vergleich zum Monatsabo rund 30 %.
Was ist Perlego?
Wir sind ein Online-Abodienst für Lehrbücher, bei dem du für weniger als den Preis eines einzelnen Buches pro Monat Zugang zu einer ganzen Online-Bibliothek erhältst. Mit über 1 Million Büchern zu über 1.000 verschiedenen Themen haben wir bestimmt alles, was du brauchst! Weitere Informationen hier.
Unterstützt Perlego Text-zu-Sprache?
Achte auf das Symbol zum Vorlesen in deinem nächsten Buch, um zu sehen, ob du es dir auch anhören kannst. Bei diesem Tool wird dir Text laut vorgelesen, wobei der Text beim Vorlesen auch grafisch hervorgehoben wird. Du kannst das Vorlesen jederzeit anhalten, beschleunigen und verlangsamen. Weitere Informationen hier.
Ist Kivy Blueprints als Online-PDF/ePub verfügbar?
Ja, du hast Zugang zu Kivy Blueprints von Mark Vasilkov im PDF- und/oder ePub-Format sowie zu anderen beliebten Büchern aus Computer Science & Programming in Python. Aus unserem Katalog stehen dir über 1 Million Bücher zur Verfügung.

Information

Kivy Blueprints


Table of Contents

Kivy 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
Write once, run anywhere
What this book covers
Setting up the working environment
A note on Python
Installing and running Kivy
Note on coding
Hello, Kivy
Code
Layout
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. Building a Clock App
The starting point
Modern UI
Design inspiration
Loading custom fonts
Formatting text
Changing the background color
Making the clock tick
Updating the time on the screen
Binding widgets using properties
Layout basics
Finalizing the layout
Reducing repetition
Named classes
Styling buttons
9-patch scaling
Using 9-patch images
Counting time
Formatting the time for stopwatch
Computing values
Putting a stopwatch in place
Stopwatch controls
Summary
2. Building a Paint App
Setting the stage
Fine-tuning the looks
Visual appearance
Window size
Mouse cursor
Multitouch emulation
Drawing touches
A very short introduction to the canvas
Displaying touches on the screen
Clearing the screen
Passing events
Clearing the canvas
Connecting the dots
The color palette
Subclassing the buttons
Taking away the ability to deselect
Overriding the standard behavior
Coloring buttons
A new kind of button
Defining the palette
Setting the line thickness
Changing the line width
Summary
3. Sound Recorder for Android
Writing platform-dependent code
Introducing Pyjnius
Emulating Android
Metro UI
The buttons
The grid structure
Visual attributes
Scalable vector icons
Icon fonts
Rationale for using icon fonts
Using the icon font in Kivy
Testing on Android
Using the native API
Loading Java classes
Looking up the storage path
Reading logs from the device
Recording sound
Major caveat – permissions
Playing sound
Deleting files
Summary
4. Kivy Networking
Writing the chat server
The protocol definition
The server source code
The principle of operation
Testing the server
Screen manager
Customizing the animation
Login screen layout
Chatroom screen layout
Overscroll modes
Bringing the app online
Building a simple Python client
Kivy integration with Twisted
ChatClient and ChatClientFactory
UI integration
Application logic of the client
Cross-application interoperability
Enhancements and eye candy
Escaping the special syntax
What's next
Summary
5. Making a Remote Desktop App
The server
The Flask web server
Advanced server functionality – taking screenshots
Emulating clicks
JavaScript client
Endless loop of screenshots
Passing clicks to host
Kivy Remote Desktop app
The login form
The remote desktop screen
Loop of screenshots in Kivy
Sending clicks
What's next
Summary
6. Making the 2048 Game
About the game
Gameplay concepts and overview
Randomness, or lack thereof
The 2048 project outline
What makes 2048 a good choice of project?
Simplicity as a feature
Creating the 2048 board
Going through cells
Rendering empty cells
Board data structure
Variable naming
Calling reset()
Testing passability
Making tiles
Tile initialization
Resizing tiles
Implementing the game logic
Moving tiles
Controlling the iteration sequence
Implementing the move() method
Binding touch controls
Combining tiles
Adding more tiles
Synchronizing turns
Game over
The winning condition
The loss condition
Where to go from here
Summary
7. Writing a Flappy Bird Clone
Project overview
Creating an animated background
Loading tileable textures
The Background widget
Animating the background
Making pipes
An overview of the pipe properties
Setting texture coordinates
Implementing pipes
Spawning pipes
Moving and recycling pipes
Introducing Kivy Bird
Revised application flow
Accepting user input
Learning to fly straight down
Remaining in flight
Rotating the bird
Collision detection
Game over
Producing sound effects
Kivy sound playback
Adding sound to the Kivy Bird game
Summary
8. Introducing Shaders
Unscientific introduction to OpenGL
Concepts and parallelism
Performance gains, or lack thereof
Improving performance
Taking a closer look at GLSL
Using custom shaders in Kivy
Building the geometry
Illustrating the Indices
Writing GLSL
Storage classes and types
Basic shaders
Procedural coloring
Colorful vertices
Texture mapping
Making the Starfield app
Application structure
Data structures and initializers
Advancing the scene
Writing a corresponding GLSL
Summary
9. Making a Shoot-Em-Up Game
Limitations of the project
Texture atlases at a glance
Creating an atlas
Atlas structure
Using Kivy atlases in an easy way
Ad hoc usage of atlases with GLSL
Data structure for UV mapping
Writing an atlas loader
Rendering sprites from atlas
Designing a reusable particle system
Class hierarchy
The PSWidget renderer class
The Particle class
Writing the game
Implementing stars
Making a spaceship
Creating a trail of fire
Making bullets
Implementing enemies
Collision detection
Finishing touches
Summary
A. The Python Ecosystem
Index

Kivy 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: January 2015
Production reference: 1230115
Published by Packt Publishing Ltd.
Livery Place
35 Livery...

Inhaltsverzeichnis