Skip to main content

Posts

Showing posts from October, 2010

Display UITextField in Cocos2d Game

I create the UITextField like normal: txtName = [[UITextField alloc] initWithFrame: CGRectMake(160, 240, 200, 32)]; I add it to the subview like so: [[[CCDirector sharedDirector] openGLView] addSubview: txtName]; The problem I'm having is that, when I change the orientation to PortraitUpsideDown with this command: [[CCDirector sharedDirector] setDeviceOrientation:CCDeviceOrientationPortraitUpsideDown]; the UITextField and the keyboard don't change with the new orientation. When I click on the text box, the keyboard appears upside down and on the top of the screen. I know I can change the rotation of the UITextField using CGAffineTransformMakeRotation, but how do I make the keyboard appear upright and at the bottom of the screen when in PortraitUpsideDown orientation? When I detect an orientation change, in addition to setting the Director's device orientation like so: [[CCDirector sharedDirector] setDeviceOrientation:CCDeviceOrientationPortraitUpsideDown]; I...

Mac App Store Coming Soon - Port your cocs2d game for Mac

Apple to announce that in 90 days Mac App Store will be ready. The Mac App Store will be similar to the App Store, but instead of distributing iOS applications, it will distribute Mac applications. This is big news for cocos2d users, since cocos2d already supports Mac!! The guidelines and other requirements for the Mac App Store are online: * Mac App Store Review Guidelines * App Store Resource Center So, download the latest cocos2d version, and start porting your cocos2d game for Mac!

Cocos2d Game Development Performance Tips

Cocos2d for iPhone is a wonderful open source framework that makes it easy to draw 2D graphics with OpenGL ES. It allows to you unlock the power of the graphics hardware in iPhone OS devices, without having to deal with all the details of working with GL. Having said that, using Cocos2d is a great way to get your feet wet with GL programming. I’d never done any OpenGL stuff before, but I found I picked up quite a bit as I went along. It handles most of the hard stuff, but it’s very easy to subclass and handle drawing yourself as you become more experienced. When I started working on the bizarre experiment that eventually became Space Harvest, I initially used Core Animation. This is great, up to a point, but I found I soon hit a performance wall - Core Animation wasn’t flexible enough to handle the types of things I wanted to do, and doesn’t really give you a lot of control over what’s happening under the hood. Once I switched to Cocos2d, I found that a) it was a lot easier to get ...

How To Avoid Having Your App Rejected for Core Functionality Issues and Crashing

The two most common reasons for application rejection are issues with core functionality and crashing. Core functionality encompasses the belief that customers rightfully expect all the features described in the marketing text and release notes to work as described, and likewise that all the buttons and menu items within the application will be fully functional (i.e., no grayed out buttons or notifications that a feature will be implemented later). Before you submit your app for approval, make sure that every aspect of your application is fully functional and that the marketing text and release notes correspond to the end user experience. Also, make sure you thoroughly test your application on iPhone and iPod touch in addition to the iPhone Simulator. A large percentage of applications are rejected due to various types of crashes, including crashes on launch, which would have been found and dealt with if they'd been tested on an actual device. Don't skip that step in the develo...

Tutorials for iPad Development

While the iPad and iPhone share iOS as their operating system there are many aspects of development for the iPad that are considerably different and should be understood by developers looking to create the best possible iPad apps. On this page I have decided to list tutorials specifically created for the iPad along with other resources such as user interface design tips, and graphical resources such as UI prototyping tools and vector kits. You can expect this page to update with new tutorials and resources so be sure to bookmark it. Newer resources appear towards the top of the listing. 1. Rapid Prototyping of iPad apps using Keynote – a great guide along with many interactive elements for prototyping (key here being interactive) using Keynote. 2. How To Port An App To the iPad – Covers how to convert your app to handle the iPad screen sizes, specifically autosizing and orientation, and when to use iPad elements. 3. Custom Input View Tutorial – A tutorial on how to create grea...

Tutorials for iPad Development

While the iPad and iPhone share iOS as their operating system there are many aspects of development for the iPad that are considerably different and should be understood by developers looking to create the best possible iPad apps. On this page I have decided to list tutorials specifically created for the iPad along with other resources such as user interface design tips, and graphical resources such as UI prototyping tools and vector kits. You can expect this page to update with new tutorials and resources so be sure to bookmark it. Newer resources appear towards the top of the listing. 1. Rapid Prototyping of iPad apps using Keynote – a great guide along with many interactive elements for prototyping (key here being interactive) using Keynote. 2. How To Port An App To the iPad – Covers how to convert your app to handle the iPad screen sizes, specifically autosizing and orientation, and when to use iPad elements. 3. Custom Input View Tutorial – A tutorial on how to create grea...

Open Source Game Engine Comparison for iPhone

There are several open source game engines to choose from, and many cropping up all the time. On this page I have only listed those that I know have been used in games already available on the iPhone or iPad. I have chosen not to list those for which there are no apps available in the app store. Choosing Your Open Source iPhone Game Engine Sparrow Framework The Sparrow Framework is a very lightweight 2D game engine created in Objective-C. In a very short amount of time I was able to understand the framework, and I find it to be very intuitive. If you’d like to take a look at some actual coding with the Sparrow Framework be sure to check out the Beginners iPhone Action Game Programming Tutorial. While I have not done much Flash game programming the developers state that the game engine was created with Flash game developers in mind. The game framework includes all the necessary features you’d require for creating a basic 2D game such as easy animation, and a sound engine. Cocos2D IPh...

Integrating AdMob with Cocos2D-iPhone Applications

This post provides the code needed to display AdMob ads within Cocos2D using a UIViewController. Much of the initial content is still the same, but the code reflects the slight changes required to support the use of a UIViewController. The updated code was tested on a 3G running IOS 4 and Cocos2D 0.99.3. AdMob is a mobile advertising network that serves ads to be displayed on mobile devices. Ads can be served via native applications or within a browser and are not limited to just smart phones. AdMob offers plenty of metrics to track the quantity of served ads, geographic region, which cellphone operator, and device type. This tutorial will provide the guidance needed to include AdMob served ads within your Cocos2D-iPhone application. This example is based upon v.82 of the Cocos2D-iPhone framework. Your first step is to register with AdMob to get a publisher ID and input information regarding your application. Registration and eventual access to the SDK is free. Once registered ...

OpenFeint Integration with cocos2d

If you want to integrate your cocos2d game with openfeint leaderboard then follow following steps. Openfeint is used for live leaderboard for games, achievement, forum, live chat and many community features as well. It will decrease developers efforts to maintain highscores and achievement etc. OpenFeint is a service that enables your iPhone/iPod Touch application the ability to provide online score tracking. The service is free and can easily be incorporated into your applications. This tutorial will cover the integration of OpenFeint 2.4.3 with the Cocos2D-iPhone framework. Before getting started, it is assumed that you already have familiarity with: * Objective-C * XCode * Cocos2D-iPhone framework The expectation is that you already have a working Cocos2D based application to which you’d like to enable leaderboard functionality. If you’re new to Cocos2D-iPhone, then you should visit http://www.cocos2d-iphone.org to review the available documentation and download the...

What's new in iPhone 4.0

This is my first article so please forgive me if there is any mistake. Please comment so i can understand or update my article if there is any mistake. Thanks in advance for your support. This article summarizes the developer-related features introduced in iPhone OS 4.0. This version of the operating system runs on iPhone and iPod touch only and does not run on iPad. In addition to describing the new features, this article lists the documents that describe those features in more detail. Note: iPhone OS 4.0 does not support iPad. It runs only on iPhone and iPod touch devices. For the latest updates and information, you should also see iPhone OS 4.0 Release Notes. For the list of API differences between the iPhone OS 4.0 and earlier versions of iPhone OS, see iPhone OS 4.0 API Diffs. Here are some new feature which added in iPhone 4.0 1. Multitasking 2. Integration Technology 2.1 Local Notification 2.2 Event Kit 2.3 Core Motion 2.4 Data Protection 2.5 Core Telephony ...