Type Nappi Field x Field y Field w Field h Field txt As String EndType Function Nappi_Lisaa(x, y, w, h, txt$ = "") unappi.Nappi = New (Nappi) unappi\x = x unappi\y = y unappi\w = w unappi\h = h unappi\txt = txt EndFunction Function Nappi_Poista(pnappi$ = "") If pnappi = "" For nappula.Nappi = Each Nappi Delete nappula Next nappula Else For nappula.Nappi = Each Nappi If nappula\txt = pnappi Then Delete nappula Next nappula EndIf EndFunction Function Nappi_Piirra() //Otetaan vanha väri talteen r = getRGB(RED) g = getRGB(GREEN) b = getRGB(BLUE) For nappula.Nappi = Each Nappi If MouseX() > nappula\x And MouseX() < nappula\x + nappula\w And MouseY() > nappula\y And MouseY() < nappula\y + nappula\h Then For i = 0 To 10 x = 210 - i * 5 Color x, x, x Box nappula\x + i, nappula\y + i, nappula\w - i * 2, nappula\h - i * 2, 1 Next i Else For i = 0 To 10 x = 100 + i * 5 Color x, x, x Box nappula\x + i, nappula\y + i, nappula\w - i * 2, nappula\h - i * 2, 1 Next i EndIf //Tulostetaan nappulan teksti Color 0, 0, 0 CenterText nappula\x + nappula\w / 2, nappula\y + nappula\h / 2, nappula\txt, 2 Next nappula //Palautetaan vanha väri Color r, g, b EndFunction Function Nappi_Paivita$() 'Tarkistetaan, onko hiirellä edes klikattu If MouseHit(1) Then 'Käydään läpi kaikki nappulat For nappula.Nappi = Each Nappi If MouseX() > nappula\x And MouseX() < nappula\x + nappula\w And MouseY() > nappula\y And MouseY() < nappula\y + nappula\h Then Return nappula\txt EndIf Next nappula EndIf Return "" EndFunction