void Graphics::PlotGradientLine(HDC hdc, const Color& cl, const Color& cr, float zl, float zr, float ul, float ur, float vl, float vr, float xl, float xr, int y, const Texture& texture) { ColorDiff dc = (cr - cl) / (xr - xl); float dz = (zr - zl) / (xr - xl); float du = (ur - ul) / (xr - xl); float dv = (vr - vl) / (xr - xl); Color ci = cl; float ui = ul, vi = vl; float zi = zl; for (int xi = (int)floorf(xl); xi < (int)ceilf(xr); ++xi) { Color textel = ci; if (ui >= 0 && vi >= 0) textel *= texture.Rgb(ui / zi, vi / zi); PlotPixel(hdc, xi, y, Round2Integer(zl), textel); ci += dc; zi += dz; ui += du; vi += dv; } }
//////////////////////////////////////////////////////////// // Draw Tetris Title //////////////////////////////////////////////////////////// void DrawTitleDown(int y_cur) { int x, y; int y_start_in_image; int y_start_in_screen = 0; int width, y_temp; // For performance y_start_in_image = TETRIS_TITLE_HEIGHT - y_cur; if(y_start_in_image < 0) { y_start_in_screen = 0-y_start_in_image; y_start_in_image = 0; } EraseScreenNoFlip(); width = TETRIS_TITLE_WIDTH / 2; for(y = y_start_in_image; y < TETRIS_TITLE_HEIGHT; y++) { y_temp = (y - y_start_in_image) + y_start_in_screen; for(x = 0; x < width; x++) { PlotPixel(x+10,y_temp, tetrisTitleData[(y*width)+x]); } } WaitForVblank(); Flip(); }
void DrawBox(unsigned char x1, unsigned char y1, unsigned char x2, unsigned char y2, unsigned char* buffer, char color) { DrawLine(x1, y1, x2, y1, buffer, color); DrawLine(x1, y1, x1, y2, buffer, color); DrawLine(x2, y1, x2, y2, buffer, color); DrawLine(x1, y2, x2, y2, buffer, color); PlotPixel(x1, y1, buffer, color); }
//////////////////////////////////////////////////////////// // Clear PRESS START image from screen //////////////////////////////////////////////////////////// void ClearPressStart() { int x, y; for(y = 0; y < TETRIS_TITLE_PRESS_START_HEIGHT; y++) { for(x = 0; x < TETRIS_TITLE_PRESS_START_WIDTH/2; x++) { PlotPixel(x+38,y+115,0x00); } } WaitForVblank(); Flip(); }
//////////////////////////////////////////////////////////// // Draw PRESS START image to screen //////////////////////////////////////////////////////////// void DrawPressStart() { int x, y; for(y = 0; y < TETRIS_TITLE_PRESS_START_HEIGHT; y++) { for(x = 0; x < TETRIS_TITLE_PRESS_START_WIDTH/2; x++) { PlotPixel(x+38,y+115,tetrisTitlePressStartData[(y*TETRIS_TITLE_PRESS_START_WIDTH/2)+x]); } } WaitForVblank(); Flip(); }
//컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 //Procedure HardPrim::ClearScreen //------------------------------------------------------------------------------ //Author Paul. //Date Mon 3 Jul 1995 //Modified // //Description // //Inputs // //Returns // //Externals //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ void Display::ClearScreen(short colour) { short wx1,wx2,wy1,wy2; short w,h; wx1 = PhysicalMinX; wx2 = wx1 + PhysicalWidth; wy1 = PhysicalMinY; wy2 = wy1 + PhysicalHeight; for(h=wy1;h<wy2;h++) for(w=wx1;w<wx2;w++) PlotPixel(w,h,Colour(colour)); }