You are not logged in.
Hi,
I was wondering what the fastest way is to draw the entire screen because I'm trying to see if I can make my 'plasma' program faster.
Right now I'm drawing my screen with a nested loop like this:
for(y=0;y<480;y++){ for(x=0;x<640;x++){ Draw Pixels (x,y,colours) } }
I came up with one idea which works pretty cool. I increase the step of each loop, and draw a rectangle instead of a pixel. It works great but it makes the screen kind of 'blocky'. I wrote something like this:
for(y=0;y<480;y+=box_size){ for(x=0;x<640;x+=box_size){ GRRLIB_Rectangle(x*box_size,box_size,y*box_size,box_size,colours,1); } }
I'm still learning 'C', but just wondered if there was a better, faster way to draw to the screen.
Thanks!
Tribasic
Offline
tribasic wrote:
I was wondering what the fastest way is to draw the entire screen because I'm trying to see if I can make my 'plasma' program faster.
Use this:
GRRLIB_FillScreen(colours);
Offline
Just in case you need some nice colors for your screen:
// RGBA Colors #define GRRLIB_BLACK 0x000000FF #define GRRLIB_MAROON 0x800000FF #define GRRLIB_GREEN 0x008000FF #define GRRLIB_OLIVE 0x808000FF #define GRRLIB_NAVY 0x000080FF #define GRRLIB_PURPLE 0x800080FF #define GRRLIB_TEAL 0x008080FF #define GRRLIB_GRAY 0x808080FF #define GRRLIB_SILVER 0xC0C0C0FF #define GRRLIB_RED 0xFF0000FF #define GRRLIB_LIME 0x00FF00FF #define GRRLIB_YELLOW 0xFFFF00FF #define GRRLIB_BLUE 0x0000FFFF #define GRRLIB_FUCHSIA 0xFF00FFFF #define GRRLIB_AQUA 0x00FFFFFF #define GRRLIB_WHITE 0xFFFFFFFF
Offline
You can use any HTML colour palette - google with return LOTS of hits
just add FF to the end of the colour if you want it to be solid/completely-opaque, or a lower (hex) number if you want it to be see-through/translucent
BC
Offline