Tämä ohjelma piirtelee palloja Pokitton näytölle

Dependencies:   PokittoLib

Fork of Palloja by PokittoLuokka

Files at this revision

API Documentation at this revision

Comitter:
Pokitto
Date:
Wed Oct 10 07:56:32 2018 +0000
Commit message:
Alku

Changed in this revision

My_settings.h Show annotated file Show diff for this revision Revisions of this file
PokittoLib.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r c263b42ca99e My_settings.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/My_settings.h	Wed Oct 10 07:56:32 2018 +0000
@@ -0,0 +1,16 @@
+/* This is an example of how to set your own project settings 
+
+To use
+
+1. make a copy of this file by pressing right mouse button on top of this file 
+in the mbed online compiler, then choose "Clone"
+
+2. See that the copy is in the root of the project (where your main cpp files are), not inside the PokittoLib folder
+Drag & drop to move if needed
+
+3. rename the clone to "My_settings.h"
+
+*/
+
+#define PROJ_HIRES 0
+#define PROJ_ENABLE_SOUND 0
\ No newline at end of file
diff -r 000000000000 -r c263b42ca99e PokittoLib.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PokittoLib.lib	Wed Oct 10 07:56:32 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/Pokitto/code/PokittoLib/#123aefc978a7
diff -r 000000000000 -r c263b42ca99e main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Oct 10 07:56:32 2018 +0000
@@ -0,0 +1,25 @@
+#include "Pokitto.h" // liittää Pokitto-kirjaston ohjelman osaksi. Ps. "//" tarkoittaa kommenttia, ja sen perään voi kirjoittaa mitä vain 
+
+Pokitto::Core peli; // luodaan ohjelmaobjekti nimeltä "peli"
+
+// main on C kielen "pääfunktio" josta ohjelma aina alkaa
+
+int main () {
+    peli.begin(); // käynnistetään Pokitton näyttö ja muut toiminnot
+    peli.display.persistence=1; // käännetään näytön "pyyhkiytyminen" pois päältä
+    //Vastaus 3. asetetaan näkymättömäksi väriksi musta (0)
+    peli.display.invisiblecolor=0; 
+    
+    while (peli.isRunning()) { // while eli "kunnes" pyörii niin kauan kun Peli.isRunning = 1 
+        if (peli.update()) { // kun on tullut aika piirtää näyttö uudelleen           
+            peli.display.setColor(random(10)); // otetaan sattumanvarainen väri (random)
+            peli.display.fillCircle(random(110),random(88),random(20)); // piirretään ympyröitä näytölle satunnaisiin paikkohin ja satunnaisen kokoisina
+            // Vastaus 2. setCursor tehdään _ennen_ print komentoa
+            peli.display.setCursor(40,40);
+            // Vastaus 4. valitaan valkoinen (1) aktiiviseksi väriksi
+            peli.display.color = 1;
+            // Vastaus 1. kirjoitetaan oma nimi
+            peli.display.print("Pekka");
+            } 
+        }    
+}
\ No newline at end of file