This is running 'Paint' at start

/*  Demo of draw circle's APP
    drawCircle(int poX, int poY, int r,INT16U color);
    fillCircle(int poX, int poY, int r,INT16U color);
*/

#include <stdint.h>
#include <TFTv2.h>
#include <SD.h>
#include <SPI.h>

#include <stdint.h>
#include <TouchScreen.h> 

#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) // mega
#define YP A2   // must be an analog pin, use "An" notation!
#define XM A1   // must be an analog pin, use "An" notation!
#define YM 54   // can be a digital pin, this is A0
#define XP 57   // can be a digital pin, this is A3 

#elif defined(__AVR_ATmega32U4__) // leonardo
#define YP A2   // must be an analog pin, use "An" notation!
#define XM A1   // must be an analog pin, use "An" notation!
#define YM 18   // can be a digital pin, this is A0
#define XP 21   // can be a digital pin, this is A3 

#else //168, 328, something else
#define YP A2   // must be an analog pin, use "An" notation!
#define XM A1   // must be an analog pin, use "An" notation!
#define YM 14   // can be a digital pin, this is A0
#define XP 17   // can be a digital pin, this is A3 

#endif

//Measured ADC values for (0,0) and (210-1,320-1)
//TS_MINX corresponds to ADC value when X = 0
//TS_MINY corresponds to ADC value when Y = 0
//TS_MAXX corresponds to ADC value when X = 240 -1
//TS_MAXY corresponds to ADC value when Y = 320 -1

#define TS_MINX 116*2
#define TS_MAXX 890*2
#define TS_MINY 83*2
#define TS_MAXY 913*2


// For better pressure precision, we need to know the resistance
// between X+ and X- Use any multimeter to read it
// The 2.8" TFT Touch shield has 300 ohms across the X plate
TouchScreen ts = TouchScreen(XP, YP, XM, YM);
int ColorPaletteHigh = 30;
int color = WHITE;  //Paint brush color
unsigned int colors[8] = {BLACK, RED, GREEN, BLUE, CYAN, YELLOW, WHITE, GRAY1};
boolean inPaint = false;

void setupPaint() {
  Tft.TFTinit();  //init TFT library
  //Draw the pallet
  for(int i = 0; i<8; i++)
  {
      Tft.fillRectangle(i*30, 0, 30, ColorPaletteHigh, colors[i]);
  }
      Tft.drawChar('<',0,280,4,BRIGHT_RED); 
      Serial.println("Paint Started..."); 
      inPaint = true; 
}

void setup()
{
    TFT_BL_ON;                                          //turn on the background light 
    Serial.begin(9600);
    Tft.TFTinit();                                      //init TFT library             
    Tft.fillCircle(200, 100, 30,RED);                   //center: (200, 100), r = 30 ,color : RED   
    Tft.drawChar('P',192,92,4,GREEN); 
    Serial.println("Button 1 drawn.");
    
    Tft.fillCircle(200, 200, 30,GREEN);                  //center: (200, 200), r = 30 ,color : BLUE 
    Tft.drawChar('L',192,192,4,RED); 
    Serial.println("Button 2 drawn.");  
    inPaint = false;

}

void loop()
{
// a point object holds x y and z coordinates
if (inPaint = false) {
    Point m = ts.getPoint();  
   
    m.x = map(m.x, TS_MINX, TS_MAXX, 0, 240);
    m.y = map(m.y, TS_MINY, TS_MAXY, 0, 320);
    
    // we have some minimum pressure we consider 'valid'
    // pressure of 0 means no pressing!
    if (m.z > __PRESURE) {
       Serial.print("X = "); Serial.print(m.x);
       Serial.print("\tY = "); Serial.print(m.y);
       Serial.print("\tPressure = "); Serial.println(m.z);
    }
    if (m.z > __PRESURE){
      if (m.x >=171 and m.x <= 221){
        if (m.y >=61 and m.y <= 116) {
          Serial.print("Button 1 pressed\n");
          setupPaint();
        }else {
          if (m.x >=171 and m.x <= 221){
           if (m.y >=160 and m.y <= 230) {
            Serial.print("Button 2 pressed\n");
            }
          }
            
           }
            Serial.print("Nopress\n");
      } else {
        Serial.print("Nopress\n");
      }
    }
    delay(100);
} else {
  // a point object holds x y and z coordinates.
    Serial.println("Paint running"); 
    Point p = ts.getPoint();

    //map the ADC value read to into pixel co-ordinates

    p.x = map(p.x, TS_MINX, TS_MAXX, 0, 240);
    p.y = map(p.y, TS_MINY, TS_MAXY, 0, 320);

    // we have some minimum pressure we consider 'valid'
    // pressure of 0 means no pressing!

    if (p.z > __PRESURE) {
        // Detect  paint brush color change
        if(p.y < ColorPaletteHigh+2)
        {
            color = colors[p.x/30];
        }
        else
        {
            Tft.fillCircle(p.x,p.y,2,color);
        }
    }
  }
}

/*********************************************************************************************************
  END FILE
*********************************************************************************************************/

Starts by running paint. This is with the ‘Touch LCD Shield N10DP’ from Maplin.
Any help?
P.S. I am a noob.

 if (inPaint = false)

= vs ==