Here is mine, it basically starts up with a loader, goes to terms of use screen and than goes to a screen where you can draw using a psp joystick while holding down a analog pin button:
to download tft library: sketch>include library> manage libraries>get tft.h and spi.h libraries
psp joystick x pin is analog pin 0
psp joystick y pin is analog pin 1
analog button pin is analog pin 5 with other contact on 5v pin
tft led pin on arduino pin 7 instead of 5v pin
sck pin 13
sda pin 11
a0 pin 9
reset pin 8
cs pin 10
gnd pin gnd
vcc 5v
#include <TFT.h>
#include <SPI.h>
int pushPin = 12; // potentiometer wiper (middle terminal) connected to analog pin 3
int xPin = 0;
int yPin = 1;
int x_old=0;
int y_old=0;
int x_current=0;
int y_current=0;
int xMove = 0;
int yMove = 0;
int valPush = HIGH; // variable to store the value read
int valX = 0;
int valY = 0;
int grid_size=10;
int center_pos=34;
int cs= 10;
int dc= 9;
int rst= 8;
int screenWidth=160;
int screenHeight=128;
int loader_width=0;
int timer=0;
int loader_done=0;
int license_start=0;
int draw_start=0;
TFT TFTscreen = TFT(cs, dc, rst);
void setup(){
pinMode(pushPin,INPUT);
Serial.begin(9600); // setup serial
digitalWrite(pushPin,HIGH);
pinMode(7, OUTPUT);
TFTscreen.begin();
TFTscreen.background(25, 1, 33);
TFTscreen.setTextSize(1);
}
void loop(){
timer++;
valX = analogRead(xPin); // read the x input pin
valY = analogRead(yPin); // read the y input pin
//Serial.println( String(xMove) + " " + String(yMove) + " " + valPush);
if(loader_done==0){
progressLoader();
}
if(license_start==1){
digitalWrite(7, LOW);
licensePage();
delay(1);
digitalWrite(7, HIGH);
delay(4900);
digitalWrite(7, LOW);
TFTscreen.background(0,0,0);
draw_start=1;
delay(30);
digitalWrite(7, HIGH);
}
if(draw_start==1){
drawPage();
}
}
int progressLoader(){
if(timer%3==0){
if(loader_width<screenWidth/1.7-5){
loader_width+=1;
}else{
loader_done=1;
license_start=1;
}
}
if(timer==5){
digitalWrite(7, HIGH);
}
if(loader_width<screenWidth/1.7-5){
TFTscreen.stroke(255, 255, 255);
TFTscreen.text("drawex",63, 50);
TFTscreen.rect((screenWidth/2)-((screenWidth/1.7)/2), (screenHeight/2)-((screenHeight/10)/2)+15, screenWidth/1.7, screenHeight/10);
TFTscreen.stroke(10, 110-(timer/180), 255);
TFTscreen.rect((screenWidth/2)-((screenWidth/1.7)/2)+3, (screenHeight/2)-((screenHeight/10)/2)+15+2, loader_width, screenHeight/10-4);
TFTscreen.stroke(255,255,255);
}
}
int licensePage(){
TFTscreen.background(0,0,0);
TFTscreen.stroke(255, 255, 255);
TFTscreen.text("drawex is a registered",13,30);
TFTscreen.text("video game by MangoWave,",9,40);
TFTscreen.text("it is unlawful to attempt",5,50);
TFTscreen.text("to clone or copy any",20,60);
TFTscreen.text("MangoWave digital goods.",9,70);
TFTscreen.text("MangoWave 2011-2018",24,screenHeight-10);
license_start=0;
}
int drawPage(){
if(analogRead(5)>500){
if(timer%60==0){
x_old=int(valX/grid_size);
y_old=int(valY/grid_size);
//Serial.println(String(x_old) + " " +String(y_old) + " " +String(xMove) + " " +String(yMove));
if(x_old<center_pos&&x_old>-1&&x_old<screenWidth&&xMove>0){
xMove--;
}
if(x_old>center_pos&&x_old>-1&&x_old<screenWidth+2&&xMove<screenWidth-1){
xMove++;
}
if(y_old<center_pos&&y_old>-1&&y_old<screenHeight+1&&yMove<screenHeight-1){
yMove++;
}
if(y_old>center_pos&&y_old>-1&&y_old<screenHeight+1&&yMove>0){
yMove--;
}
TFTscreen.point(xMove,yMove);
}
valPush = digitalRead(pushPin); // read the push button input pin
}
}