Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: PokittoLib
Fork of HelloWorld by
main.cpp@11:c956634c67cc, 2018-04-14 (annotated)
- Committer:
- Pokitto
- Date:
- Sat Apr 14 05:07:47 2018 +0000
- Revision:
- 11:c956634c67cc
- Parent:
- 5:c4a0391b43ac
- Child:
- 12:c006fae9f691
Initial
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Pokitto | 11:c956634c67cc | 1 | #include "Pokitto.h" // liittää Pokitto-kirjaston ohjelman osaksi. Ps. "//" tarkoittaa kommenttia, ja sen perään voi kirjoittaa mitä vain |
| Pokitto | 0:2d2a3994d55d | 2 | |
| Pokitto | 11:c956634c67cc | 3 | Pokitto::Core peli; // luodaan ohjelmaobjekti nimeltä "peli" |
| Pokitto | 11:c956634c67cc | 4 | |
| Pokitto | 11:c956634c67cc | 5 | // main on C kielen "pääfunktio" josta ohjelma aina alkaa |
| Pokitto | 0:2d2a3994d55d | 6 | |
| Pokitto | 0:2d2a3994d55d | 7 | int main () { |
| Pokitto | 11:c956634c67cc | 8 | peli.begin(); // käynnistetään Pokitton näyttö ja muut toiminnot |
| Pokitto | 11:c956634c67cc | 9 | peli.display.persistence=1; // käännetään näytön "pyyhkiytyminen" pois päältä |
| Pokitto | 11:c956634c67cc | 10 | |
| Pokitto | 11:c956634c67cc | 11 | while (peli.isRunning()) { // while eli "kunnes" pyörii niin kauan kun Peli.isRunning = 1 |
| Pokitto | 11:c956634c67cc | 12 | if (peli.update()) { // kun on tullut aika piirtää näyttö uudelleen |
| Pokitto | 11:c956634c67cc | 13 | peli.display.setColor(random(10)); // otetaan sattumanvarainen väri (random) |
| Pokitto | 11:c956634c67cc | 14 | peli.display.fillCircle(random(110),random(88),random(20)); // piirretään ympyröitä näytölle satunnaisiin paikkohin ja satunnaisen kokoisina |
| Pokitto | 0:2d2a3994d55d | 15 | } |
| Pokitto | 0:2d2a3994d55d | 16 | } |
| Pokitto | 0:2d2a3994d55d | 17 | } |
