Blog

C Preprocessor fun

Posted by | Coding | No Comments

The C Preprocessor can be used for more than simple text replacement macros for numeric or string values. It can provide an elegant solution for simplifying the often tedious task of print log statements.

 

Why define your own print logs? Because they’re yours and you can do whatever you want with them. You can turn them all off and then all back on again. You can selectively choose which logs to print. Let Cocos2D have CCLOG.

 

I often find it helpful while debugging to print the names of functions as they’re called. Without the C Preprocessor, I would have to type: NSLog (@”[Class functionCall]”); for in the body of every method. That’s a lot of typing, copying, & pasting. Here is a quick solution.

 

In a Global header:


#define CallLog() NSLog(@"%x %s",(uint)self,__PRETTY_FUNCTION__)

Usage:


-(void) functionCall

{

CallLog();

{…}

}

Output:


9b3c00 -[Class functionCall]

The number preceding the print log of the call is the unique hex value identifier of the object making the call. __PRETTY_FUNCTION__ returns the name of the calling function in pretty Objective-C format.

 

The C Preprocessor can also make short work of printing out common value types. Sometimes we need a detailed message to print, but more often than not, we just need to print the name of a variable and it’s value. This is a simple way of printing a point variable.

 

In a Global header:


#define PrintPoint(point) DebugLog(@"%s=(%.02f,%.02f)",#point,point.x,point.y)

Usage:


-(void) functionCall

{

{...}

GCPoint pointName = CGPointMake(240,160);

PrintPoint(pointName);

}

Output:


pointName=(240,160)

The #point argument in the macro returns the literal of the token as a C string and point is the value of the argument. It should be noted that PrintPoint() does not know what type of value it is being passed. This is simple string substitution, and should probably only be used for debug purposes. Also any extensive logging will slow your application and is best to shut off before release.

 

Here is a small collection of log macros that I use fairly frequently. Feel free to make use of them and add others. We’d love to hear how you use the C Preprocessor.


#define LOGGING //comment out to shut off all logs

#ifdef LOGGING

#define ERROR_LOGGING //comment out to shut off error logs

#define CALL_LOGGING //comment out to shut off call logs

#define DEBUG_LOGGING //comment out to shut off debug logs

#endif

#ifdef ERROR_LOGGING

#define ErrorLog(...) NSLog(@"Error: "__VA_ARGS__)

#else

#define ErrorLog(...)

#endif

#ifdef CALL_LOGGING

#define CallLog() NSLog(@"%x %s",(uint)self,__PRETTY_FUNCTION__)

#else

#define CallLog()

#endif

#ifdef DEBUG_LOGGING

#define DebugLog(...) NSLog(@"Debug: "__VA_ARGS__)

#define PrintPoint(point) DebugLog(@"%s=(%.02f,%.02f)",#point,point.x,point.y)

#define PrintInt(int) DebugLog(@"%s=%d",#int,int)

#define PrintFloat(float) DebugLog(@"%s=%.02f",#float,float)

#else

#define DebugLog(...)

#endif

Burst180x150

Burst! is a top downloaded iPhone game

Posted by | News | 5 Comments
Update—
Burst! rang in the New Year as the 3rd most downloaded Free Adventure Game on the App Store!

 

With over 200,000 downloads in the last 3 days, Burst! the unlimited projectile, unlimited fun, physics-based puzzler soars into the top charts on the Apple App Store.

Burst! currently (12-30-2011) ranks in the top 10 Free Adventure Games and the top 25 Free Action Games.

 

 

Here are what players are saying:

“Overall great !! - Great graphics, smooth gameplay, relatively simple controls, and freakin’ addictive.!!!!!!!!!!!!”
~ Sweeeet Sam

“Extremely addictive!You won’t be able to put it down! :)”
~ Rodriges

“I recommend Burst! to people that are iTouch masters!I rate this game 5 STARS!”
~ 2011super

“This is better than Angry birds in many ways.”
~ Jobs GREAT

“This is hands down my favorite game. it’s brilliant. Great graphics. Great storyline! Challenging yet intuitive! Make more…!”
~ LaMerintheBlue

 

See more…

hairpullingout

RemoveFromSuperView method not working

Posted by | Coding | No Comments

If you have recently updated to iOS 5  you may have noticed your modal view controllers stopped working for no apparent reason.

 

The symptoms:

1: A modal view will launch but will not close
2: All the code worked prior to the update to  iOS 5
3: The close code looks like this “[self removeFromSuperView]”

 

The problem:

iOS 5 removes the ability to reference the model view’s parent view via the removeFromSuperView method. Note, there isn’t an error. It just doesn’t work.

 

Simple solution:

The simplest solution is to replace  

 [self removeFromSuperView] 

 with

[[self presentingViewController] dismissModalViewControllerAnimated:YES]

 but this only work on devices running iOS 5.

 

The backwards compatible fix:

1: Define the following globally

 #define self_parentViewController (([self parentViewController] != nil || ![self respondsToSelector:@selector(presentingViewController)]) ? [self parentViewController] : [self presentingViewController])

