I REWROTE THE PROGRAM USING PROCESSING FOR ANDROID (took NO-TIME whatsoever)


Original post here: http://doesitpew.blogspot.com/2011/06/android-business-card-program-moving-to.html

Now, you can use the basic code to make your own simple business card program by replacing my info with yours.

I made the sections really easy so all you have to do is add your own icon pictures and links. I made this template because of people I know wanting to be able to do it themselves and its an easy intro to programming as well as using the Processing core. When you get more advanced, you can bring the Processing core into Eclipse and have more fun. It simplifies intro Android programming for non-programmers to get in the game!

[CODE]
/*

Written by and for STACY DEVINO
doesitpew.blogspot.com
stacydevino@gmail.com


***Re-written in Processing for Android for ease of re-use by others in September 2011.***
http://wiki.processing.org/w/Android
^ All instructions are above!!!!


This program serves as a unique calling card for those looking for something beyond cardboard.
*/


//////////////////////////////////////////////////////////////////
//****************************************************************
// PAY ATTENTION HERE – ADD THE LINKS FOR YOUR PAGES!!!!!
//****************************************************************
//////////////////////////////////////////////////////////////////
String your_Blog = ;        //make sure that this is a LINK
String your_Facebook = ;    //make sure that this is a LINK
String your_Name = ;        //make sure that this is a LINK
String your_Twitter = ;     //make sure that this is a LINK
String your_LinkedIn = ;    //make sure that this is a LINK
String your_CoverLetter = ; //make sure that this is a LINK
String your_Resume = ;      //make sure that this is a LINK


//LOGIC FOR BUTTONS AND ACTIONS
//*dont touch unless you know how to code
boolean blog = false;
boolean linked = false;
boolean fb = false;
boolean twit = false;
boolean ok = false;
boolean res = false;
boolean qual = false;
boolean cl = false; 
boolean rfid = false;
boolean hifi = false;
boolean ch = false;
boolean sensor = false;
boolean splash = false;
boolean ipod = false;
boolean evo = false;
boolean zoe = false;
boolean game = false;
boolean speak = false;
boolean eb = false;
boolean main = false;


// IMAGE NAMES!!!!!!
PImage b;
PFont font;
PImage blogger;
PImage in;
PImage facebook;
PImage twitter;
PImage projects;
PImage resume;
PImage cube;
PImage cover;
PImage q;
PFont ffont;
PImage menu;


