Skip to content

Instantly share code, notes, and snippets.

@timkim
timkim / PGCamera_Canvas
Created May 15, 2012 19:44
Short example of how to get photo from PhoneGap Camera to canvas
// Note: have not tested this - but I think it should work!
function cameraWin(picture){
var theCanvas = document.getElementById('theCanvas');
var ctx = theCanvas.getContext('2d');
var theImage = new Image();
theImage.src = "data:image/jpeg;base64,"+picture;
ctx.drawImage(theImage, 0, 0);
@timkim
timkim / blackberry-webworks.md
Created February 28, 2012 23:45 — forked from mwbrooks/blackberry-webworks.md
Overview of PhoneGap BlackBerry WebWork - original revision by filmaj

BlackBerry WebWorks & PhoneGap

WebWorks is a BlackBerry SDK that leverages Web technologies to create applications for BlackBerry 5.0, 6.0, and QNX. An application that is built with WebWorks uses HTML, CSS, and JavaScript and is called a Web widget. The structure of the application is similar to a thick-client JavaScript Web application, where JavaScript manages the model, view, and logic.

WebWorks enhances the JavaScript API to allow any Web widget application to access any Blackberry Java API. RIM includes a small WebWorks JavaScript API that allows access to some BlackBerry device features, such as invoking third-party applications. However, more importantly, WebWorks allows developers to create an Java extension that binds JavaScript and Java. This means any Java API can be accessible to JavaScript.

The WebWorks SDK uses a command-line tool called bbwp.exe (Windows-only) to create a BlackBerry-compatible application binary (.cod). Since a WebWorks application is pa

@timkim
timkim / gist:1368596
Created November 15, 2011 22:35
Quick fix for scope
// Try setting var self = this in the init and using self.mouseX/self.mouseY in onMouseMove
GAME.Input = function ( parent ) {
this.game = parent;
this.oldMouseX = 0;
this.oldMouseY = 0;
this.mouseX = 0;
this.mouseY = 0;