bool createAlias(QString pathToShortcutTarget)
{
QDir target(pathToShortcutTarget);
QFileInfo app(target.absolutePath());
QString createAliasWithFinder =
"tell application \"Finder\"\n"
"make new alias file at desktop to file \"" + app.fileName() + "\" ";
while (target.cdUp() && !target.dirName().isEmpty())
createAliasWithFinder += "of folder \"" + target.dirName() + "\" ";
createAliasWithFinder += "of startup disk\nend tell";
QString osascript = "/usr/bin/osascript";
QStringList processArguments;
processArguments << "-l" << "AppleScript";
QProcess p;
p.start(osascript, processArguments);
p.write(createAliasWithFinder.toUtf8());
p.closeWriteChannel();
return p.waitForFinished();
}
Birmacher
Game development in my spare time
Friday, July 29, 2011
Make alias for a file with AppleScript
Sunday, October 24, 2010
Player entity and social gaming
Started to implement the player. Animating, enabling accelerometer and doing some basic movement.
For animations I needed sprite sheets which is a lot of work to create - for me as a programmer:). For that I found a really great app called Zwoptex. It also supports Cocos2d, so I'm sure I'll buy a license!
Also started to think about the social part of the game. I've never tried Game Center yet, so I made a search for it and found out that it only supports devices with iOS 4.1 or over.
A long time ago I tried out Openfeint so why not to go back and see how they are doing?!
After jumping to the developer section I found a great iOS feature: Game Center Compatibility. The problem is solved:)
Thursday, October 21, 2010
Scrolling the background
It's fast, but it should work with offsets to remove the positioning of the parallax node from the code.
It was a bit hard to found out how to reposition the child elements. First I tried to go throw them, and set the new position, but nothing happened. After 1 hour I started to dig into Cocos2D and came up with this solution:
for(unsigned int i=0; i < parallaxArray_->num; i++ ) {
[parallaxArray_->arr[i] setOffset:ccpAdd([parallaxArray_->arr[i] offset], offsetToAdd)];
}
Drawing background
Currently I'm trying to find out the best method for drawing unlimited scrolling background.
It seems like I've found a way to achieve this. On the iPod 4G the FPS isn't going under 55, but on the first generation it's going down to 44 frames per second (from 60). It needs to be optimized a little bit and everything will be okay.
Also started thinking about the platforms. The ground where the user gonna jump over and over. It would be great if I can draw it randomly, making the game variable.
The idea was to use tile maps. Each layer should present a small part of the level. The starting and the ending of the snippets should be almost the same. This will be good for connecting the parts together.
From these small parts will the map generated.
Wednesday, October 20, 2010
Retina Display
So there is two types of screen resolutions for the iPhone. The standard is 320x480 and devices with retina display is 640x960.
From Cocos2d v0.99.5 beta3 Points is added to the project, to make it easier to develop on multiple devices. If I understand it, than all coordinates are transformed into the dimension of the standard device. There are no need to add different positions, just use points like that, and it will work on all devices:
sprite.position = ccp(240,160);High resolution images is used automatically too. You say that you need sprite.png, and Cocos2d will see if retina display is enabled. If yes end there is a sprite-hd.png inside the resources than it will be used. The -hd suffix can be overwritten in the ccConfig.h file.
Finally to enable retina display, just paste this code to your app delegate:
[director setOpenGLView:glView];
if ([UIScreen instancesRespondToSelector:@selector(scale)]) {
[director setContentScaleFactor:[[UIScreen mainScreen] scale]];
}
For the article click here.Syntax highlighting
After searching a while I've found this site: embed code syntax highlighting in blog by Shalabhsneha Katdare.
If you follow the post, than the highlighting should be implemented in less than 5 minutes to your blog, and you can start posting code snippets like this:):
- (void)sayHello {
NSLog(@"Hello World");
}
Sadly Objective-C is not included in the bundled version:(Also I started to try out some blogging apps. The first one is called: Blogo.
It seems that Blogo kills the HTML code I'm adding to the code snippets. It cuts off the class="brush: c" from the pre tag
The very first post
After a time it was really hard to do it with love. I needed something more . So I decided to cut down my spare time and use it up for game development, but now on the iOS, and let's see how far I can get:)Also decided to do this blogging thing in english. I'm not practicing it since I've went to university, also I really need it.
Currently I'm trying to understand the Cocos2d. It seems that it will be great for my games, and also has a great community support! So I'm learning it, doing some sample projects, and after that starting my fantastic game!:)