NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io


#include <SPFD5408_Adafruit_GFX.h>
#include <SPFD5408_Adafruit_TFTLCD.h>
#include <SPFD5408_TouchScreen.h>
#if defined(__SAM3X8E__)
#undef __FlashStringHelper::F(string_literal)
#define F(string_literal) string_literal
#endif


#define YP A3
#define XM A2
#define YM 9
#define XP 8


#define TS_MINX 164
#define TS_MINY 140
#define TS_MAXX 962
#define TS_MAXY 905


TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);

#define LCD_CS A3
#define LCD_CD A2
#define LCD_WR A1
#define LCD_RD A0
// optional
#define LCD_RESET A4


#define BLACK 0x0000 //RENKLER VE KODLARI
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define DARKRED 0x8B00
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
#define KOYUKIRMIZI 0x0033

Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);

#define BOXSIZE 40
#define PENRADIUS 3
int oldcolor, currentcolor,sc,v=0,pv=0,i=0,j=0;
float a=0.5;

void setup(void) {
Serial.begin(9600);
Serial.println(F("Paint!"));

tft.reset();



tft.begin(0x9341); // SDFP5408 EKRANININ AYARI

tft.setRotation(135);





// İlk Ekrannn

tft.fillScreen(RED);

bird(0);

tft.fillRect(0,20,tft.width(),3,BLACK);//TAVAN ŞERİT OYNAMA EKRANI
tft.fillRect(0,0,tft.width(),20,0xD78A);
tft.setTextColor(BLACK);
tft.setTextSize(3);
tft.print("FLAPPY BIRD V2");


tft.fillRect(0,tft.height()-33,tft.width(),8,0x3F30);
tft.fillRect(0,tft.height()-25,tft.width(),25,0xD78A);
tft.setCursor (60,tft.height()-20);
tft.setTextColor(BLUE);
tft.setTextSize(3);
tft.print("BURAK, SAMET");

tft.setCursor (30,135); //konumu
tft.setTextColor(0x0000);
tft.setTextSize(2);
tft.print("OYNAMAK ICIN DOKUN!!!");
waitOneTouch();

tft.fillScreen(RED); //OYNARKEN Kİ EKRAN
tft.fillRect(0,0,tft.width(),20,0x0000);//tavan ve
tft.fillRect(0,tft.height()-25,tft.width(),25,0x0000);//taban
bird(0);

pinMode(13, OUTPUT);
}

#define MINPRESSURE 10
#define MAXPRESSURE 1000

void loop()
{
digitalWrite(13, HIGH);
TSPoint p = ts.getPoint();
digitalWrite(13, LOW);

pinMode(XP, OUTPUT);
pinMode(XM, OUTPUT);
pinMode(YP, OUTPUT);
pinMode(YM, OUTPUT);

if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {


p.x = map(p.x, TS_MINX, TS_MAXX, 0, tft.width());

p.y = map(p.y, TS_MINY, TS_MAXY, 0, tft.height());;
if(p.x>0 && p.x<320 && p.y>0 && p.y<240)
{

j=j-5;


j=-8;

}
}
tft.fillRect(tft.width()-40-(i*2),20,20,50,BLACK);
tft.fillRect(tft.width()-40-(i*2),165,20,50,BLACK);
tft.fillRect(tft.width()-20-(i*2),20,20,50,RED);
tft.fillRect(tft.width()-20-(i*2),165,20,50,RED);
tft.fillRect(0,0,20,tft.height(),BLACK);
pv=v;
v=v+(4*a*j);
birdcyan(pv);
bird(v);
j++;

i++;

Serial.println(v);

if(i==141 &&( v<=120|| v>-34 ||(280-(2*i)<106 && 280-(2*i)>70 && 57+v>73 && 93+v<165 ) ))
i=0;
else if((v>=122 || v<(-34) || (280-(2*i)<106 && 280-(2*i)>70 &&( 57+v<73 || 93+v>165 )) && i<143 ))
{tft.fillScreen(RED);
tft.setCursor(tft.width()/3+36,tft.height()/2);
tft.setTextSize(2);
tft.println("Oyun Bitti!");
Serial.println("Oyun Bitti!");
i=500;}
else{}//a=0.4;
//}

}

// Wait one touch

TSPoint waitOneTouch() {

// wait 1 touch to exit function

TSPoint p;

do {
p= ts.getPoint();

pinMode(XP, OUTPUT);
pinMode(XM, OUTPUT);
pinMode(YP, OUTPUT);
pinMode(YM, OUTPUT);

} while((p.z < MINPRESSURE )|| (p.z > MAXPRESSURE));

return p;
}

void bird(int n) //Kusun kodları
{
tft.fillCircle(tft.width()/3,tft.height()/2-45+v, 18,WHITE);//KUS GOVDE
tft.drawCircle(tft.width()/3,tft.height()/2-45+v,18,BLACK);
tft.fillRect(tft.width()/3,tft.height()/2-40+v,20,7,YELLOW);
tft.drawRect(tft.width()/3,tft.height()/2-40+v,20,7,BLACK);
tft.fillRect(tft.width()/3,tft.height()/2-37+v,20,1,BLACK);
tft.fillCircle(tft.width()/3+7,tft.height()/2-54+v,7,WHITE);
tft.drawCircle(tft.width()/3+7,tft.height()/2-54+v,7,BLACK);
tft.fillCircle(tft.width()/3+7,tft.height()/2-54+v,2,BLACK);
tft.fillRect(tft.width()/3-23,tft.height()/2-45+v,18,7,KOYUKIRMIZI);
tft.drawRect(tft.width()/3-23,tft.height()/2-45+v,18,7,BLACK);
}
void birdcyan(int pv)
{
tft.fillCircle(tft.width()/3,tft.height()/2-45+pv,18,RED);//arkasını temizlemek
tft.drawCircle(tft.width()/3,tft.height()/2-45+pv,18,RED);
tft.fillRect(tft.width()/3,tft.height()/2-40+pv,20,7,RED);
tft.drawRect(tft.width()/3,tft.height()/2-40+pv,20,7,RED);
tft.fillRect(tft.width()/3,tft.height()/2-37+pv,20,1,RED);
tft.fillCircle(tft.width()/3+7,tft.height()/2-54+pv,7,RED);
tft.drawCircle(tft.width()/3+7,tft.height()/2-54+pv,7,RED);
tft.fillCircle(tft.width()/3+7,tft.height()/2-54+pv,2,RED);
tft.fillRect(tft.width()/3-23,tft.height()/2-45+pv,18,7,RED);
tft.drawRect(tft.width()/3-23,tft.height()/2-45+pv,18,7,RED);
}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.