Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • PhoneGap By Example
  • Toc
  • feedback
PhoneGap By Example

PhoneGap By Example

By : Andrew Kovalenko
close
PhoneGap By Example

PhoneGap By Example

By: Andrew Kovalenko

Overview of this book

PhoneGap is a free and open source framework that allows you to create mobile apps using standardized web APIs for the platforms you care about. It is one of the first and fastest spreading tools to develop hybrid applications using CSS, JavaScript, and HTML, without losing the advantages of native applications. If you are already a web developer, this book will provide you with the skills you need to create, customize, test, and deploy hybrid mobile applications. Starting from the beginning, this book will cover how to set up your PhoneGap development environment, add mobile web frameworks and plugins, design and customize the application layout, and utilize the embedded features of the PhoneGap framework. By working through the steps in each chapter, you will quickly master a variety of mobile applications with totally different approaches. You will then learn how to develop a PhoneGap plugin with native interfaces for iOS and Android, as well as common approaches to test PhoneGap applications. With ample screenshots that show you how to build a phenomenal application, PhoneGap by Example will ensure your success with this cutting-edge mobile development framework for hybrid applications.
Table of Contents (12 chapters)
close
11
Index

Prepare and create the game


When we executed the Cordova command to generate the application, it already created some HTML, CSS, and JavaScript for us. Let's organize it a little. I would like to see such a structure of the www folder:

.
├── assets
│    └── sprites
│      └── spheres.png
├── css
│    └── index.css
├── index.html
└── js
    ├── game.js
    ├── index.js
    └── phaser.js

In this structure, we should have the following elements:

  • spheres.png: This is our file with different bubble colors

  • index.html: This is the main HTML file where we should place the canvas

  • index.css: This is our main stylesheet file

  • phaser.js: This is the Phaser framework itself

  • game.js: This is the file with the game login and all Phaser-related code

Let's modify the index.html file so that the body content looks like this:

<div id="phaser"></div>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/phaser.js"></script>
<script...
bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete