Audrey M. Roy

Art, design, Python, JavaScript, and general silliness 
Filed under

xui

 

Processing.js for mobile devices

I completely adore Processing.js, John Resig's port of the Processing graphics programming language to JavaScript.  Everything that guy creates is a treasure.  As you might know, he's also the creator of jQuery, which is one of my favorite things.

I've been thinking a lot about how Processing.js would be great for making mobile apps.  I guess there are a couple of possible approaches:

  • something analogous to PhoneGap that turns your Processing.js code into native graphical apps optimized for each mobile device
  • an ultra-lightweight, specially-optimized (if that's even possible) subset of the parts of Processing.js that are most interesting to mobile apps and/or games, analogous to XUI

There have been a couple other Processing ports, an iPhone version (wish I could find the source) and a Flash/ActionScript one

And why Processing.js rather than the original Processing?  Because then you could reuse the code on the web.

I have a special interest in making something like this, since it would simplify a lot of my current work.  If you're interested in collaborating with me on this or know of anyone who might be, let me know.

Filed under  //   JavaScript   jQuery   mobile   PhoneGap   Processing   Processing.js   XUI  
Posted by email 

Comments [0]

My Android math multiplier game

Here's a video of my Android game working on the G1.  Currently the game has no sound because there's a bug in my sound-playing code that makes the app crash.  Hopefully there will be boings whenever you click in the real version. 

I'm open to ideas about how to make better use of the Android's sensors in the app.  I was thinking that it could give you hints when you shake the phone.  E.g. all the multiples of 4 would fall to the left side when you shook it to the left (at a 20-point penalty). 

This is just the development version.  I'll announce it's real title when it's officially out, which is something new that I came up with last night.

  

Filed under  //   Android   games   PhoneGap   programming   projects   XUI  
Posted by Audrey M Roy 

Comments [4]

XUI notes: Removing all divs of a class

1:15pm:  I try removing all divs of class "choicebox".  Doesn't work.
x$('div.choicebox').each(function() {$x(this).remove()});

1:20pm: I study the jQuery docs.  x$('div.choicebox').each($x(this).remove());  Doesn't work; deletes more than I had bargained for.

1:23pm: x$('div.choicebox').remove();  Works.  Life doesn't have to be so complicated.

Filed under  //   JavaScript   programming   XUI  
Posted by email 

Comments [0]

XUI notes: jQuery-like text() function, and other undocumented functions

To get the text of a div with id "box", do this:
x$('#box').first().innerText;

I didn't see a first() in the XUI docs.  A look at xui-0.9.0.js shows this:
        first: function() {
            return this.elements[0];
        },

In addition, I noticed definitions for elements, each, find, extend.  There's lots of good undocumented stuff in there - poke around a bit.

Filed under  //   JavaScript   programming   XUI  
Posted by email 

Comments [0]

Progress on my first PhoneGap/XUI app

I'm making great progress with the app.  I wrote the code entirely from scratch tonight.  And the app mostly works now.  You click on boxes that match a specified condition to earn points.  The faster you do it, the more bonus points you get. 

I spent over an hour trying to figure out how to get the text from a DOM element with XUI.  It must be something like x$('#foo').text() or x$('#foo').html().nodeValue.  I tried a million things and couldn't figure it out.

I know that x$('#foo').html() returns a Javascript object because I printed it in an alert, but then I don't know what to do with the object.  If only I could run the app in Firefox and use Firebug, then I could inspect it.  I did try loading just the html file in Firefox and commenting out the link to phonegap.js, but that didn't work. 

Tomorrow:

  1. Figure out how to get the text of a DOM element with XUI.  Fill in the condition test that uses the text from the number box divs.
  2. Load state from somewhere (a text file?) upon app launch, and save it at the end of every level.
  3. Try to add some cute accelerometer-using feature to the app.
  4. Come up with a good name.  Firethink?  I don't know.  Something about speed/fire + math/thinking/mental workouts.

Filed under  //   Android   JavaScript   PhoneGap   programming   XUI  
Posted by email 

Comments [2]