/////////////////////////////////////////
// SET UP ALL PICTURES
////////////////////////////////////////
//////////////////////////////////////////////////////////////////
//****************************************************************
// PAY ATTENTION HERE – ADD THE PICS FOR YOUR PAGES!!!!!
//****************************************************************
//////////////////////////////////////////////////////////////////
void setup(){
   
  b = loadImage(“mio.jpg”); //Picture of yourself or whatever
  
  //Find your own 128×128 pictures (PNG is Better) for your icons and put the names here
  blogger = loadImage(“128×128.png”);
  in = loadImage(“128×128.png”);
  //cube = loadImage(“Cube.png”); // This would be a background picture
  facebook = loadImage(“128×128.png”);
  twitter = loadImage(“128×128.png”);
  projects = loadImage(“128×128.png”);
  resume = loadImage(“128×128.png”);
  menu = loadImage(“128×128.png”);
  cover = loadImage(“128×128.png”);
  q = loadImage(“128×128.png”); 



///////////////////////////////////////////
// HOME PAGE RETURN
//////////////////////////////////////////
void home(){
  
  if(ok == true || res == true){
         
          res = false; 
          cl = false;
          qual = false; 
          rfid = false;
          hifi = false;
          ch = false;
          sensor = false;
          splash = false;
          ipod = false;
          evo = false;
          zoe = false;
          game = false;
          speak = false;
          eb = false;
          ok = false;
  }
}


//////////////////////////////////////////////
// MAIN LOOP
/////////////////////////////////////////////
void draw(){
  if(res == false || ok == false){
  background(0);
  //image(cube, 0, 0);
  font = loadFont(“OldDreadfulNo7BT-Regular-48.vlw”); 
  textFont(font, 48); 
  text(your_Name, 45, 75);
  image(b, 110, 120);
  image(blogger, 30, 470);
  image(in, 170, 470);
  image(facebook, 320, 470);
  image(twitter, 30, 625);
  image(projects, 170, 625);
  image(resume, 320, 625);
  
  // Left button
  if (blog == true) { 
    link(your_Blog);
    blog = false; 
  }
  else if (linked == true) { 
    link(your_LinkedIn);
    linked = false;
  }
  else if (fb == true) { 
    link(your_Facebook);
    fb = false;
  }
  else if (twit == true) { 
    link(your_Twitter);
    twit = false;
  }
  }
  if (res == true) { 
    image(cube, 0, 0);
    image(cover, 50, 100);
    image(q, 170, 100); 
    ffont = loadFont(“Vrinda-32.vlw”); 
    textFont(ffont, 32);
    
    ///////////////////////////////////////////////////////
    //ENTER YOUR COVER LETTER AND PERSONAL INFORMATION HERE!
    ///////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
//****************************************************************
// PAY ATTENTION HERE
//****************************************************************
//////////////////////////////////////////////////////////////////
    text(“NAME HERE”, 50, 275);
    text(“EMAIL HERE”, 50, 325);
    text(“PHONE HERE”, 50, 375);
    text(“CONTACT LINE”, 50, 425);
    text(“BLOG HERE”, 50, 475);
    text(“WEBPAGE HERE”, 50, 525);
    text(“AKA HERE”, 50, 575);
    //Resume and Cover Letter links
    if (qual == true){
      link(your_Resume);
      qual = false;
      res = false;
    }
    else if (cl == true){
       link(your_CoverLetter);  
       cl = false;
       res = false;
    }
    image(menu, 170, 680);
  }
 if (ok == true){
   image(cube, 0, 0);
   font = loadFont(“OldDreadfulNo7BT-Regular-48.vlw”); 
   textFont(font, 48);
  //ENTER THE PAGE NAME YOU WANT 
   text(“PAGE_NAME”, 20, 75);
   ffont = loadFont(“Vrinda-32.vlw”); 
   textFont(ffont, 32);
   

  //////////////////////////////////////////////////////////
   // ENTER THE NAMES AND LINKS THAT YOU WANT YOUR PROJECT TO USE
   //////////////////////////////////////////////////////////
   //////////////////////////////////////////////////////////////////
//****************************************************************
// PAY ATTENTION HERE – ADD THE LINKS and NAMES FOR YOUR PROJECTS!!!!!
//****************************************************************
//////////////////////////////////////////////////////////////////
   text(“PROJECT NAME”, 50, 175);
   if( rfid == true){
    link(“PROJECTLINK.html”);
    rfid = false; 
    ok = false;
   }
   text(“PROJECT NAME”, 50, 225);
   if( hifi == true){
    link(“PROJECTLINK.html”);
    hifi = false; 
    ok = false;
   }
   text(“PROJECT NAME”, 50, 275);
   if( ch == true){
    link(“PROJECTLINK.html”);
    ch = false; 
    ok = false;
   }
   text(“PROJECT NAME”, 50, 325);
   if( sensor == true){
    link(“PROJECTLINK.html”);
    sensor = false; 
    ok = false;
   }
   text(“PROJECT NAME”, 50, 375);
   if( splash == true){
    link(“PROJECTLINK.html”);
    splash = false; 
    ok = false;
   }
   text(“PROJECT NAME”, 50, 425);
   if( ipod == true){
    link(“PROJECTLINK.html”);
    ipod = false; 
    ok = false;
   }
   text(“PROJECT NAME”, 50, 475);
   if( evo == true){
    link(“PROJECTLINK.html”);
    evo = false; 
    ok = false;
   }
   text(“PROJECT NAME”, 50, 525);
   if( zoe == true){
    link(“PROJECTLINK.html”);
    zoe = false; 
    ok = false;
   }
   text(“PROJECT NAME”, 50, 575);
   if( game == true){
    link(“PROJECTLINK.html”);
    game = false; 
    ok = false;
   }
   text(“PROJECT NAME”, 50, 625);
   if( speak == true){
    link(“PROJECTLINK.html”);
    speak = false; 
    ok = false;
   }
   text(“I AM 8-BIT”, 50, 675);
   if( eb == true){
    link(“PROJECTLINK.html”);
    eb = false; 
    ok = false;
   }
   image(menu, 170, 680);
 } 
}
///////////////////////////////////////////////////////////////////
//*don’t touch unless you need to change where it sees the clicks
//////////////////////////////////////////////////////////////////
void keyPressed(){
    // doing other things here, and then:
   if (key == CODED && keyCode == BACK && (res == true ||ok == true)) {
     keyCode = 0;
     println(res);
     println(ok);
      if(res == true) {
        // you’ll need to set keyCode to 0 if you want to prevent quitting (see above)
          res = false; 
          cl = false;
          qual = false; 
      }
      else if (ok == true) {
        // you’ll need to set keyCode to 0 if you want to prevent quitting (see above)
          rfid = false;
          hifi = false;
          ch = false;
          sensor = false;
          splash = false;
          ipod = false;
          evo = false;
          zoe = false;
          game = false;
          speak = false;
          eb = false;
          ok = false;
      }
    }
  }
void mousePressed(){


  if (mouseX > 20 && mouseX < 150 && mouseY > 470 && mouseY < 600 && res == false && ok == false) {
    blog = true;   
  } 
  else if (mouseX > 160 && mouseX < 300 && mouseY > 470 && mouseY < 600 && res == false && ok == false) {
    linked = true;   
  } 
  else if (mouseX > 310 && mouseX < 450 && mouseY > 470 && mouseY < 600 && res == false && ok == false) {
    fb = true;   
  } 
  else if (mouseX > 20 && mouseX < 150 && mouseY > 610 && mouseY < 760 && res == false && ok == false) {
    twit = true;   
  } 
  else if (mouseX > 160 && mouseX < 300 && mouseY > 610 && mouseY < 760 && res == false) {
    ok = true;
  } 
  else if (mouseX > 310 && mouseX < 450 && mouseY > 610 && mouseY < 760 && ok == false) {
    res = true;
  } 
  else if (res == true && mouseX > 20 && mouseX < 150 && mouseY > 100 && mouseY < 220 ) {
    cl = true;
  }
  else if (res == true && mouseX > 160 && mouseX < 350 && mouseY > 100 && mouseY < 220 ) {
    qual = true;
  }
  else if (ok == true &&  mouseY > 135 && mouseY < 174 ) {
    rfid = true;
  }
  else if (ok == true &&  mouseY > 175 && mouseY < 220 ) {
    hifi = true;
  }
  else if (ok == true && mouseY > 225 && mouseY < 274 ) {
    ch = true;
  }
  else if (ok == true &&  mouseY > 275 && mouseY < 324 ) {
    sensor = true;
  }
  else if (ok == true && mouseY > 325 && mouseY < 374 ) {
    splash = true;
  }
  else if (ok == true &&  mouseY > 375 && mouseY < 424 ) {
    ipod = true;
  }
  else if (ok == true && mouseY > 425 && mouseY < 474 ) {
    evo = true;
  }
  else if (ok == true &&  mouseY > 475 && mouseY < 524 ) {
    zoe = true;
  }
  else if (ok == true && mouseY > 525 && mouseY < 574 ) {
    game = true;
  }
  else if (ok == true && mouseY > 575 && mouseY < 624 ) {
    speak = true;
  }
  else if (ok == true && mouseY > 625 && mouseY < 674 ) {
    eb = true;
  }
  else if ( mouseY > 675 && (ok == true || res == true)) {
    home();
  } 
  
  else {
    linked = fb = twit = false;
  }
}
[/CODE]


0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *