#31111 - ghostils - Tue Dec 07, 2004 11:52 pm
Ok so here we go.... I wrote some simple code to display a box with configurable border size.. However after I call it... if I exec any other code taht writes to video memory in MODE 3 the pixels blink... this includes single pixels or if I use my write_text function to show some text the text written blinks.. but nothing else... the Box with border and bg is fine......
The piece of commented code in the fill portion of the draw_box routine, if I set bgcolor == 0, then call draw_box then call othe routines to write vmem its fine.. it only seems if I write to all the video memory something is messed up and it won't let me overwrite other pixels? Do I have to redraw the whole screen each time?
Any ideas?
I'll post the code below for the draw_box routine.
Here are some of my test cases from my "main":
Thanks,
-ghost[iLs]
The piece of commented code in the fill portion of the draw_box routine, if I set bgcolor == 0, then call draw_box then call othe routines to write vmem its fine.. it only seems if I write to all the video memory something is messed up and it won't let me overwrite other pixels? Do I have to redraw the whole screen each time?
Any ideas?
I'll post the code below for the draw_box routine.
Code: |
void draw_box(int pos_x1, int pos_x2, int pos_y1, int pos_y2, int size_border, u16 fgcolor, u16 bgcolor, int bevel) { int x = 0, y = 0; //-Draw first line: for (y = pos_y1; y < pos_y1 + size_border; y++) { for (x = pos_x1 + size_border; x < pos_x2 - size_border; x++) { theVideoBuffer[ x + y * 240 ] = fgcolor; } } //-Draw 2nd line: for( y = pos_y1; y < pos_y2 - size_border; y++) { for(x = pos_x1; x < pos_x1 + size_border; x++) { theVideoBuffer[ x + y * 240 ] = fgcolor; } } //-Draw 3rd line: for(y = pos_y2 - size_border; y < pos_y2; y++) { for(x = pos_x1; x < pos_x2 - size_border; x++) { theVideoBuffer[ x + y * 240 ] = fgcolor; } } //x2->x2 * border, y1->y2 for (y = pos_y1; y < pos_y2; y++) { for(x = pos_x2 - size_border; x < pos_x2; x++) { theVideoBuffer[ x + y * 240 ] = fgcolor; } } //-Fill with bgcolor: x1 + border to x2 - border y1 + border -> y2 - border //-Why? //-if(bgcolor == 0) {return;} for(y = pos_y1 + size_border; y < pos_y2 - size_border; y++) { for(x = pos_x1 + size_border; x < pos_x2 - size_border; x++) { theVideoBuffer[ x + y * 240 ] = bgcolor; } } //-TODO: add bevel: } |
Here are some of my test cases from my "main":
Code: |
u16 fgcolor = RGB(31,31,31); u16 bgcolor = RGB(10,16,24); draw_box (0, 240, 0, 160, 3, fgcolor, 0, 1); mx = 10;my = 10; theVideoBuffer[ mx + my * 240 ] = RGB( 31, 31, 31 ); mx = 11;my = 10; theVideoBuffer[ mx + my * 240 ] = RGB( 31, 31, 31 ); mx = 12;my = 10; theVideoBuffer[ mx + my * 240 ] = RGB( 31, 31, 31 ); //WaitForVblank(); write_text("Whoops???\0",11,8,fgcolor, bgcolor); write_text("Whoops???\0",11,16,fgcolor, bgcolor); |
Thanks,
-ghost[iLs]