2: Then replace all

 [self removeFromSuperView] 

 with

[self_parentViewController dismissModalViewControllerAnimated:YES]

3: Thanks to http://omegadelta.net/tag/annoyance/ for the help on this problem!

 

What is the Processing For App Store status?

Posted by | Coding | 24 Comments

After waiting 5 days with Burst! in the “Waiting For Review”, the status changed to “In Review”. This is normal. In my experience the waiting period is anywhere from 3 to 7 days though some people have complained of considerably longer waits.

BUT…Burst! then went into “Processing For App Store” status and stayed that way for 36 hours!

In Apple’s documents “Processing For App Store” says the binary is being processed and will be ready within 24 hours. So, 36 hours may not seem like that big a deal, but from personal experience I have never seen Processing For App Store” last for more than 10 minutes. So, yeah, something was wrong.

I called Apple Developer Support and was able to open a ticket. Shortly thereafter, Burst! was “Ready For Sale”.

BUT…when the game was on iTunes we noticed something very wrong.

App Store Screw-Up

At least one picture is required to submit. So where are they? I assumed something messed up in the “Processing…”. Since pictures can be changed after an app is live, I made a slight change to the app description in iTunes Connect (the pictures were all there!) and hit save.
30 minutes later, voila!

 

Burst! as it was supposed to look

Burst! is Finally here.

Posted by | News | No Comments

After months of hard work, Burst! is finally available on iTunes.

It seems like such a short time ago that Tim suggested to me that we design a Western Michigan University iPhone App as our senior design project. Who knew (other than Tim) that this was the start of our career of developing for mobile devices.

Only a year later we found ourselves, with Evan, sitting around the lunch table at WickeyWare, deciding on the adventures of Chester and Lyndon.  It is absolutely fantastic to see our story come to life. We are indebted to the brilliant creative minds of Andrew Van Koevering and Michael Fedewa who designed the characters and other game art. Evan, who wrote the majority of the music, has the uncanny ability to make epic music in odd time signatures. That intro theme is in 7/8 folks!

This is our first physics simulation game. We primarily used Cocos2D and Box2D in the development, but Code’n'Web’s TexturePacker and PhysicsEditor, along with 71Squared’s ParticleDesigner were completely indispensable in the process. Also we made extensive use of Michael Daley’s  book “Learning IOS Programming“, Steffen Itterheim’s book ”Learn iPhone & iPad cocos2D“, and Rod Strougo  & Ray Wenderlich’s  book “Learning Cocos2D“. (Ray Wenderlich is our hero. Seriously his tutorials are the best.) We’ve learned so much while making this game. We can’t wait to make the next one!

Burst!

It’s Almost Here!

Posted by | News | No Comments

Al’liqu’a al’leezat! Burst is almost here!

In the recent past of a distant land, young Chester awakens to find the morning skies filled with colorful latex balloons. Naturally perceiving a potential threat to his simple way of life, Chester embarks on the balloon popping journey of his life in pursuit of the mysterious villain, Lyndon.

But Lyndon won’t be caught without a fight. Chester must complete each of Lyndon’s quizzical puzzle contraptions while avoiding the toxic black balloons filled with deadly moon fumes.

Use your superior intellect.

Use special arrows.

Decipher puzzles.

Decimate worlds!

 

It’s only a few days away.

Burst! Coming December 2011 from WickeyWare.

What the?

The world has gone mad

Posted by | News | No Comments

What the?

 

Burst!

Imagine waking up, feeling great, ready for whatever the day may bring…when you glance out of the window and see…balloons???

Seems unbelievable, doesn’t it? Yet that’s exactly what happened to Edmund one day a very short time ago.

 

 

Status Update of WickeyWare for the week of 09/26/2011

Posted by | News | No Comments

Hey everyone! It’s been a super productive week here at WickeyWare! All of us have been scrounging away at our respective projects, and we’re getting a ton of work done!

Burst is nearing completion (hopefully we’ll get all those nasty bugs out next week! Would anyone be interested in a beta test of Burst?), and will be coming out very soon!

We also have a new project, a randomly-generated mining/strategy game. The name is undecided so far (ideas anybody? Leave them in a comment, please!), but the game is pretty deep in development. This week, I delved into autosaving/loading (got it working just before this blog post :D), smelting metals, cutting gems, a whole new inventory system (chaining is your friend when dealing with file i/o) and implementing little robots to go collect your precious metals and gems. Look for this game to be named and a release date declared very soon!

promo_1024x500

Apathetic 8 Ball Doesn’t Care

Posted by | News | No Comments

We are pleased to announce the release of a most helpful app for Android devices. Apathetic 8 Ball was designed to help you with your most difficult decisions, and we were extremely excited about the opportunity to help guide so many people with life’s difficult choices.

Then we made the disturbing discovery that Apathetic 8 Ball didn’t always appear to give correct answers…

Ask it any question, then shake your device, and it will give you the answer.

Inquire about your future, relationships, dinner plans, your dog, anything at all, it doesn’t care. It probably won’t even listen. But ask anyway.