MMSGURU's Techno Blog | home | subscribe | contact | admin |
Friday, September 3rd  
 | list | rss | 
Perfect shiny custom rounded rect buttons for iPhone/iPad
If you need to create rounded buttons with a glossy surface matching Apple's UI but with custom coloring, here comes a nice solution...

Add the following code to a dummy-app that you run within the simulator (note: this does not work on the device!). A good place to put this code would be a newly created UIVIew-Application's viewDidLoad method.

This snippet will render the button and export a PNG file of it to your desktop. Make sure you edit the path as it currently is adapted towards my own username.


Class theClass = NSClassFromString(@"UIGlassButton");
UIButton *theButton = [[[theClass alloc] initWithFrame:CGRectMake(10, 10, 29, 52)] autorelease];
[theButton setValue:[UIColor colorWithHue:0.267 saturation:1.000 brightness:0.667 alpha:1.000] forKey:@"tintColor"];
[self.view addSubview:theButton];

UIGraphicsBeginImageContext(theButton.frame.size);

CGContextRef theContext = UIGraphicsGetCurrentContext();
[t... more

April 20th, 2010 - 11:06 am | permalink

Automatically generating a source documentation within Xcode
Xcode, being a very flexible IDE for application development offers embedding custom documentations for your own code. Such documentation should be organized as a so called docset. The best documentation generator available IMHO is Doxygen.
Get a Doxygen well designed, binary Mac distribution of Doxygen at Doxygen source and binary releases. For the sake of simplicity, I would recommend downloading and installing the universal binary distribution for Mac OS X (.dmg).
Now how to generate a docset using Doxygen? Apple, being a strong supporter of open-source software did release a nice and easy step-by-step tutorial for covering that job.
You find that tutorial at Using Doxygen to Create Xcode Documentation Sets.
With those tools at hand, you can easily generate docsets automatically when compiling your code.
One thi... more

May 21st, 2009 - 11:12 am | permalink

CoreAnimation layers are full of Traps
Apple's beautifull SDK includes the nice and easy CoreAnimation API. CoreAnimation can be used for animating just about anything you can display on the screen. CoreAnimation appears to be an easy to use wrapper for OpenGL(ES). Well, basically anything you draw on the screen of an iPhone appears underneath to be handled by OpenGL(ES). CoreAnimation makes all those nifty display effects (fades, rotations, wiggles, etc.) really quick and comfortably to implement. And the way that works is definitely super close to what you do when animating directly via OpenGL(ES) - a fact that makes the transition from CoreAnimation towards OpenGL(ES) very straightforward in case you ever need to go that extra step.

BUT, be warned, there are drawbacks in CoreAnimation that are not really obvious in the first place.

CoreAnimation works on so called layers (CALayer). Those layers are compareable to a Canvas in HTML5. Such layer may have children (sublayers) resulting into a tree structur... more

May 18th, 2009 - 07:18 am | permalink

Some Facts about the iPhone OpenGL Hardware
- There is no stencil or accumulation buffer.
- There are only two texture units.
- The maximum texture size is 1024×1024 (use power of two only).
- The maximum space for textures and surfaces is 24MB.
- Only 2D textures are supported.
- There is no software rendering fallback.

More interesting facts and hints: http://www.ddj.com/mobile/209600498

May 9th, 2009 - 02:38 am | permalink

Pretty 2D circles with fat outlines in OpenGL / ES
Today I was confronted with the problem that my unfilled circles, rendered with the function from my previous posting did look good only as long as I did not set the glLinewidth higher than 1. When using fat lines, the result looked bizarre - that is, it was missing some parts. When additionally using GL_LINE_SMOOTH the result was perfectly round but had a moiree pattern inside the fat line.
The solution was rather simple, just dont mess with glLinewidth and leave it at 1.0.

But then again, I still wanted to draw a circle with a thick outline.

Once again the solution was surprisingly simple. Instead of using a GL_LINE_LOOP, I used a GL_TRIANGLE_STRIP with the first point calced on the outer side of the circle (radius+lineWidth/2) and the second point on the inner side of the circle (radius-lineWidth/2). Et voila, a perfectly round circle drawn with a fat line.

Only downside is, I lost the smoothing that way. That I will have to implement now as well us... more

May 4th, 2009 - 09:31 am | permalink

Couple of efficient 2D graphix algorithms
When searching for the most efficient way to draw primitives on OpenGL ES I found the following two extremely elegant.

Circle / Circle Arc

Drawing a circle and a circle arc is usually done using the standard algorithm we learned from school. Well, as usual, that is not the most efficient way to do it.

Have a look at this page for a much more efficient implementation and its very easy to understand explanation:
An Efficient Way to Draw Approximate Circles in OpenGL (mirrored version)
Please note that this page is a mirrored version of the Google cached version of SiegeLord's Abode original page / article. A few days ago that page went down, hence I decided to mirror it as I found it really usefull. The original URL was: http://slabode.exofire.net/circle_draw.shtml - if that page ever comes back up again (you should try that right now), please send me a n... more

May 2nd, 2009 - 03:21 am | permalink

Debugging Macros on Cocoa (and Cocoa Touch)
Ahoi!

over the last 10 years I was coding a lot on Windows based systems using Visual C++. I grew custom to using the convenient TRACE and ASSERT macros.

When starting to do more cross-platform coding, I simply implemented my own versions of those macros and kept using them as learned.

Now that I started doing Cocoa coding, I missed my former buddies TRACE and ASSERT. But not for long as I discovered that there actually were very similar macros/functions existing on that platform (NSLog and NSAssert). However, both dont work exactly the way I used my old pals.

The differences are:
- NSLog and NSAssert are not strictly existing in DEBUG builds but in all versions of your code.
- NSAssert does not take a variable number of arguments but exists in several versions depending on the amount of paramaters you want to supply.


The first issue is a no brainer, all you need to do is create a wrapping macro an make sure it only exists whe... more

April 30th, 2009 - 01:33 pm | permalink

Back and Alive
This one is just for letting you know that I am back in action. The last two years have been really slow. Most of my time I wasted with MMO's like WoW and LOTRO - quit both after realizing how consuming they were. Well, thing is, I am really keen for success and such games are really poison for me as I cant stop until I am *the best*. That goal was never reached in WoW, as the clever Blizzard guys did prepare for people like me. On the other side, LOTRO never really offered enough end-game-content to keep guys like me playing it. Actually I prefer PvP instead of PvE and the PvP part of LOTRO is a bad joke. Just to give you some ideas on why LOTRO PvP is ridiculous from the technical point of view:
The number of players within the PvP area is unlimitted. At the first glance that looks sexy but anybody who is a bit technically savvy will notice that not capping the number of players in a certain area WILL lead to overcrowded areas. Anybody who played this game and ever tried to attac... more

May 6th, 2008 - 03:59 am | permalink

SISyphus Labour
Some brief ideas and experiences with mobile themes/skins and their file formats, namely: Nokia Series 40 Theme NTH (1.0 and 2.1), Nokia Series 60 Theme SIS (2.6, 2.8 and 3.0), Sony-Ericsson Theme THM and Sony-Ericsson Theme UTZ. I enjoyed playing with those formats and implementing a parser/validator/extractor. It especially was a nice experience because these file-formats are mostly straight forward -> designed by people that know their job.


Nokia NTH

The first theme I started playing with, was Nokia's Series40 Theme format (.nth). The tool for creating them is called "S40 Theme Studio", it is available through Nokia's developer forum and it is the worst piece of Java I ever had on my desktop. It is buggy, nightmarish slow and not intuitive at all. Well, but still i managed to create a few test themes for finding more details about that format.

NTH-files are ZIP-archives. The non-binary attributes of the theme is described in "theme_descriptor.x... more

June 28th, 2006 - 07:24 am | permalink

A ringtone is a ringtone is a ringtone is a ringtone
Are reading news like: "the content market is going down", "mp3 handsets make ringtone sales superflous", ... ?

Well, here are my two pence:

That is male, wild cow excrement.

- Content sales are strongly connected to handset sales
Especially true for games and applications, but also for ringtones etc. Currently the handset sales in europe are generally decreasing, hence also the content sales. Handset sales will dramatically increase again as soon as a new technology step is taken.

- The average MP3-song is not directly usable as a ringtone.
A ringtone generally has a purpose!!! It alerts the user that somebody wants to talk to him. Many pop-tunes have intros that slowly build up and introduce the actual song theme. A proper ringtone catches only the most recognizable part of a song. The task of identifying, cutting and tweaking such part is definitely exceeding Joe Couch-Potatoe's abilities.

Rest assured, the market is not dying!

June 21st, 2006 - 09:31 am | permalink

« older posts »
 | list | rss |