Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Cocos2d Game Development Essentials

You're reading from   Cocos2d Game Development Essentials For new users - a quickstart guide to bringing your mobile game ideas to life with Cocos2D

Arrow left icon
Product type Paperback
Published in Jan 2015
Publisher
ISBN-13 9781784390327
Length 136 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Ben Trengrove Ben Trengrove
Author Profile Icon Ben Trengrove
Ben Trengrove
Arrow right icon
View More author details
Toc

Accepting user input with form elements

There are many other user input methods that are not buttons. Cocos2d v3 brings a whole suite of form components that were missing from previous versions.

It is also possible to include UIKit components, but in nearly all cases, a better user experience will be provided by using the Cocos2d equivalent.

The form elements available are as follows:

  • CCButton
  • CCTextField
  • CCLabelTTF, CCLabelBMFont
  • CCSlider
  • CCScrollView
  • CCTableView

To use these elements, you must provide images for their appearance. However, there is an easier method. SpriteBuilder comes with template versions of the form components and makes their use very simple.

Accepting user input with form elements

These are what each component looks like in an app.

Accepting user input with form elements
  1. Start a new SpriteBuilder project.
  2. Drag out some form elements onto the screen and then publish it in Xcode. In order to use these form elements you have placed, you will need to set up code connections.
  3. Open the Xcode project for your SpriteBuilder project, and then open the MainScene.m...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image