dev builds
themes manual
device status forums
mailing lists
IRC bugs
dev guide

Rockbox mail archive

Subject: Re: snow screensaver
From: Itai (
Date: 2002-08-29

works fine for me....
I did got that top line you mention, but that was before I added the two
last condiotions to particle_exists (to check if a particle has gone out
of the screen)

anyways, I have changed my code according to the conventions, and maybe
with shorter lines it'll work (who knows.)

bottom line - works fine for me......

Robert Hak wrote:

>I have played with this and like it.
>However, when run, you get a build up of pixels on the very top most line
>of the screen. (i can get you a screen shot if you like)
>In additions, when you write the code, please try and keep the line
>lengths under 80 chars, and avoid putting the if clause's on the same
>if(true) i++;
>should be
> i++;
>On Wed, 28 Aug 2002, Itai wrote:
>a screen saver (for the recorder, duh) that simulates snow/dust/small
>particles going down the screen

snow screen saver

by Itai Shaked

#include "lcd.h"
#include "config.h"
#include "kernel.h"
#include "menu.h"
#include "button.h"
#include <stdlib.h>

short particles[2000][2];

bool particle_exists (int particle) {
    if (particles[particle][0]>=0 && particles[particle][1]>=0 &&
        particles[particle][0]<=111 && particles[particle][1]<=63)
            return true;
    else return false;

int create_particle (void) {
    int i;
    for (i=0; i<1500; i++) {
        if (!particle_exists(i)) {
            return i;
    return -1;

void snow_move(void) {
    int i;
    if (!(rand()%2)) create_particle();
    for (i=0; i<2000; i++) {
        if (particle_exists(i)) {
            switch ((rand()%5)) {
                case 0:
                case 1:
                case 2:
        if (particle_exists)

void snow_init(void) {
    int i;
    for (i=0; i<2000; i++) {

Menu snow (void) {
    while (1) {
        if (button_get(false)==BUTTON_OFF) return MENU_OK;

Page was last modified "Jan 10 2012" The Rockbox Crew