Exemplo n.º 1
0
/*=========================================================================
// Name: DrawScene()
// Desc: Draws the whole scene!
//=======================================================================*/
static void DrawScene()
{
    char chScore[30],
         chLines[30],
         chLevel[30];

    /* Black background */
    SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0,0,0));
    DrawStars(); /* Starfield */

    if (bCrazy)
        WriteText(font, 250, 30+(boxdraw.box_x), "Cr4zY m0d3!"); /* woo hoo! */

    if (!bGameOver) {
        /* Draw border of the box */
        PutRect(boxdraw.box_x-5, boxdraw.box_y-5,
                boxdraw.box_width + 2*5, boxdraw.box_height + 2*5, 150,150,150);
        PutRect(boxdraw.box_x, boxdraw.box_y,
                boxdraw.box_width, boxdraw.box_height, 90,90,90);

        DrawCluster(); /* Draw cluster */
        sprintf(chScore, "%d", score);
        sprintf(chLines, "%d", lines);
        sprintf(chLevel, "%d", level);
        WriteText(font, 490, 80, "Score");  /*  Show SCORE */
        WriteText(font, 490, 105, chScore); 
        WriteText(font, 495, 180, "Next");  /*  Show NEXT piece */
        DrawNextPiece(490, 220);
        WriteText(font, 490, 350, "Lines"); /*  Show number of killed LINES */
        WriteText(font, 490, 375, chLines);
        WriteText(font, 95, 350, "Level");  /*  Show current LEVEL */
        WriteText(font, 95, 375, chLevel);
    }

    DrawBox();       /* Draw box bricks */
    DrawParticles();

    if (bPause)
        WriteText(font, 265, 20, "- PAUSE -");
    if (bGameOver && !bExplode) {
        WriteTextCenter(font, 120, "GAME OVER");
        sprintf(chScore, "Your Score: %d", score); 
        WriteTextCenter(font, 250, chScore);
    }

    SDL_Flip(screen); /* Let's flip! */
}
Exemplo n.º 2
0
void SDraw::DrawRectOp(int x, int y, int cx, int cy, Color color)
{
	if(IsNull(color))
		return;
	Rect r = RectC(x, y, cx, cy);
	r += cloff.Top().offset;
	const Vector<Rect>& clip = cloff.Top().clip;
	for(int i = 0; i < clip.GetCount(); i++) {
		Rect cr = clip[i] & r;
		if(!cr.IsEmpty())
			PutRect(cr, color);
	}
}
Exemplo n.º 3
0
bool
Prefs::Save()
{
	if (fFatalError)
		return false;

	if (!PutInt("window_mode", &window_mode)
		|| !PutRect("normal_window_rect", &normal_window_rect)
		|| !PutRect("mini_window_rect", &mini_window_rect)
		|| !PutRect("prefs_window_rect", &prefs_window_rect)
		|| !PutInt("normal_bar_color", &normal_bar_color)
		|| !PutInt("mini_active_color", &mini_active_color)
		|| !PutInt("mini_idle_color", &mini_idle_color)
		|| !PutInt("mini_frame_color", &mini_frame_color)
		|| !PutInt("deskbar_active_color", &deskbar_active_color)
		|| !PutInt("deskbar_idle_color", &deskbar_idle_color)
		|| !PutInt("deskbar_frame_color", &deskbar_frame_color)
		|| !PutBool("normal_fade_colors", &normal_fade_colors)
		|| !PutInt("deskbar_icon_width", &deskbar_icon_width))
		return false;

	return true;
}