Rockbox Development > Starting Development and Compiling

Changing background color

(1/3) > >>

jonashn:
Not sure if this is the right forum..

I've just begun to experiment with plugin-writing, and i've tried to change the background color like this:


--- Code: ---unsigned int a,b,c=0;
 Â   for(a=0;alcd_update();
 Â           }
 Â       }
 Â   
 Â   }    
--- End code ---

BUT it doesn't work. What is wrong?

Job Van Dam:
I know absolutely no C, I know PHP though. ;D

Shouldn't you clear_display then set_background? It seems like your setting the background then clearing it therefore getting rid of what you just did.

Aren't the loops just going to make the screen white?

You're also going to be updating the screen 255 times, is that normal?

Something tells me I'm in way over my head here...... I'm sorry. :-[

stripwax:
jonashn - are you running this in the sim or the real target?  if in the sim, it's (possible) that it executes the nested loops so quickly you don't actually see the background colour changing - as prev post says you just end up with white.  You could try doing an  rb->sleep(HZ/10)  to put a 1/10 sec pause in there each time round.

stripwax:
other alternative of course is that it's so slow you don't see it doing anything  ..  to loop through all colours would take 16million lcd updates and at 50fps that's nearly 4 days   ;D
If you do += 32 instead of ++ you ought to see something happen.
What target by the way?

jonashn:

--- Quote from: stripwax on February 21, 2007, 06:11:02 PM ---What target by the way?

--- End quote ---

Ipod Video.

And first i tried without clear_display, but that didn't worked.

And in the wiki it's quite unclear about _when_ it is required to lcd_update().

Job Van Dam> http://www.rockbox.org/twiki/bin/view/Main/HowtoWritePlugins says:  
--- Quote ---rb->lcd_clear_display();
This will clear the display, writing the background colour to the entire screen. Again, no input required, so it can just be called as is.

--- End quote ---

So when playing with background color like this i surely have to clear_display.

And for example

--- Code: ---    rb->lcd_set_backdrop(NULL);
 Â   rb->lcd_clear_display();
 Â   unsigned int a,b,c=0;
 Â   for(a=0;asleep(HZ/10);
 Â           }
 Â       }
 Â   
 Â   }
--- End code ---

Also won't work. It even don't clear the backdrop, altrough my rb->lcd_set_backdrop(NULL);

Navigation

[0] Message Index

[#] Next page

Go to full version