Advertisement
Guest User

Untitled

a guest
Dec 14th, 2016
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.53 KB | None | 0 0
  1. //Sterling Mahoney
  2. //Programming for Visual Artists Final
  3. //Please don't be disappointed in me, Steve.
  4. //I'M TRYING MY BEST
  5.  
  6. //NOTES FOR WHEN YOU COME BACK TO THIS:
  7. //YOU'RE WORKING ON THE FATALERROR
  8. //TEXT ANIMATIONS WON'T APPEAR
  9. //TRY AND GET SKETCH TO REDRAW
  10. //GOTTA GET THAT BLACK BOX OVER THE PASSWORD TEXT TOO
  11.  
  12. //initialize startscreen
  13. startScreen s1 = new startScreen();
  14. //initialize welcomescreen
  15. welcomeScreen w1 = new welcomeScreen();
  16. //initalize password function
  17. password text = new password();
  18. //cover over password text
  19.  
  20. //initialize popup
  21. popUp p1 = new popUp();
  22. //penultimate page
  23. endScreen e = new endScreen();
  24. //Final event
  25. fatalError f = new fatalError();
  26.  
  27.  
  28.  
  29. String words = "USERNAME:";
  30. String asterisk = "PASSWORD:";
  31.  
  32. //Set up millis for timing
  33. int time = millis();
  34. int timer = millis();
  35. int t = millis();
  36.  
  37. //count them enter hits
  38. int counter = 0;
  39.  
  40. //I just have the number 50 a lot
  41. int x = 50;
  42.  
  43. void setup() {
  44. fullScreen(P2D);
  45.  
  46. background (0);
  47. textSize (20);
  48. fill (0, 234, 0); //Beep boop, computer green!
  49. } //setup
  50.  
  51. void draw() {
  52. //start screen
  53. if (counter == 0) {
  54. time = 0;
  55. s1.initialize();
  56. } // if s1
  57.  
  58. //welcome screen
  59. if (counter == 1) {
  60. background (0);
  61. w1.initialize();
  62. } // if w1
  63.  
  64. //password start
  65. if (counter == 2) {
  66. text.initialize();
  67. } //if counter 2
  68.  
  69.  
  70. //WARNING POP-UPS ~ THIS WILL GET MESSY
  71. if (counter == 3) {
  72. p1.warning1();
  73. text.initialize();
  74. if (counter == 4) {
  75. fill (0);
  76. rect (0, 215, 2500, 35);
  77. }
  78. } //if counter 3
  79.  
  80. if (counter == 4) {
  81. p1.warning2();
  82. text.initialize();
  83. if (counter == 5) {
  84. fill (0);
  85. rect (0, 215, 2500, 25);
  86. }
  87. }
  88.  
  89. if (counter == 5) {
  90. p1.warning3();
  91. text.initialize();
  92. if (counter == 6) {
  93. fill (0);
  94. rect (0, 215, 2500, 25);
  95. }
  96. }
  97.  
  98. if (counter == 6) {
  99. p1.warning4();
  100. text.initialize();
  101. if (counter == 7) {
  102. fill (0);
  103. rect (0, 215, 2500, 25);
  104. }
  105. }
  106. if (counter == 7) {
  107. p1.warning5();
  108. text.initialize();
  109. }
  110. if (counter == 8) {
  111. p1.warning6();
  112. text.initialize();
  113. }
  114. if (counter == 9) {
  115. p1.warning7();
  116. text.initialize();
  117. }
  118. if (counter == 10) {
  119. p1.warning8();
  120. text.initialize();
  121. }
  122. if (counter == 11) {
  123. p1.warning9();
  124. text.initialize();
  125. }
  126. if (counter == 12) {
  127. p1.warning10();
  128. text.initialize();
  129. }
  130. if (counter == 13) {
  131. p1.warning11();
  132. text.initialize();
  133. }
  134. if (counter == 14) {
  135. p1.warning12();
  136. text.initialize();
  137. }
  138. if (counter == 15) {
  139. p1.warning13();
  140. text.initialize();
  141. }
  142. if (counter == 16) {
  143. p1.warning14();
  144. text.initialize();
  145. }
  146. if (counter == 17) {
  147. p1.warning15();
  148. text.initialize();
  149. }
  150. if (counter == 18) {
  151. p1.warning16();
  152. text.initialize();
  153. }
  154. if (counter == 19) {
  155. p1.warning17();
  156. text.initialize();
  157. }
  158. if (counter == 20) {
  159. p1.warning18();
  160. text.initialize();
  161. }
  162. if (counter == 21) {
  163. p1.warning19();
  164. text.initialize();
  165. }
  166.  
  167. //endScreen
  168. if (counter == 22) {
  169. e.message();
  170. }
  171.  
  172. if (counter ==23) {
  173. f.colorFlash();
  174. f.errorRepeat();
  175. }
  176.  
  177. if (counter == 24) {
  178. //r.finalError ();
  179. //r.finish ();
  180. }
  181.  
  182. } //draw
  183.  
  184. void keyPressed() {
  185. if (key == ENTER) {
  186. counter=counter+1;
  187. } //if
  188. // The variable "key" always contains the value
  189. // of the most recent key pressed.
  190. if ((key >= 'A' && key <= 'z') || key == ' ') {
  191. words = words + key;
  192. } //if
  193. if (counter == 2) {
  194. key = '*';
  195. asterisk = asterisk + key;
  196. } //if
  197. } //keyPressed
  198.  
  199. //Screen following passwork
  200.  
  201. class endScreen {
  202.  
  203. void message(){
  204. background (0);
  205. t = 0;
  206. if (millis()- t > 1000){
  207. text(">PASSWORD MUST BE CHANGED EVERY FIVE CALENDAR DAYS",x,x);
  208. }
  209. if (millis()- t > 2000){
  210. text(">ALL NEW PASSWORDS MUST CONTAINS AT LEAST ONE CHARACTER, INTEGER AND SYMBOL",x,100);
  211. }
  212. if (millis()- t > 3000){
  213. text(">PASSWORD MUST BE CHANGED EVERY FIVE CALENDAR DAYS",x,150);
  214. }
  215. if (millis()- t > 4000){
  216. text(">AFTER TWO CONSECUTIVE UNSUCCESSFUL PASSWORD ATTEMPTS, THE ACCOUNT WILL BE REVOKED",x,200);
  217. }
  218. if (millis()- t > 5000){
  219. text(">PASSWORDS DEEMED NOT ROBUST ENOUGH BY THE COMPUTER’S ALGORITHM WILL BE REJECTED",x,250);
  220. }
  221. if (millis()- t > 6000){
  222. text(">WARNING: NEVER, EVER GIVE AWAY YOUR PASSWORD INFORMATION TO ANYONE, SPOUSE INCLUDED",x,300);
  223. }
  224. if (millis()- t > 6500){
  225. textSize (15);
  226. text(">PRESS ENTER",x,360);
  227. }
  228.  
  229.  
  230. } //message
  231. } //endScreen
  232.  
  233. //The final page that leads to the reset
  234.  
  235. class fatalError {
  236.  
  237. void colorFlash (){
  238. timer = 0;
  239.  
  240. rect (0, 0, 1000, 2000);
  241. fill (0);
  242.  
  243. if (millis()- timer > 1000){
  244. fill (0, 234, 0);
  245. }
  246. if (millis()- timer > 1100){
  247. fill (0);
  248. }
  249. if (millis()- timer > 1200){
  250. fill (0, 234, 0);
  251. }
  252. if (millis()- timer > 1300){
  253. fill (0);
  254. }
  255. } //colorFlash
  256.  
  257. void errorRepeat (){
  258.  
  259. if (millis()- timer > 1400){
  260. text(">ERROR", x, 25);
  261. }
  262. if (millis()- timer > 1500){
  263. text(">ERROR", x, 50);
  264. }
  265. if (millis()- timer > 1600){
  266. text(">ERROR", x, 100);
  267. }
  268. if (millis()- timer > 2000){
  269. text(">ERROR", x, 125);
  270. }
  271. if (millis()- timer > 2100){
  272. text(">ERROR", x, 150);
  273. }
  274. if (millis()- timer > 2200){
  275. text(">ERROR", x, 175);
  276. }
  277. if (millis()- timer > 2300){
  278. text(">ERROR", x, 200);
  279. }
  280. if (millis()- timer > 2450){
  281. text(">ERROR", x, 210);
  282. }
  283. if (millis()- timer > 2500){
  284. text(">ERROR", x, 250);
  285. }
  286. if (millis()- timer > 2800){
  287. text(">ERROR", x, 262);
  288. }
  289. if (millis()- timer > 2950){
  290. text(">ERROR", x, 300);
  291. }
  292. if (millis()- timer > 3000){
  293. text(">ERROR", x, 350);
  294. }
  295. if (millis()- timer > 3100){
  296. text(">ERROR", x, 400);
  297. }
  298. if (millis()- timer > 3200){
  299. text(">ERROR", x, 425);
  300. }
  301. if (millis()- timer > 3350){
  302. text(">ERROR", x, 450);
  303. }
  304. if (millis()- timer > 3500){
  305. text(">ERROR", x, 460);
  306. }
  307. if (millis()- timer > 3600){
  308. text(">ERROR", x, 475);
  309. }
  310. if (millis()- timer > 3650){
  311. text(">ERROR", x, 500);
  312. }
  313. if (millis()- timer > 3700){
  314. text(">ERROR", x, 550);
  315. }
  316. if (millis()- timer > 3800){
  317. text(">ERROR", x, 557);
  318. }
  319. if (millis()- timer > 3900){
  320. text(">ERROR", x, 600);
  321. }
  322. if (millis()- timer > 4000){
  323. text(">ERROR", x, 650);
  324. }
  325. if (millis()- timer > 4550){
  326. text(">ERROR", x, 675);
  327. }
  328. if (millis()- timer > 4600){
  329. text(">ERROR", x, 700);
  330. }
  331. if (millis()- timer > 4700){
  332. text(">ERROR", x, 725);
  333. }
  334. if (millis()- timer > 4850){
  335. text(">ERROR", x, 750);
  336. }
  337. if (millis()- timer > 4900){
  338. text(">ERROR", x, 775);
  339. }
  340. if (millis()- timer > 5000){
  341. text(">ERROR", x, 800);
  342. }
  343. if (millis()- timer > 5100){
  344. background (0);
  345. }
  346. } //error
  347.  
  348. } //fatalError
  349.  
  350. //FUN PASSWORD THING
  351.  
  352. class password {
  353.  
  354. void initialize(){
  355. textSize (20);
  356. fill (0, 234, 0);
  357. text(asterisk , x, 235);
  358. textSize (15);
  359. text("PRESS ENTER", x, 260);
  360. } //initialize
  361.  
  362. } //password
  363.  
  364. //Object where password errors popup!
  365. //Okay, so for them to work they each have to be their own function
  366. //I know, there's a way to do this with an array
  367. //I don't have the patience to figure that out
  368.  
  369. class popUp {
  370.  
  371. void warning1 (){
  372. textSize (15);
  373. if (counter == 3) {
  374. text(">PASSWORD MUST BE FOURTEEN OR MORE CHARACTERS LONG",x,325);
  375. }//if1
  376. } //warning1
  377. void warning2 (){
  378. textSize (15);
  379. if (counter == 4) {
  380. text(">PASSWORD MUST CONTAIN AT LEAST ONE UPPER-CASE AND ONE LOWER-CASE LETTER",x,350);
  381. }//if2
  382. } //warning2
  383. void warning3 (){
  384. textSize (15);
  385. if (counter == 5) {
  386. text(">PASSWORD MUST CONTAIN AT LEAST ONE NUMERAL",x,375);
  387. }//if3
  388. } //warning3
  389. void warning4 (){
  390. textSize (15);
  391. if (counter == 6) {
  392. text(">PASSWORD MUST CONTAIN ONE NON-ALPHANUMERIC CHARACTER",x,400);
  393. }//if4
  394. }//warning4
  395. void warning5 (){
  396. textSize (15);
  397. if (counter == 7) {
  398. text(">PASSWORD MUST NOT CONTAIN A SPACE",x,425);
  399. }//if5
  400. }//warning5
  401. void warning6 (){
  402. textSize (15);
  403. if (counter == 8) {
  404. text(">PASSWORD MUST CONTAIN INVALID CHARACTER, TABS OR LETTERS USING NON-ENGLISH DIACRITICAL OR ORTHOGRAPHICAL MARKS",x,450);
  405. }//if6
  406. }//warning6
  407. void warning7 (){
  408. textSize (15);
  409. if (counter == 9) {
  410. text(">PASSWORD MUST NOT CONTAIN FORWARD OR REVERSE FRAGMENTS OF FIVE OR MORE CHARACTER OF YOUR FIRST NAME, MIDDLE NAME OR LAST NAME, REGARDLESS OF THE CASE (UPPER OR LOWER) OF THE LETTER.",x,475);
  411. }//if7
  412. }//warning7
  413. void warning8 (){
  414. textSize (15);
  415. if (counter == 10) {
  416. text(">PASSWORD MUST NOT CONTAIN FORWARD OR REVERSE ALPHABETIC SEQUENCES OF FIVE OR MORE LETTERS, REGARDLESS OF THE CASE (UPPER OR LOWER) OF THE LETTER",x,500);
  417. }//if8
  418. }//warning8
  419. void warning9 (){
  420. textSize (15);
  421. if (counter == 11) {
  422. text(">PASSWORD NON-ALPHANUMERIC CHARACTERS MAY NOT BE ARRANGED IN ‘EMOTICON’ FORMAT, E.G. :), ;), <3",x,525);
  423. }//if9
  424. }//warning9
  425. void warning10 (){
  426. textSize (15);
  427. if (counter == 12) {
  428. text(">PASSWORD MUST NOT CONTAIN REPEATED CHARACTERS IN GROUPS OF THREE OR MORE E.G. AAA, 1111",x,550);
  429. }//if10
  430. }//warning10
  431. void warning11 (){
  432. textSize (15);
  433. if (counter == 13) {
  434. text(">PASSWORD MUST NOT CONTAIN MORE THAN TWO SEQUENTIAL CHARACTERS OF USER’S ACCOUNT NAME",x,575);
  435. }//if11
  436. }//warning12
  437. void warning12 (){
  438. if (counter == 14) {
  439. textSize (15);
  440. text(">PASSWORD MUST NOT CONTAIN MORE THAN TWO SEQUENTIAL CHARACTER OF LOG-IN ID",x,600);
  441. }//if12
  442. }//warning12
  443. void warning13 (){
  444. if (counter == 15) {
  445. textSize (15);
  446. text(">PASSWORD MUST NOT CONTAIN MORE THAN TWO SEQUENTIAL CHARACTERS OF EMAIL ADDRESS",x,625);
  447. }//if13
  448. }//warning13
  449. void warning14 (){
  450. textSize (15);
  451. if (counter == 16) {
  452. text(">PASSWORD MUST NOT CONTAIN MORE THAN TWO SEQUENTIAL CHARACTERS OF INITIALS",x,650);
  453. }//if14
  454. }//warning14
  455. void warning15 (){
  456. textSize (15);
  457. if (counter == 17) {
  458. text(">PASSWORD MUST NOT CONTAIN MORE THAN TWO SEQUENTIAL CHARACTERS OF FIRST, LAST OR MIDDLE NAME",x,675);
  459. }//if15
  460. }//warning15
  461. void warning16 (){
  462. textSize (15);
  463. if (counter == 18) {
  464. text(">PASSWORD MUST NOT CONTAIN MORE THAN THREE SEQUENTIAL NUMBERS OF USER’S BIRTH YEAR",x,700);
  465. }//if16
  466. }//warning 16
  467. void warning17 (){
  468. textSize (15);
  469. if (counter == 19) {
  470. text(">PASSWORD MUST NOT CONTAIN MORE THAN THREE SEQUENTIAL CHARACTERS OF USER’S BIRTH DATE DD/MM/YYYY OR MM/DD/YYYY FORMAT",x,725);
  471. }//if17
  472. }//warning17
  473. void warning18 (){
  474. textSize (15);
  475. if (counter == 20) {
  476. text(">PASSWORD MUST NOT CONTAIN ANY COMMON WORDS OR PROPER NAMES OF FIVE OR MORE CHARACTERS, REGARDLESS OF CASE (UPPER OR LOWER) OF THE LETTERS",x,750);
  477. }//if18
  478. }//warning18
  479. void warning19 (){
  480. textSize (15);
  481. if (counter == 21) {
  482. textSize (20);
  483. text(">PASSWORD SET",0,825);
  484. text(">PRESS ENTER",0,850);
  485. }//if19
  486. }//warning19
  487.  
  488. }//popUp
  489.  
  490. class restart {
  491.  
  492. void finalError (){
  493. if (millis()- timer > 7000){
  494. text(">A FATAL ERROR HAS OCCURED", 0, x);
  495. text(">INITIALIZING SYSTEM REBOOT...", x, 100);
  496. }
  497. if (millis()- timer > 9000){
  498. background (0);
  499. }
  500. v//oid finish (){
  501. if (counter == 25) {
  502. redraw();
  503. } //if
  504. } //finish
  505.  
  506. } //restart
  507.  
  508. //Let's get ready to rumble
  509.  
  510. class startScreen {
  511.  
  512. void initialize() {
  513.  
  514. if (millis()- time > 2000){
  515. text(">STARTUP TEST (1.2)", x, x);
  516. } //if 2000
  517.  
  518. if (millis()- time > 3000){
  519. text(">RAM SIZE = 512K", x, 100);
  520. } //if 3000
  521.  
  522. if (millis()- time > 5000) {
  523. text(">BOOTING FROM FLOPPY", x, 150);
  524. } //if 5000
  525.  
  526. if (millis()- time > 5500){
  527. text(">BOOTING CPU", x, 200);
  528. } //if 5500
  529.  
  530. if (millis()- time > 6500){
  531. text(">PRESS ENTER", x, 250);
  532. } //if 5500
  533. } //void initialize
  534. } //class startScreen
  535.  
  536. // Welcome/main screen
  537.  
  538. class welcomeScreen {
  539.  
  540. void initialize() {
  541. textSize (20);
  542. if (millis()- time > 7500){
  543. text(">WELCOME TO YOUR NEW COMPUTER", 0, x);
  544. }
  545. if (millis()- time > 9000){
  546. text(">TO ENSURE THE SECURITY OF YOUR FILES WE ASK YOU TO CREATE A USERNAME AND PASSWORD", x, 100);
  547. }
  548.  
  549. if (millis()- time > 10500){
  550. textSize (15);
  551. text("PLEASE ENTER YOUR FIRST NAME", x, 150);
  552. textSize (20);
  553. text(words , x, 175);
  554. textSize (15);
  555. text("PRESS ENTER", x, 200);
  556. }
  557.  
  558. } //initialize
  559. } //welcomeScreen
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement