Tarik Demirović / Mbed 2 deprecated PAI_Grupa1_Projekat_Pong

Dependencies:   N5110 mbed

Committer:
Vato
Date:
Thu Jun 05 17:37:09 2014 +0000
Revision:
0:a5f6ba8c378e
PAI Pong v1.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Vato 0:a5f6ba8c378e 1 #include "Loptica.h"
Vato 0:a5f6ba8c378e 2
Vato 0:a5f6ba8c378e 3 void Loptica::setX(int broj)
Vato 0:a5f6ba8c378e 4 {
Vato 0:a5f6ba8c378e 5 x = broj;
Vato 0:a5f6ba8c378e 6 }
Vato 0:a5f6ba8c378e 7
Vato 0:a5f6ba8c378e 8 void Loptica::setY(int broj)
Vato 0:a5f6ba8c378e 9 {
Vato 0:a5f6ba8c378e 10 y = broj;
Vato 0:a5f6ba8c378e 11 }
Vato 0:a5f6ba8c378e 12
Vato 0:a5f6ba8c378e 13 int Loptica::dajX()
Vato 0:a5f6ba8c378e 14 {
Vato 0:a5f6ba8c378e 15 return x;
Vato 0:a5f6ba8c378e 16 }
Vato 0:a5f6ba8c378e 17
Vato 0:a5f6ba8c378e 18 int Loptica::dajY()
Vato 0:a5f6ba8c378e 19 {
Vato 0:a5f6ba8c378e 20 return y;
Vato 0:a5f6ba8c378e 21 }
Vato 0:a5f6ba8c378e 22
Vato 0:a5f6ba8c378e 23 int Loptica::dajKorakX()
Vato 0:a5f6ba8c378e 24 {
Vato 0:a5f6ba8c378e 25 return x_korak;
Vato 0:a5f6ba8c378e 26 }
Vato 0:a5f6ba8c378e 27
Vato 0:a5f6ba8c378e 28 int Loptica::dajKorakY()
Vato 0:a5f6ba8c378e 29 {
Vato 0:a5f6ba8c378e 30 return y_korak;
Vato 0:a5f6ba8c378e 31 }
Vato 0:a5f6ba8c378e 32
Vato 0:a5f6ba8c378e 33 void Loptica::postaviKorak(int xKorak, int yKorak)
Vato 0:a5f6ba8c378e 34 {
Vato 0:a5f6ba8c378e 35 x_korak = xKorak;
Vato 0:a5f6ba8c378e 36 y_korak = yKorak;
Vato 0:a5f6ba8c378e 37 }
Vato 0:a5f6ba8c378e 38
Vato 0:a5f6ba8c378e 39 void Loptica::crtajLopticu(N5110 &display)
Vato 0:a5f6ba8c378e 40 {
Vato 0:a5f6ba8c378e 41 for(int i = -1; i < 2; i++)
Vato 0:a5f6ba8c378e 42 for(int j = -1; j < 2; j++)
Vato 0:a5f6ba8c378e 43 display.setPixel(x + j, y + i);
Vato 0:a5f6ba8c378e 44
Vato 0:a5f6ba8c378e 45 display.refresh();
Vato 0:a5f6ba8c378e 46 }
Vato 0:a5f6ba8c378e 47
Vato 0:a5f6ba8c378e 48 void Loptica::brisiLopticu(N5110 &display)
Vato 0:a5f6ba8c378e 49 {
Vato 0:a5f6ba8c378e 50 for(int i = -1; i < 2; i++)
Vato 0:a5f6ba8c378e 51 for(int j = -1; j < 2; j++)
Vato 0:a5f6ba8c378e 52 display.clearPixel(x + j, y + i);
Vato 0:a5f6ba8c378e 53
Vato 0:a5f6ba8c378e 54 display.refresh();
Vato 0:a5f6ba8c378e 55 }
Vato 0:a5f6ba8c378e 56
Vato 0:a5f6ba8c378e 57 void Loptica::osvjeziPoziciju()
Vato 0:a5f6ba8c378e 58 {
Vato 0:a5f6ba8c378e 59 x += x_korak;
Vato 0:a5f6ba8c378e 60 y += y_korak;
Vato 0:a5f6ba8c378e 61 }