programming for artists term 2 mfa computational studio arts starting to program for mobile phones

31
Programming For Artists Term 2 MFA Computational Studio Arts Starting to program for mobile phones

Upload: zachary-vaughan

Post on 28-Mar-2015

221 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Programming For Artists Term 2 MFA Computational Studio Arts Starting to program for mobile phones

Programming For ArtistsTerm 2

MFA Computational Studio Arts

Starting to program for mobile phones

Page 2: Programming For Artists Term 2 MFA Computational Studio Arts Starting to program for mobile phones

Where we are:

Week 7: 23rd group Tutorials/ intro to mobile programming /Nabil presentWeek 8: 2nd March Interim presentations/what is a methodology?Week 9: 9th group tutorials /parameters,documentation/research contextual references to discussWeek 10:16th group tutorials / discuss equipment needs/work on projects

Week 11 23rd Final presentation: Hand in work (and written work) Put all on web

Have you all put your project brief on the web?

Page 3: Programming For Artists Term 2 MFA Computational Studio Arts Starting to program for mobile phones

• No mouse input as such

• So much more reliance on keys

Page 4: Programming For Artists Term 2 MFA Computational Studio Arts Starting to program for mobile phones

• Very similar to Processing, some code differences

• Different ( and fewer libraries )

• Can you think of any significant differences between a phone and a computer/laptop ?

Crash introduction to mobile Processing

Page 5: Programming For Artists Term 2 MFA Computational Studio Arts Starting to program for mobile phones

Similar reference pages

Page 6: Programming For Artists Term 2 MFA Computational Studio Arts Starting to program for mobile phones

1. Download and install a Wireless Toolkit (WTK) for building mobile phone applications.

Windows: Sun Java Wireless Toolkit for CLDChttp://java.sun.com/products/j2mewtoolkit/

Mac OS X: Mpowerplayer SDKhttp://www.mpowerplayer.com/products-sdk.php

2. Note the location of the installation on your computer

How to install Mobile Processing:http://mobile.processing.org/

Page 7: Programming For Artists Term 2 MFA Computational Studio Arts Starting to program for mobile phones

3. Install Mobile Processinghttp://mobile.processing.org/download/index.php

Page 8: Programming For Artists Term 2 MFA Computational Studio Arts Starting to program for mobile phones

4 .Run Mobile Processing. Choose Preferences from the main drop-down menu. In the Preferences dialog box, go to the Mobile tab, and enter the location of the WTK.

Page 9: Programming For Artists Term 2 MFA Computational Studio Arts Starting to program for mobile phones

These are my settings in the preferences

Page 10: Programming For Artists Term 2 MFA Computational Studio Arts Starting to program for mobile phones

Phone profilesFind out about phones, which ones will work etc, go here:http://mobile.processing.org/phones/index.php

Page 11: Programming For Artists Term 2 MFA Computational Studio Arts Starting to program for mobile phones

The IDE should feel very familiar

Page 12: Programming For Artists Term 2 MFA Computational Studio Arts Starting to program for mobile phones

The main difference is that when you run a programIt takes a little bit longer to appear, and when it does you get …

Page 13: Programming For Artists Term 2 MFA Computational Studio Arts Starting to program for mobile phones

THIS!Here the emulator is indicating which key you should press tolaunch the program. A java mobile program is called a MIDlet a variation on the word applet.Instead of the window we get in a regular applet, mobile Processing generates an emulator.

p.s In the Sun Java toolkit IDE you can choose from various models of phone.There are also other good examples in the toolkit, including GPS examples

Page 14: Programming For Artists Term 2 MFA Computational Studio Arts Starting to program for mobile phones

The java toolkit is worth using as well…but it is more complex and not really like an IDE suchas BlueJ or Processing

Page 15: Programming For Artists Term 2 MFA Computational Studio Arts Starting to program for mobile phones
Page 16: Programming For Artists Term 2 MFA Computational Studio Arts Starting to program for mobile phones

Back in Mobile Processing…

Here I’ve pressed the key with 2 on it,This program displays the key,the keyCode,and the rawKeyCode.

The system variable keyCode is used to detect special keys such as the UP, DOWN, LEFT, or RIGHT The system variable key always contains the value of the most recently pressed key on the keyboard.

The system variable rawKeyCode represents the value of the last key pressed, as reported directly from the phone. This is useful when a phone has non-standard keys that do not map to characters (as with the key variable)

Page 17: Programming For Artists Term 2 MFA Computational Studio Arts Starting to program for mobile phones

// keycode// by Francis Li <http://www.francisli.com/>//// A simple key profiling example (and handy utility) that// shows the value of key presses as returned by the different// system variables in Mobile Processing- key, keyCode, // and rawKeyCode. This particular example runs on MIDP 2.0// phones only since it uses the Phone library to run// fullscreen. When running fullscreen, softkey buttons // return key events, but the values of the rawKeyCode for// softkey buttons are not defined in the MIDP standard- they// are not only different between manufacturers, but can even be// different between phones from the same manufacturer.//// Created 06 March 2008//import processing.phone.*;

Phone p;

PFont font;

void setup() { p = new Phone(this); p.fullscreen(); font = loadFont(FACE_PROPORTIONAL, STYLE_PLAIN, SIZE_LARGE); textFont(font); textAlign(CENTER); fill(0); noLoop();}

void draw() { background(255); text("Key:\n" + key + "\n\nkeyCode:\n" + keyCode + "\n\nrawKeyCode:\n" + rawKeyCode, 0, 0, width, height);}

void keyPressed() { redraw();}

This program is In the examples thatcome with mobileProcessing

Familiar code structure

Page 18: Programming For Artists Term 2 MFA Computational Studio Arts Starting to program for mobile phones

Simplest possible example.I will export it as a MIDlet andtransfer it to my phoneWhere I will then install it

Page 19: Programming For Artists Term 2 MFA Computational Studio Arts Starting to program for mobile phones

Exporting a MIDlet

To make your porgram work in a real mobile phone you need to export it, Use ‘Export MIDlet’.

you can also make a strange applet to put on the webthis will have the emulator in it, use export Applet.

These are the files I willput in my mobile phone’s folder.The folder I use on my phoneis called ‘games’.

Page 20: Programming For Artists Term 2 MFA Computational Studio Arts Starting to program for mobile phones

I use a cable to connect my phone to the computer via USBYou could also use Bluetooth to transfer the application to your phone, or upload it to the internet and download it through your phone's browser.

The cable works best for me…

Page 21: Programming For Artists Term 2 MFA Computational Studio Arts Starting to program for mobile phones

• I connect the phone and a dialogue on my phone opens • it says ‘file transfer’ I ignore it and use the folder window that opens as if it was a memory stick.

• I put the folder containing the MIDlet files (simple_example) into a folder called ‘other’ on my mobile phone.

• Then I disconnect the cable and find my way to the folder called ‘other’ on my phone.

• I find the simple_example folder.• When I click on it (it has the word ‘java’ beside it ).it asks me if I want to install, which I do.

• It asks me where I want to install it too, I can choose between a ‘games’ folder or a folder called ‘applications’.

• I choose to save it in the folder called ‘games’ . Then it asks me if I want to start my program.

• I confirm ‘yes’ and I soon see my red circle on the mobile phone screen !

Page 22: Programming For Artists Term 2 MFA Computational Studio Arts Starting to program for mobile phones

A game I made about Streatham high road

Page 23: Programming For Artists Term 2 MFA Computational Studio Arts Starting to program for mobile phones

My I Ching mobile phone program.I can click on the mobIChing.jadfile and it runs on my laptop as an Emulator, it’s also on my phone.

Page 24: Programming For Artists Term 2 MFA Computational Studio Arts Starting to program for mobile phones

‘throw’ will randomly generatea hexagram, I like the idea of combiningmobile phone technology and a divination system that is 5000 years old…..The idea is that clicking on ‘i’ will explain whatthe hexagram signifies, I’ve set up the structure todo this (on a rainy day….)

Page 25: Programming For Artists Term 2 MFA Computational Studio Arts Starting to program for mobile phones

Libraries for Mobile Processing:(growing)

Page 26: Programming For Artists Term 2 MFA Computational Studio Arts Starting to program for mobile phones

http://mobile.processing.org/learning/tutorials/index.php

Good place to start

Page 27: Programming For Artists Term 2 MFA Computational Studio Arts Starting to program for mobile phones

Does come with basic sound capabilitiesTry the useful sound example, includes midi and audio files

Page 28: Programming For Artists Term 2 MFA Computational Studio Arts Starting to program for mobile phones

Good examples…

Page 29: Programming For Artists Term 2 MFA Computational Studio Arts Starting to program for mobile phones

Etch-a-sketch?

Page 30: Programming For Artists Term 2 MFA Computational Studio Arts Starting to program for mobile phones

There aren’t that many books on mobile phone programmingavailable at the moment.This one is quite useful, as it accommodates beginners.

It’s available in paper and e versions

BUT SINCE I FIRST TAUGHT THIS CLASSMORE AND MORE INFO AVIALABLE NOW, especially for IPHONES

Page 31: Programming For Artists Term 2 MFA Computational Studio Arts Starting to program for mobile phones

Interim presentations next week