Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - tokyotron

Pages: 1 [2]
21
iOS / The template
« on: Tue, May 15, 2012 »
So this great template...

https://github.com/bigjko/Flx-iOS-template

Works great with Xcode 4. But it's just that if you upgrade to recommended settings, Xcode suggest to upgrade to the latest compiler and doing that gives heaps of warnings. I've cleared up all those warnings. Doesn't give a problem with or without those warnings, nor with the newer compiler, afaik. If anyone has run into problems (or would know of any) in doing this, please let me know. Or I might fork this "fix" to github eventually.

22
iOS / Sound effects
« on: Tue, May 15, 2012 »
Anyone know the reason why the sound effects are played using OA and not for instance AV Foundation?

23
iOS / Re: Dynamic FlxSprite coloring
« on: Fri, May 11, 2012 »
I tried it. Didn't work... until I realized that everything inside " - (void) setColor:(unsigned int)Color;" was commented out. I just added
Code: [Select]
_color = Color; and now it seems to work. This can be real useful I agree  ::)

24
iOS / Re: Canabalt's HUD class
« on: Fri, May 11, 2012 »
Yes the vertices apply in 2D as well. You can comment out the last area hiding the blanks (0):

   
Code: [Select]
BOOL blank = YES;
for (int i = DIGITS-1; i >= 0; --i) {
if (digits[i] != 0) {
blank = NO;
break;
}
if (blank) {
hudVerticesUVs[(DIGITS-i-1)*16+5] = hudVerticesUVs[(DIGITS-i-1)*16+1];
hudVerticesUVs[(DIGITS-i-1)*16+13] = hudVerticesUVs[(DIGITS-i-1)*16+9];
}
}
Then 6 digits will always be visible. The leftmost zeroes should be visible.
I guess it takes some study of OpenGL to know what stuff like (DIGITS-i-1)*16+1 means. I was watching one of those OpenGL lessons in the iTunes U app a while back. It explained some of this although I never went through all of it. Back to classroom...


Oh anyway I'm successfully using a similar class for my own display of another subset font. The downside of this method is that you can only use integer numbers (at least without rewriting some parts), and no commas dots, alphabet etc.
My problem is once again I can't use retina graphics with this without finding out how to draw that with opengl...

What I've noticed about Flixel so far is that it's not straightforward to use retina graphics out of the box - or I've missed something. This would indeed hinder most devs use of this engine. With native iOS apps you only really add @2x versions of your image files and that's it. It doesn't seem that easy with Flixel...

25
iOS / Canabalt's HUD class
« on: Thu, May 10, 2012 »
Hello. I am trying to find out how the HUD class works. The HUD class is what draws the always increasing distance in Canabalt game to the upper right corner.
It uses a small "font" (hud.png) and finds out the correct texture coords in order for opengl to draw, I guess this class is made because of optimization, otherwise you'd use the text features from the engine (?)

Specifically what I cannot understand is:

Code: [Select]
//then digits
for (int i = 0; i < DIGITS; ++i) {
hudVerticesUVs[VERTEX_COUNT*4-(i+1)*16-4] = (GLshort)(width-runningWidth);
hudVerticesUVs[VERTEX_COUNT*4-(i+1)*16-3] = (GLshort)(hudTexture.size.height);
hudVerticesUVs[VERTEX_COUNT*4-(i+1)*16-8] = (GLshort)(width-runningWidth);
hudVerticesUVs[VERTEX_COUNT*4-(i+1)*16-7] = 0;
runningWidth += digitWidths[DIGITS-1-i];
hudVerticesUVs[VERTEX_COUNT*4-(i+1)*16-12] = (GLshort)(width-runningWidth);
hudVerticesUVs[VERTEX_COUNT*4-(i+1)*16-11] = (GLshort)(hudTexture.size.height);
hudVerticesUVs[VERTEX_COUNT*4-(i+1)*16-16] = (GLshort)(width-runningWidth);
hudVerticesUVs[VERTEX_COUNT*4-(i+1)*16-15] = 0;
hudVerticesUVs[VERTEX_COUNT*4-(i+1)*16-2] = [FlxGLView convertToShort:(hudOffsets[digits[i]+1]/hudTexture.paddedSize.width)];
hudVerticesUVs[VERTEX_COUNT*4-(i+1)*16-1] = [FlxGLView convertToShort:(hudTexture.size.height/hudTexture.paddedSize.height)];
hudVerticesUVs[VERTEX_COUNT*4-(i+1)*16-6] = [FlxGLView convertToShort:(hudOffsets[digits[i]+1]/hudTexture.paddedSize.width)];
hudVerticesUVs[VERTEX_COUNT*4-(i+1)*16-5] = [FlxGLView convertToShort:(0)];
hudVerticesUVs[VERTEX_COUNT*4-(i+1)*16-10] = [FlxGLView convertToShort:(hudOffsets[digits[i]]/hudTexture.paddedSize.width)];
hudVerticesUVs[VERTEX_COUNT*4-(i+1)*16-9] = [FlxGLView convertToShort:(hudTexture.size.height/hudTexture.paddedSize.height)];
hudVerticesUVs[VERTEX_COUNT*4-(i+1)*16-14] = [FlxGLView convertToShort:(hudOffsets[digits[i]]/hudTexture.paddedSize.width)];
hudVerticesUVs[VERTEX_COUNT*4-(i+1)*16-13] = [FlxGLView convertToShort:(0)];
}

I can understand the right hand size values - these would be the origins in pairs x, then y, then next x,y and so on...
However the left hand side VERTEX_COUNT*4-(i+1)*16-4 etc... anyone got a good explanation of that?

26
iOS / Re: Retina / high res textures
« on: Thu, May 10, 2012 »
I don't yet get it right with the FlxTileblock. Using @2x textures there (they seem properly loaded if existing) just gives bigger graphics, not higher resolution.

I noticed also that the engine gives lots of warnings when compiling, like lots of stuff concerning properties. I've updated the project to give 0 warnings when compiling. I don't think I've seen any problem so far. I might github that stuff later.

27
iOS / Retina / high res textures
« on: Wed, May 9, 2012 »
Did anyone try using high res graphics for retina displays?

How do you do it properly?
I'm in the process trying to find out the above. Use retina textures for retina displays. Standard textures for standard displays.
I think I've gotten FlxSprites working by now, still FlxTileblocks render too big on retina displays... so. If anyone knows of any working examples?

Like someone else noted in a post here, I set useTextureBufferZoom to NO when initing the FlxGame. And for retina displays, set zoom to 2.0 (actually I use device scale from UIScreen if it exists, otherwise 1.0 for backways comp.). This is what seems to fix things for FlxSprites. Still FlxTileblocks seem to draw things on their own and I guess they don't really care about those zoom parameters. And I'll likely need the FlxTileblocks for performance reasons...

Oh and hello this is my first post in this forum. I'll be sticking around for awhile I guess. I'm an iOS developer, but so far made only Cocoa Touch / native apps, and have only temporary experience from OpenGL and that's around 10 years ago.

Pages: 1 [2]