1. Trang chủ
  2. » Công Nghệ Thông Tin

Kivy blueprints

282 380 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Cấu trúc

  • Cover

  • Copyright

  • Credits

  • About the Author

  • About the Reviewers

  • www.PacktPub.com

  • Table of Contents

  • Preface

  • Chapter 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

  • Chapter 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 line thickness

      • Changing the line width

    • Summary

  • Chapter 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

  • Chapter 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

  • Chapter 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

  • Chapter 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

  • Chapter 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

  • Chapter 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

        • Indices, illustrated

      • 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

  • Chapter 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

  • Appendix: The Python Ecosystem

  • Index

Nội dung

www.it-ebooks.info Kivy Blueprints Build your very own app-store-ready, multi-touch games and applications with Kivy! Mark Vasilkov BIRMINGHAM - MUMBAI www.it-ebooks.info 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 Street Birmingham B3 2PB, UK ISBN 978-1-78398-784-9 www.packtpub.com www.it-ebooks.info Credits Author Project Coordinator Mark Vasilkov Nidhi Joshi Reviewers Proofreaders Takumi Adachi Martin Diver Joe Dorocak Maria Gould Raphael Pierzina Paul Hindle Edward C Delaporte V Joanna McMahon Commissioning Editor Usha Iyer Indexers Hemangini Bari Rekha Nair Acquisition Editor Priya Subramani Vinay Argekar Content Development Editor Kirti Patil Graphics Sheetal Aute Production Coordinator Technical Editors Nilesh R Mohite Arwa Manasawala Rahul Shah Cover Work Nilesh R Mohite Copy Editors Roshni Banerjee Gladson Monteiro Karuna Narayanan www.it-ebooks.info About the Author Mark Vasilkov is a software craftsman—or engineer—whichever you prefer He specializes in Python and JavaScript development, mostly related to web and mobile applications, and has 10 years of experience in hacking stuff together so that it mostly works For what it's worth, Mark is a Russian Israeli This very book was partially written in a bomb shelter due to Hamas shooting long-range rockets (containing warheads with up to 200 kg explosives each) at Tel Aviv Israel is a beautiful country, inspiring everyone in the region to something truly remarkable and idiosyncratic www.it-ebooks.info About the Reviewers Takumi Adachi is currently working as an Android developer for Applocation based in Victoria, British Columbia, Canada He enjoys programming, kendo, cycling, and video games He is a proponent for open source and strictly uses the MIT license for his personal projects and code He specializes in Java, Python, JavaScript, and web markup languages such as HTML and CSS He is exposed to a wide range of technologies such as JavaScript, Python, HTML, CSS, SQL, SQLite, Vagrant, AngularJS, PHP, node.js, Git, REST, JSON, Bash, Linux, OS X, Windows, nginx, VirtualBox, Visual Studio 2013, Java, Excel, Android, and so on He has helped review the book, Kivy Blueprints, and hopes to continue reviewing books for Packt Publishing I would like to thank my cousin, Justin, parents, teachers, and employers for providing me with opportunities to grow and develop, and supporting me in my endeavors Joe Dorocak, whose Internet moniker is Joe Codeswell, is a very experienced programmer He enjoys creating readable code that implements the project requirements efficiently and understandably He considers writing code akin to writing poetry He prides himself on the ability to communicate clearly and professionally He considers his code to be communication, not only with the machine platforms upon which it will run, but with all those human programmers who will read it in the future www.it-ebooks.info He has been employed either as a direct employee or as a contractor by IBM, HP, GTE/Sprint, and other top-shelf companies He is presently concentrating on app and web project consulting, coded primarily, but not exclusively, in Python and JavaScript For more details, please check Joe's LinkedIn profile at https://www linkedin.com/in/joedorocak Raphael Pierzina is currently working as a development lead at Mackevision (http://mackevision.com/) in Germany He is responsible for a Python/PySidebased standalone application for defining and managing complex configuration logic data sets for data-based visualization in terms of code reviews and supervision He holds a bachelor's degree in virtual design and specializes in computer graphics and interactive applications Raphael is passionate about idiomatic Python code and development techniques such as TDD He enjoys contributing to open source projects such as Cookiecutter (https://github.com/audreyr/cookiecutter) and occasionally posts on his personal blog (http://www.hackebrot.de/) about various topics, including MaxScript, comic books, and his adventures in the world of Linux I would like to thank my loving family and my close friends for their support over the course of this project Thank you for your understanding when I had little time to spare I wish to express my gratitude to the team at Packt Publishing for providing me with the opportunity to be a part of this amazing book Edward C Delaporte V leads a software development group at the University of Illinois and has contributed to the documentation of the Kivy framework He is thankful to all those whose contributions to the open source community made his career possible, and he hopes this book helps to attract enthusiasts to software development 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 entirely free books Simply use your login credentials for immediate access www.it-ebooks.info www.it-ebooks.info To my wife, Natalia www.it-ebooks.info .. .Kivy Blueprints Build your very own app-store-ready, multi-touch games and applications with Kivy! Mark Vasilkov BIRMINGHAM - MUMBAI www.it-ebooks.info Kivy Blueprints Copyright... prompt, >>>, should appear Type import kivy The command should print a message similar to [INFO] Kivy v1.8.0 • On a Windows box: Double-click kivy. bat inside the Kivy package directory Type python... a dependency (Linux, Ubuntu in particular) Installing and running Kivy Kivy can be downloaded from the official site (http:/ /kivy. org/); just choose an appropriate version and follow the instructions

Ngày đăng: 12/09/2017, 01:30

Xem thêm

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

  • Đang cập nhật ...

TÀI LIỆU LIÊN QUAN