finger vs pointable, when should I use one or the other? - leap-motion

I'm writing a Leap app and I'm trying to decide whether to use a finger or a pointable.
The API says the pointable works for fingers AND tools.
So what I'm wondering is what's the difference between a pointer and finger and when should I use either case?

Generally you should use Pointable unless you have a specific reason to distinguish between tools and fingers. That way the user can use either.

Related

Framework of choice for building smart histogram in cocoa touch

I'm familiar with the basics of objective-c and cocoa touch and I want to start now my first large iOS project.
I want to build an iPad app with a histogram like you know it from several photo apps where you can see e.g. the distribution of brightness in a picture. But it needs to be smart, i.e. scrolling horizontal, setting borders and pinching for zoom-in and zoom-out.
Is it possible to handle this requirements with iOS7 standard API or do I need a 3rd party framework like Core-Plot to achieve a histogram I described, and if so, which one would you prefer and why.
Thanks for your help!
Is it possible to handle this requirements with iOS7 standard API or do I need a 3rd party framework
It's certainly possible to do it all yourself with no help from anybody except the frameworks that Apple provides. Whether that's the best solution for you, only you can decide. I think these are the relevant considerations:
You seem to have some fairly specific requirements and it sounds like you may need fairly fine control over exactly how this histogram looks and works. These are good reasons to create the histogram yourself.
You're still fairly new to Objective-C, Cocoa Touch, etc. That's a good reason to look for something that's already written. You'll save a lot of time and frustration, but you may have to be a little more flexible in terms of what you're willing to accept; it's unlikely that anybody has already written exactly the thing you want.
I'd suggest taking a shot a building what you want, and if it turns out to be a bigger thing than you're ready to tackle, you'll at least have a better understanding of what's involved.
To get started, read up on UIBezierPath. All you really need to do is to create a view that accepts an array of numbers and draws the corresponding graph. Don't worry about zooming and scrolling yet, just make a view that draws the graph. Once you have that, you can read up on UIScrollView, which will give you the scrolling and zooming with almost no work.

ID2D1DCRenderTarget vs ID2D1HwndRenderTarget

I'm trying to port some GDI/GDI+ code to Direct2D, but I'm still a little confused about which type of target is better to use (DC or Hwnd), because I found different performance depending on whether or not I used the Gpu. In particular, I found the following problems:
If I use the DCRenderTarget I can not use hardware acceleration (or Default), because I have continued violations of protected areas of memory. This does not happen if I use HwndRenderTarget.
If I use HwndRenderTarget, in general everything is fine, but if I have many window (like buttons), I lose the focus on the main window, which does not recognize the KeyPressed message, and, if I use the Gpu, performance fall a lot and strongly depend on the number of active targets (which does not happen if I use the software acceleration).
Has anyone encountered the same problems? Can you recommend something about it?
Thanks a lot!
In general, if you want Direct2D to interoperate with GDI, you should use ID2D1DCRenderTarget, otherwise, use ID2D1HwndRenderTarget.
I am not quite understood what you said about the performance, do you mean the performance was bad when your main window lost focus? If that's the case, you can handle the windows status to let it stop rendering when the window was lost focus, for example inactive.

What's the best way to use OpenGL with Cocoa?

I've been trying to create a Cocoa project that uses OpenGL. NSOpenGLView is too restrictive for my needs, so I've created my own custom NSView subclass. I need to have multiple copies of this class on screen at once. And I need to use shaders.
What's the best way to organize this sort of project? I've tried a ton of different setups, but I always seem to wind up having invalid drawables, GL errors, trouble managing contexts, etc. Is there a simple way that I'm overlooking? Maybe setting up a single context at app launch and having all views share it?
Stay away from messing with OpenGL yourself...it sucks. Just say no.
I HIGHLY recommend using Cocos2D. Its a FANTASTIC graphics library that is highly supported and documented and handles all the OpenGL nonsense and makes the pain go away. Don't touch OpenGL unless you want to spend more time dinking with technical details than actually making your project happen.

Create swipe controlled simple flipbook style animation in ObjC

I am a beginner in Obj C development, though quite experienced (over 10 years) with other ECMAscript based languages and OOP development.
I want to build a simple flipbook style animation, controlled through swiping motion. I'm sure extremely simple for any advanced ObjC coders.
Can anyone with extensive ObjC-CocoaTouch experience give me some higher level recommendations?
ie,
1 -general application design, should I start with a simple view based application, or navigation based or?
2 -should I use 3rd party animation frameworks such as Cocos2D, or stick with built in classes and methods?
3 -if using built in methods, classes, what is the recommended way of achieving a animation, that will be controlled via swipe and touch gestures?
4 -I want to eventually have multiple 'flipbooks' that I can 'instantly' swap with one another, ie to give the net effect of an object changing color, etc, but not sure how to approach this from a memory management point of view, related to #1 above
Except for point 3 above, I'm not expecting any actual code examples. Just general guidelines to follow and perhaps, what are some next steps I should take in my goal as an ObjC code samurai.
While I am no expert I can think of a few things you could pursue to get the effect you want. Sounds like you want have a somewhat immersive experience for users. Cocos2D would definitely fit that bill. Me and my team at Get Set Games have been using it for the past year and have not been dissapointed with it. We haven't done the flipbook effect you speak of but quite possibly someone in the Cocos2D forums has implemented are at least attempted this. Forums are accessible here.
Having said that I think starting with the iPhone SDK UIKit framework and basic examples that come with it are great. There is a great array of samples on scrolling, swiping, etc. If you want to hook in Cocos2D or other frameworks later that's definitely an option.

What is something you wish you had known sooner about the iPhone SDK?

I'm interested in picking up some tips and tricks while learning about the SDK. What I am looking for something that you wish you had known getting started that would have benefited you now.
don't use a DOM parser, but a SAX parser. (Memory issues / speed).
if you use custom table cells, don't add too many views. (Slow scrolling issues)
if you add views to table cells, like labels, you may want to make their background opaque.
the generated table view code defeats the MVC paradigm. Think about your data model, and implement an UITableViewDataSource. Really.
One of the things I wish I knew at the very beginning was how to download data in a non-blocking way, specifically using NSURLConnection. The first versions of my apps suffered somewhat because I was using things like dataWithContentsOfURL:, which isn't a great idea on the iPhone, since you're never really sure what the network environment will be like for your users. To make it worse, I was testing over a fiber connection at home with an iPod touch, when a large number of my users were using Edge on their iPhones.
If you want to use SQLite, go with either Core Data (available in 3.0) or FMDatabase (Flying Meat). My first two apps, I wrote a customer wrapper and bound directly to SQLite. I am currently using FMDatabase with a new application and have found the experience much nicer.
In the case of a lot of developers, including Google, I'm sure they wish they knew their app would be rejected once complete.
CoreData Bindings is not supported on the phone.
Use the Clang Static Analyzer
http://clang-analyzer.llvm.org/
It's great for finding reference counting issues -- I have never seen a false positive.
Regarding the table view speed check out Loren Brichter's blog post http://blog.atebits.com/2008/12/fast-scrolling-in-tweetie-with-uitableview/