Detect Pen Tablet Pressure using an AIR Native Extension

This native extension allows you to detect the input pressure of compatible pen tablet devices. This post includes a video demo of the code running on the Eee Slate and a downloadable ANE that you can use without installing Visual Studio.

Problem:
A big thanks to the Magical Hobo for creating the c++ code for this. The only problem is that the code was built in debug mode and requires Visual Studio and the MSVCP100D.dll. Great for people who want to dive into the c++ code but it adds a lot of upfront time in getting everything setup.

Solution:
After downloading the project from GitHub, removing all debug dependencies and re-building in release mode, the ANE was ready for use without Visual Studio. If you’d like the full c++ source, checkout the Magical Hobo’s source on GitHub.

More information on Adobe Native Extensions:
http://www.adobe.com/devnet/air/native-extensions-for-air.html

Link to original c++ source code by the Magical Hobo:
http://blog.magicalhobo.com/2011/10/01/air-3-native-extension-example-pentablet/

How do you know if your device can detect pressure?
Open up PhotoShop, select a brush, click on the pressure sensitivity icon and start drawing. If PhotoShop can detect the sensitivity than you should be good to go.

Requirements:
> Touch sensitive capable device.
> Windows OS
> Flash Builder 4.6
> AIR 3.1

Download the ANE:
http://www.blackcj.com/blog/wp-content/swfs/PenTabletLib.ane

iPad, Eee Slate and PlayBook Comparison

The iPad 2 is a great entertainment device but it’s too big to carry around with a laptop and isn’t powerful enough to replace a laptop. This is were the Eee Slate comes in handy. It’s light enough to use on the sofa and powerful enough to completely replace a laptop. The biggest downside to the device is it’s less than average battery life. I don’t mind plugging it in but if you’re planning to be on the device all day without power, that would definitely be a deal breaker.

Last but not least, the PlayBook (or any 7″ tablet really). Tablets at this size are much better for portability compared to the 10″ & 12″ tablets. Reading books on the go, playing games and general web browsing are the best uses. When I’m on the go and don’t need a laptop, the 7″ inch tablet in my device of choice.

In the future, it would be great to see a device that is the best of both worlds. If I could dock my iPad and switch it over to OS X, that would dramatically increase the usefulness of the device. The same goes for my Eee Slate, it would be great to have a more battery conscious OS while on the go and run full Windows 7 when docked. So far, Windows 8 is the only thing on the horizon that looks promising in this respect. Lets hope they don’t mess that up!

Without further delay, let’s take a look at the feature rundown of these three devices:

iPad 2 Harley Davidson Nightster Harley Davidson Forty-Eight

iPad 2

Asus Eee Slate

PlayBook

Cost $499* $1049 $299
RAM 1GB 4GB 1GB
Memory 16GB 64GB 16GB
Included Accessories Charging Cable BT Keyboard, Leather Case, Charging Cable Charging Cable, Glove Case
Operating System iOS 5 Windows 7 QNX
Input Touch Pen + Touch Touch
Touch Friendly OS Yes Mediocre
(Taps mimic mouse.)
Yes
Pen Friendly OS No Yes No
Battery Life 8 hours 4 hours 8 hours
Amazon Rating 4.2 stars 4.2 stars 4.0 stars
Open Market No Yes No
Screen Size 10 inch 12 inch 7 inch
Ports Audio Mini HDMI, 2x USB, Audio, SD Audio, Micro HDMI
Mouse Enabled No Yes Select Bluetooth Mice

 

*Keep in mind the 64GB iPad with keyboard, DVI adapter, leather case and warranty ends up being $886.

What do I use the Eee Slate for?

> Primary computing device for work
> Adobe Creative Suite, word processing, Amazon onDemand, web applications…
> Complete laptop replacement

Eee Slate complaints?

> The OS could be much more touch intuitive (hopefully Widows 8 will help with this)
> No docking station

What do I use the iPad for?

> Testing apps
> Listening to Pandora via Bluetooth on my stereo
> Multi-player games like marbles
> Writing down quick notes

iPad complaints:

> Lack of iPad specific apps – most are for iPhone
> Bluetooth is hidden too deep in the menu

What do I use the PlayBook for?

> Testing apps
> Reading books on Kobo
> Playing single player games
> Taking pictures / video on the go

PlayBook complaints:

> Lack of killer apps like Pandora and Kindle. The browser almost makes up for this but falls a bit short.
> Can’t connect to most bluetooth devices

What do you use your tablet for? Does your device collect dust in the corner or does it get regular use?

Installing Your Signed App onto the PlayBook

You can send your signed app to the BlackBerry PlayBook using blackberry-dploy. This makes it easy to test final builds without having to setup debugging certificates. We’ll talk about debug certificates in a later post, let’s get our app onto the device!

Problem:
You want to test your signed application on the device before submitting it to the app world or setting up the debug certificate. The PlayBook browser doesn’t currently support the BAR extension (hopefully this will change).

Solution:
Use the blackberry-deploy command to send your signed BAR file directly to the device. Before doing this you’ll need to put your device in developer mode.

To put your PlayBook in developer mode go into the device settings (top right corner) and select Security. Click on the Development Mode button and select to enable it. Here’s the tricky part, to actually get this working I needed to reboot the device and go back into the settings and re-enable development mode. This might have just been a fluke but worth mentioning. After doing this the developer icon showed up on the home screen along with my device ip address (see image).

Connect the device up to your machine using the usb cable, open a command prompt in the SDK bin folder and run the following command:

>blackberry-deploy -installApp -device DEVICE_IP -password DEV_PASSWORD yourappname.bar

You will have to put the full path to your BAR if it’s not in the bin directory.

After running that command my signed application was on the device and ready to go.

HTML5 Games Development by Example

This book by Packt Publishing has a very promising title. It pulls the reader in quickly with an exciting opening paragraph that reads:

“HTML5 promises to be the hot new platform for online games. HTML5 games work on computers, smartphones, and tablets – including iPhones and iPads. Be one of the first developers to build HTML5 games today and be ready for tomorrow!”

That’s cool! You mean it’s actually possible to build a game that works well in the browser and on an iPad? Well, surprisingly enough, according to this book the answer is NO. Out of the 9 code examples, only one of them even rendered on my iPad 2. The game that worked on my iPad was technically done in CSS3 and also looks very bad on my Android. The book has some great examples and if you’re looking to build HTML5 games for desktop browsers, I would recommend it. If you’re looking to build HTML5 games for mobile devices, stay away from this one.

What the publisher and many people fail to realize is that HTML5 does NOT equal mobile. I haven’t seen a single HTML5 page that’s looked good across devices. Not a single one. SlideShare recently converted their entire site to “HTML5″ – according to the marketing team. A quick look at the doctype on the page reveals… wait for it, XHTML! Marketers are sucking the life out of a buzzword and lying through the teeth about it.

When every example of HTML5 either has horrible cross browser support, doesn’t render on mobile devices or isn’t actually HTML5, I wonder what the web has come to. Has everyone decided it’s just easier to lie to clients, the general public and fellow developers? Or are the stakeholders so blind to technology that they insist on something that doesn’t even exist? Is it really so terrible to maintain a mobile version of your website along side a desktop version?

Rather than trying to make radical predictions and promises about the future of the web, maybe we should try educating clients about new technologies. Instead of shoving a round peg into a square hole, let’s create the solution that best fits the business needs. Lying today is only going to give technology a bad reputation in the future and hurt clients in the long run. It’s sad when an otherwise good book is poisoned by lies from the marketing team.

Here is a link to the book:
HTML5 Games Development by Example