void Game_sys::ExitScreen( Player * player, Evil_bubble * evilBubble ) // SHOW THE SCORE AND RESTART THE GAME
{

    if(  !player -> Get_alive() )
    {
        force_to_play_timer += 0.02f;

        clear_to_color( buffer, makecol( 63, 72, 204 ) );

        textprintf_centre_ex( buffer, titleFont, screenwidth/2, screenheight/2 - 50, makecol( 63, 251, 0 ),
                             -1, "Your score: %i", ( player -> Get_bubbles_collected() ) );

        textprintf_centre_ex( buffer, titleFont, screenwidth/2, screenheight/2 + 50, makecol( 63, 251, 0 ),
                             -1, "please wait..." );
        BlitToScreen( !player -> Get_alive() );

        if( force_to_play_timer > 7 )
        {
			// RESET THE PLAYER, THE EVIL BUBBLE AND THE RESET TIMER
            player -> SetMembers();
            evilBubble -> SetMembers();
            force_to_play_timer = 0;
        }

    }

}
Beispiel #2
0
void traverse_tree(BITMAP *bitmap, NODE *node, VECTOR p, VECTOR v)
{
 float k;

 if(node != NULL)
  {
   k = VECTOR_DOT_PRODUCT(node->n, VECTOR_DIFF(node->a, p));

   if(k < 0.0)
    {
     if(node->right != NULL)
      traverse_tree(bitmap, node->right, p, v);
     if(in_view(p, v, node->a, node->b))
      {
       vector_line(bitmap, node->a, node->b, 0);printf("%d ", node->val);
textprintf_centre_ex(bitmap, font, (node->a.x + node->b.x) * 0.5, (node->a.y+node->b.y)*0.5, makecol(0, 0, 255), -1, "%d", node->val);
      }
     if(node->left != NULL)
      traverse_tree(bitmap, node->left, p, v);
    }

   else
    {
     if(node->left != NULL)
      traverse_tree(bitmap, node->left, p, v);
     if(in_view(p, v, node->a, node->b))
      {
       vector_line(bitmap, node->a, node->b, 0);printf("%d ", node->val);
       textprintf_centre_ex(bitmap, font, (node->a.x + node->b.x) * 0.5, (node->a.y+node->b.y)*0.5, makecol(0, 0, 255), -1, "%d", node->val);
      }
     if(node->right != NULL)
      traverse_tree(bitmap, node->right, p, v);
    }
  }
}
Beispiel #3
0
void desenhaRecordes(BITMAP *buffer, RECORDE *records)
{
	RECORDE *r;
	
	int x, y, i;
	x = RES_X/2;
	y = RES_Y/2 -200;
	
	textprintf_centre_ex(buffer, font, x, y-40, makecol(255,255,255), -1, "M e l h o r e s  P o n t u a d o r e s");
	
	for (i = 0; i < MAX_RECORDS; i++)
	{
		r = (records + i);
		rect(buffer, x-TAM_COLUNA_W, y, x-TAM_COLUNA_W-35, y+TAM_COLUNA_H, makecol(255,0,0));
		rect(buffer, x, y, x-TAM_COLUNA_W, y+TAM_COLUNA_H, makecol(255,0,0));		
		rect(buffer, x, y, x+TAM_COLUNA_W, y+TAM_COLUNA_H, makecol(255,0,0));
		
		textprintf_centre_ex(buffer, font, x-TAM_COLUNA_W-17, y+(TAM_COLUNA_H/2), makecol(255,255,255), -1, "%d", i+1);
		textprintf_centre_ex(buffer, font, x-(TAM_COLUNA_W/2), y+(TAM_COLUNA_H/2), makecol(255,255,255), -1, "%s", r->name);
		textprintf_centre_ex(buffer, font, x+(TAM_COLUNA_W/2), y+(TAM_COLUNA_H/2), makecol(255,255,255), -1, "%d", r->pontos);
		
		y += TAM_COLUNA_H;
	}
	
	textprintf_centre_ex(buffer, font, x, y+40, makecol(255,255,255), -1, "P r e s s i o n e  E S C  p /  S a i r");
}
Beispiel #4
0
/* handle the setup command */
static void setup_all_keys(void)
{
   int focus = 2;
   int i;

   /* Prepare dialog.  */
   set_dialog_color(keymap_dialog, black, white);
   centre_dialog(keymap_dialog);

   /* Parse input.  */
   while (1) {
      focus = do_dialog(keymap_dialog, focus);
      switch (focus) {
	 case 2:
	 case 4:

	    textprintf_centre_ex (screen, font,
	       keymap_dialog[7].x, keymap_dialog[7].y, red, -1,
	       "Press a key to map to the current scancode");
	    textprintf_centre_ex (screen, font,
	       keymap_dialog[7].x, keymap_dialog[7].y + 8, red, -1,
	       "(or a mouse button to leave it unchanged)");

	    /* Wait for new key press.  */
	    new_keycode = -1;
	    waiting_for_key = 1;

	    do {
	       poll_keyboard();
	       poll_mouse();

	       if (mouse_b)
		  waiting_for_key = 0;
	    }
	    while (waiting_for_key);

	    /* Save keycode to scancode mapping.  */
	    if ((new_keycode >= 0) && (new_keycode < 256)) {
	       keycode_to_scancode[new_keycode] = keymap_dialog[2].d1 + 1;
	    }

	    clear_keybuf();

	    break;
	 case 5:
	    return;
	 case 6:
	    for (i = 0; i < 256; i++) {
               if (keycode_to_scancode[i] >= 0)
		  _xwin.keycode_to_scancode[i] = keycode_to_scancode[i];
            }
	    return;
      }
   }
}
Beispiel #5
0
void Editor::draw()
{
  // Background
  rectfill(buffer, 0, 0, SCREEN_W, SCREEN_H, makecol(255,255,255));

  if( saving){
    //Create gui
    textprintf_centre_ex(buffer,font,640,310, makecol(0,0,0),-1,"Save Map Name");

    //Input rectangle
    rectfill(buffer, 400, 408, 892, 452, makecol(0,0,0));
    rectfill(buffer, 402, 410, 890, 450, makecol(255,255,255));

    // Output the string to the screen
    textout_ex(buffer, font, edittext.c_str(), 410, 410, makecol(0,0,0), -1);

    // Draw the caret
    vline(buffer, text_length(font, edittext.c_str()) + 410 - text_length(font, ".txt") , 412, 448, makecol(0,0,0));
  }
  else if( opening){
    //Create gui
    textprintf_centre_ex(buffer,font,640,310, makecol(0,0,0),-1,"Open Map Name");

    //Input rectangle
    rectfill(buffer, 400, 408, 892, 452, makecol(0,0,0));
    rectfill(buffer, 402, 410, 890, 450, makecol(255,255,255));

    // Output the string to the screen
    textout_ex(buffer, font, edittext.c_str(), 410, 410, makecol(0,0,0), -1);

    // Draw the caret
    vline(buffer, text_length(font, edittext.c_str()) + 410 - text_length(font, ".txt") , 412, 448, makecol(0,0,0));
  }
  else{
    // Draw tiles
    tile_map -> draw_map( buffer);
    exampleTile -> draw_tile( buffer, 0, 0, 0);

    // Map info
    textprintf_ex(buffer,font,0,80,makecol(255,255,255),makecol(0,0,0),"height-%i width-%i", tile_map -> height, tile_map -> width);

    if(layer == 1){
      textprintf_ex(buffer,font,0,130,makecol(255,255,255),makecol(0,0,0),"Editing Mode: Foreground");
    }
    else if(layer == 0){
      textprintf_ex(buffer,font,0,130,makecol(255,255,255),makecol(0,0,0),"Editing Mode: Background");
    }

    // Cursor
    circlefill(buffer, mouse_x , mouse_y , 10, makecol(0,0,0));
    circlefill(buffer, mouse_x , mouse_y, 8, makecol(255,255,255));
  }
  // Draw buffer
  stretch_sprite( screen, buffer, 0, 0, SCREEN_W, SCREEN_H);
}
Beispiel #6
0
/*  showLoadingBar(char *stage)

Show the loading screen and the loading bar

*/
void showLoadingBar(char *stage)
{
	loadingPhase++;
	draw_sprite(screenBuffer, loadBackground, 0, 0);
	rectfill(screenBuffer, 209, 524, 209 + (int)(((float)((float)loadingPhase)/(float)(loadingPhases)) * (810 - 209)), 531, makecol(255, 0, 0));
	textprintf_centre_ex(screenBuffer, font15, 509, 482, 0, -1, "Now loading \"%s\"", stage);
	textprintf_centre_ex(screenBuffer, font15, 510, 480, makecol(255, 255, 255), -1, "/*Now loading \"%s\"", stage);
	draw_sprite(screenBuffer, mousePic, mouseX, mouseY);
	blit(screenBuffer, screen, 0,0,0,0,1024,768);
   clear_bitmap(screenBuffer);
}
void Slider::paint(){
	scare_mouse();
	Box::paint();
	textprintf_centre_ex(screen, font, x + w / 2 + 4, y + 3, COLOR_DEFAULT_BUTTONTEXT_SHADOW, -1, "%s", text);
	textprintf_centre_ex(screen, font, x + w / 2 + 2, y + 1, COLOR_DEFAULT_BUTTONTEXT, -1, "%s", text);
	rectfill(screen, x + 2, y + 86 - (int)(72 * value), x + 26, y + 86, COLOR_SLIDER);
	if(recording)
		line(screen, x + 2, y + 86 - (int)(72 * sval), x + 26, y + 86 - (int)(72 * sval), 0);

	rect(screen, x + 2, y + 14, x + 26, y + 86, 0);
	unscare_mouse();
}
Beispiel #8
0
void make_pickup_message(char *string,BITMAP *pic,int time)
{
	int i,j;
	int color;
	int val;
	int r,g,b;

	if(pickup.buffer==NULL)
	{
		pickup.buffer = create_bitmap(480, 50);
	}
	
	clear_to_color(pickup.buffer, makecol(255,0,255));

	//text_mode(-1);
	textprintf_centre_ex(pickup.buffer, font_avalon->dat,241,1,makecol(0,0,0),-1,"%s",string);
	textprintf_centre_ex(pickup.buffer, font_avalon->dat,240,0,makecol(255,255,255),-1,"%s",string);
	
	pickup.ready = 1;
	
	pickup.alpha = PICKUP_MESSAGE_ALPHA;
	pickup.time = time;

	if(pic!=NULL)
	{
		if(pickup.pic!=NULL) destroy_bitmap(pickup.pic);
		
		pickup.pic = create_bitmap(pic->w,pic->h);
		clear_to_color(pickup.pic,makecol(255,0,255));
		
		for(i=0;i<pic->w;i++)
			for(j=0;j<pic->h;j++)
			{
				color = getpixel(pic,i,j);
				
				r = getr(color);g = getg(color);b = getb(color);
				if(color==MASK_COLOR_16)
				{
				}
				else
				{
					val = ((r+g+b)/3);
					putpixel(pickup.pic,i,j,makecol(val,val,val));
				}
			}
	}
	else
	{
		pickup.pic = NULL;
	}
}
Beispiel #9
0
void lerNomeRecorde(BITMAP *buffer, char result[NAME_LEN])
{
	int val, scancode, i;
	char name[NAME_LEN], ascii;
	
	memset(name, '\0', NAME_LEN);	
	strcpy(name, "None");
	i = strlen(name)-1;
	
	clear_keybuf();

	do
	{
		clear(buffer);
		textprintf_centre_ex(buffer, font, RES_X/2, RES_Y/2, makecol(255,255,255), -1, "Entre com o nome do recordista:");
		
		if (keypressed() && i < NAME_LEN)
		{
			val = readkey();
			ascii = val & 0xff;
			scancode = val >> 8;
			
			if (scancode == KEY_BACKSPACE)
			{
				if (i > 0) i--;
				name[i] = '\0';
				continue;
			}
						
			if (ascii >= 33 && ascii <= 126)
			{
				name[i] = ascii;
				i++;				
			}			
		}
		
		textprintf_centre_ex(buffer, font, RES_X/2, RES_Y/2+30, makecol(0,0,200), -1, "%s", name);

		if (i == 50)
		{
			textprintf_centre_ex(buffer, font, RES_X/2, RES_Y/2+60, makecol(255,0,0), -1, 
				"Limite de caracteres atingido!");
		}

		textprintf_centre_ex(buffer, font, RES_X/2, RES_Y/2+90, makecol(255,255,255), -1, "Pressione ENTER para concluir...");
		draw_sprite(screen, buffer, 0, 0);
		
		rest(10);
	} while (!key[KEY_ENTER]);
Beispiel #10
0
/* Dirty (because freezing) ready-set-go countdown hack for a player wish */
void readysetgo() {
	BITMAP *screensave = create_bitmap(screen->w,screen->h);
	blit(screen,screensave,0,0,0,0,screen->w,screen->h);

	textprintf_centre_ex(screensave,myfont,screensave->w/2,screensave->h/2,makecol(255,0,0),-1,"3...");
	blit(screensave,screen,0,0,0,0,screensave->w,screensave->h);
	rest(500);
	textprintf_centre_ex(screensave,myfont,screensave->w/2,screensave->h/2+fontpxsize,makecol(255,0,0),-1,"2...");
	blit(screensave,screen,0,0,0,0,screensave->w,screensave->h);
	rest(500);
	textprintf_centre_ex(screensave,myfont,screensave->w/2,screensave->h/2+fontpxsize*2,makecol(255,0,0),-1,"1...");
	blit(screensave,screen,0,0,0,0,screensave->w,screensave->h);
	rest(500);

	destroy_bitmap(screensave);
}
Beispiel #11
0
static void next(void)
{
   textprintf_centre_ex(screen, font, SCREEN_W / 2,
      SCREEN_H - text_height(font), -1, -1, "Press a key to continue");
   readkey();
   clear_bitmap(screen);
}
Beispiel #12
0
/* dialog procedure for codepage selection objects */
int codepage_proc(int msg, DIALOG *d, int c)
{
   int fg, bg, ret;

   if (msg == MSG_DRAW) {
      if (d->flags & D_SELECTED) {
	 fg = (d->d1 == codepage) ? 1 : 8;
	 bg = 16;
      }
      else if (d->flags & D_GOTFOCUS) {
	 fg = 16;
	 bg = (d->d1 == codepage) ? 1 : 8;
      }
      else { 
	 fg = 255;
	 bg = (d->d1 == codepage) ? 1 : 8;
      }

      rectfill(screen, d->x+1, d->y+1, d->x+d->w-1, d->y+d->h-1, bg);
      rect(screen, d->x, d->y, d->x+d->w, d->y+d->h, 255);

      textprintf_centre_ex(screen, font, d->x+d->w/2, d->y+4, fg, -1, "%04X", d->d1<<8);

      return D_O_K;
   }

   ret = d_button_proc(msg, d, c);

   if (ret & D_CLOSE) {
      codepage = d->d1;
      return D_REDRAW;
   }

   return ret;
}
void draw_tree(BITMAP *bitmap, VECTOR p, VECTOR v, NODE *node, int x, int y, int r, int c)
{
 int inv_c = inverse_color(c);

 if(node != NULL)
  {
   if(node->right != NULL)
    {
     //line(bitmap, x, y, x + 2 * r, y + 2 * r, inv_c);
     draw_tree(bitmap, p, v, node->right, x + 2 * r, y + 2 * r, r, c);
    }

   if(node->left != NULL)
    {
     //line(bitmap, x, y, x - 2 * r, y + 2 * r, inv_c);
     draw_tree(bitmap, p, v, node->left, x - 2 * r, y + 2 * r, r, c);
    }

  if(in_view(p, v, node->a, node->b))
   vector_line(bitmap, node->a, node->b, makecol(255, 255, 255));
  else
   vector_line(bitmap, node->a, node->b, 0);

   textprintf_centre_ex(bitmap, font, node->a.x - 10, node->a.y, makecol(0, 0, 255), -1, "%d", node->val);

   //circlefill(bitmap, x, y, r, c);
   //circle(bitmap, x, y, r, inv_c);
   //textprintf_centre_ex(bitmap, font, x, y - 4, inv_c, -1, "%d", node->val);
  }
}
Beispiel #14
0
void desenhaMenu(BITMAP *buffer, OPCOES *menu, int selected)
{	
	int i, ym, cor;
	PONTO p1, p2;
	OPCAO op;
		
	for (i = 0; i < NUM_ITENS; i++)
	{
		op = menu->itens[i];
		p1 = op.p1; p2 = op.p2;
	
		if (selected == i)
			cor = makecol(255,0,0);
		else
			cor = makecol(255,255,255);
			
	
		rectfill(buffer, p1.x, p1.y, p2.x, p2.y, cor);
		rectfill(buffer, p1.x+5, p1.y+5, p2.x-5, p2.y-5, makecol(0,0,0));
		
		ym = (p1.y + p2.y) / 2;
				
		textprintf_centre_ex(buffer, font, menu->x, ym, makecol(255,255,255), -1, "%s", menu->itens[i].text);
	}
}
Beispiel #15
0
void Label::draw(BITMAP* buffer){

	for (int i=0;i<6;i+=2)
		rect(buffer,x+i,y+i,x+sizeX-i,y+sizeY-i,makecol(0,0,255-i*40)); //labels' frame

	rectfill(buffer,x+4,y+4,x+sizeX-4,y+sizeY-4,makecol(0,0,0)); //draw a black rectangle to erase old text 
	textprintf_centre_ex(buffer, font, x+(sizeX/2), y+(sizeY/3)+1, makecol(255,255,255), -1, "%s",text);

}
Beispiel #16
0
void Button::drawPressed(BITMAP* buffer){

	rectfill(buffer,x-1,y-1,x+sizeX+6,y+sizeY+6,makecol(0,0,0)); //draw a black rectangle to cover the old button

	for (int i=5;i<6;i++)
		rectfill(buffer,x+i,y+i,x+sizeX+i,y+sizeY+i,makecol(153,217,234)); //buttons light blue shadow

	rectfill(buffer,x+4,y+4,x+sizeX+4,y+sizeY+4,makecol(0,0,255)); //button deep blue fill
	textprintf_centre_ex(buffer, font, x+(sizeX/2)+4, y+(sizeY/2)+4, makecol(255,255,255), -1, "%s",text);
}
void Game_sys::WelcomeScreen() // LOOP FOR THE INTRO
{

    while( !key[KEY_B] )
    {

        blit( (BITMAP*)backgrounds[0].dat, buffer, 0, 0, 0, 0, screenwidth, screenheight );

        textprintf_centre_ex( buffer, titleFont, screenwidth/2, screenheight-120, RED,
                             -1, "Bubble Rebel by Veselin Slavchev" );
        textprintf_centre_ex( buffer, titleFont, screenwidth/2, screenheight-80, RED,
                             -1, "Press 'B' to play!" );

        blit( buffer, screen, 0, 0, 0, 0, screenwidth, screenheight );
        clear_bitmap( buffer );

    }

}
void Game_sys::DrawInterface( Player * player, int evil_bubbles )
{

    rectfill( buffer, 0, 0, 100, screenheight, BLUE );
    rect( buffer, 3, 3, 97, screenheight - 3, makecol( 0, 108, 155 ) );

    textprintf_centre_ex( buffer, interfaceFont, 50, 50, RED, -1, "Bubbles:" );
    textprintf_centre_ex( buffer, interfaceFont, 50, 70, RED, -1, "Your : Evil's" );
    textprintf_centre_ex( buffer, interfaceFont, 50, 85, RED, -1, "%i : %i", player -> Get_bubbles_collected(), evil_bubbles );

    int breath_bar_color;
    if( player -> Get_current_breath() < 70 )
    breath_bar_color = makecol( 255, 0, 0 );
    else
    breath_bar_color = makecol( 0, 255, 0 );
    rectfill( buffer, 20, 200 + player -> Get_max_breath() - player -> Get_current_breath(), 80, 200 + player -> Get_max_breath(), breath_bar_color );
    rect( buffer, 20, 199 , 80, 201 + player -> Get_max_breath(), makecol( 0, 255, 0 ) );


}
Beispiel #19
0
void gameover()
{
    BITMAP *fin = load_bitmap("media/gameover.bmp", NULL);
    if(fin == NULL)
        ERREUR("Echec chargement fin");
    blit(fin, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
    textprintf_centre_ex(screen, font, SCREEN_W/2, SCREEN_H/2, makecol(0, 0, 0), makecol(255, 0, 0), "   Score : %d   ", score);
    while(keypressed())
        readkey();
    rest(2000);
    readkey();
}
Beispiel #20
0
void traverse_tree(BITMAP *bitmap, NODE *node, VEC2F p, VEC2F v, VEC2F vertex[])
{
 float k;

 if(node != NULL)
  {
   k = VEC2F_DOT_PRODUCT(node->n, VEC2F_DIFF(vertex[node->a], p));

   if(k < 0.0)
    {
     if(node->right != NULL)
      traverse_tree(bitmap, node->right, p, v, vertex);
     if(in_view(p, v, vertex[node->a], vertex[node->b]))
      {
       vec2f_line(bitmap, vertex[node->a], vertex[node->b], 0); printf("%d ", node->val);
       textprintf_centre_ex(bitmap, font, (vertex[node->a].x + vertex[node->b].x) * 0.5 + SCREEN_W * 0.5,
                                          (vertex[node->a].y + vertex[node->b].y) * 0.5 + SCREEN_H * 0.5,
                                           makecol(0, 0, 255), -1, "%d", node->val);
      }
     if(node->left != NULL)
      traverse_tree(bitmap, node->left, p, v, vertex);
    }

   else
    {
     if(node->left != NULL)
      traverse_tree(bitmap, node->left, p, v, vertex);
     if(in_view(p, v, vertex[node->a], vertex[node->b]))
      {
       vec2f_line(bitmap, vertex[node->a], vertex[node->b], 0); printf("%d ", node->val);
       textprintf_centre_ex(bitmap, font, (vertex[node->a].x + vertex[node->b].x) * 0.5 + SCREEN_W * 0.5,
                                          (vertex[node->a].y + vertex[node->b].y) * 0.5 + SCREEN_H * 0.5,
                                           makecol(0, 0, 255), -1, "%d", node->val);
      }
     if(node->right != NULL)
      traverse_tree(bitmap, node->right, p, v, vertex);
    }
  }
}
Beispiel #21
0
/* dialog procedure for ASCII character objects */
int ascii_proc(int msg, DIALOG *d, int c)
{
   int fg, bg, mg, k;

   if (msg == MSG_DRAW) {
      if (d->flags & D_SELECTED) {
	 fg = 16;
	 bg = 255;
	 mg = 8;
      }
      else if (d->flags & D_GOTFOCUS) {
	 fg = 255;
	 bg = 8;
	 mg = 16;
      }
      else {
	 fg = 255;
	 bg = 16;
	 mg = 8;
      }

      rectfill(screen, d->x+1, d->y+1, d->x+d->w-1, d->y+d->h-1, bg);
      rect(screen, d->x, d->y, d->x+d->w, d->y+d->h, fg);

      textprintf_ex(screen, font, d->x+4, d->y+4, mg, -1, "%02X", d->d1);

      k = (codepage << 8) | d->d1;

      if (k >= ' ')
	 textprintf_centre_ex(screen, font, d->x+d->w-8, d->y+4, fg, -1, "%c", k);
      else
	 textprintf_centre_ex(screen, font, d->x+d->w-8, d->y+4, fg, -1, "%s", ascii_name[k]);

      return D_O_K;
   }

   return d_button_proc(msg, d, c);
}
Beispiel #22
0
void Menu::draw()
{
  // Draw background to screen
  rectfill( buffer, 0, 0, SCREEN_W, SCREEN_H, makecol( 255,255,255));

  // Draw live background
  tile_map -> draw_map(buffer);

  // Overlay
  draw_trans_sprite(buffer, credits, 0, 0);
  draw_trans_sprite(buffer, menu, 0, SCREEN_H-461);
  draw_trans_sprite(buffer, menuselect, selectorX, selectorY);

  // Level selection
  draw_trans_sprite(buffer, levelSelectLeft, SCREEN_W-180, 80);
  draw_trans_sprite(buffer, levelSelectNumber, SCREEN_W-160, 80);
  textprintf_centre_ex(buffer,font,SCREEN_W-112,73,makecol(0,0,0),-1,"%i",levelOn + 1);
  draw_trans_sprite(buffer, levelSelectRight, SCREEN_W-80, 80);

  // Hover select left
  if(collisionAny(mouse_x,mouse_x,SCREEN_W-180,SCREEN_W-140,mouse_y,mouse_y, 80, 120)){
    draw_trans_sprite(buffer, levelSelectLeft, SCREEN_W-180, 80);
  }
  // Hover select right
  if(collisionAny(mouse_x,mouse_x,SCREEN_W-80,SCREEN_W-40,mouse_y,mouse_y, 80, 120)){
    draw_trans_sprite(buffer, levelSelectRight, SCREEN_W-80, 80);
  }

  // Cursor
  draw_sprite(buffer, cursor[0], mouse_x, mouse_y);

  // Select button
  if (mouse_b & 1 || key[KEY_ENTER] || joy[0].button[0].b){
    if (selectorY==610){
      do{
        draw_sprite(buffer, menu, 0, 0);
        draw_sprite(buffer, help,0,0);
        draw_sprite(screen,buffer,0,0);
      }
      while(!key[KEY_ESC] && !mouse_b & 1 && !joy[0].button[0].b);
    }
  }
  if( menuOpen){
    draw_trans_sprite( buffer,help,0,0);
  }
  draw_trans_sprite(buffer,copyright,SCREEN_W-350,SCREEN_H-40);
  draw_sprite(buffer,cursor[0],mouse_x,mouse_y);
  // Draw buffer
  stretch_sprite( screen, buffer, 0, 0, SCREEN_W, SCREEN_H);
}
Beispiel #23
0
// print status line beneath board
void printst(int *board, int flag)
{
	int iblack = 0, iwhite = 0;
	int i;

	for (i = 0; i < 100; ++i)
	{
		if (board[i] == 1) ++iblack;
		if (board[i] == -1) ++iwhite;
	}

	scare_mouse();

	if (!flag)
		textprintf_centre_ex(screen, font, SCREEN_W/2, 440, 
							makecol(0, 0, 0), makecol(0, 200, 0),
							"Black: %i | White: %i", iblack, iwhite);
	else
		textprintf_centre_ex(screen, font, SCREEN_W/2, 440,
							makecol(0, 0, 0), makecol(0, 200, 0),
							"Black: %i [GAME OVER] White: %i", iblack, iwhite);

	unscare_mouse();
}
Beispiel #24
0
/*  drawHUD()

Draws the entire HUD

*/
void drawHUD()
{
	//HUD picture
	draw_sprite(screenBuffer, HUD, 0, 0);

	/*PRINT TEXT INFO*/
	//Population
	textprintf_ex(screenBuffer, font15, 530, 14, makecol(255, 255, 255), 0, "%d", population);
	//Money
	textprintf_ex(screenBuffer, font15, 130, 14, makecol(255, 255, 255), 0, "%d", money);
	//Employees / Employees Needed
	textprintf_centre_ex(screenBuffer, font15, 890, 14, makecol(255, 255, 255), 0, "%d/%d", employees, employeesNeeded );

	//Highlight the selected resource button
	draw_sprite(screenBuffer, placmentOutline, resourceButton[placementToButton()].left - 4, resourceButton[placementToButton()].top - 4);
}
Beispiel #25
0
/*  drawPerson(PERSON *thePerson)

Draws a single person, given a pointer to the person.

*/
void drawPerson(PERSON *thePerson)
{
	//Draw the person
	draw_sprite(screenBuffer, thePerson->picture[thePerson->animationCounter], thePerson->x - 12 + cameraX, thePerson->y - 28 + cameraY);

	//If showPersonInfo is true, write the person's cargo info
	if (showPersonInfo && buildingIDtoResource(placement) >= 0)
	{
		//If the person is carrying the selected resource
		if (thePerson->cargoIndex == buildingIDtoResource(placement))
		{
         
			draw_sprite(screenBuffer, resourceIcon[buildingIDtoResource(placement)], thePerson->x + cameraX, thePerson->y - 38 + cameraY);
			textprintf_centre_ex(screenBuffer, font, thePerson->x + cameraX, thePerson->y - 20 + cameraY, makecol(255, 255, 255), -1, "%d", thePerson->cargo);
		}
	}
}
Beispiel #26
0
void renderscores() {
	BITMAP *brand = load_bitmap("gfx/apbrand.bmp",NULL);
	FONT *smallfont = load_font("gfx/Komikaboogie14px.tga",NULL,NULL);
	int i=0;

	rectfill(screen,0,0,screen->w,screen->h,backcolor);

	textprintf_centre_ex(screen,myfont,screen->w/2,6*fontpxsize,scoretitcol,-1,"Highscores");
	for(i=0;i<10;i++) {
		textprintf_ex(screen,smallfont,screen->w/2-200,7*fontpxsize+25*i,scorenamcol,-1,
			highscores[i][0]);
			textprintf_ex(screen,smallfont,screen->w/2+150,7*fontpxsize+25*i,scorescrcol,-1,
			highscores[i][1]);
	}

	draw_sprite(screen,brand,screen->w-brand->w,screen->h-brand->h);

	destroy_bitmap(brand);
}
Beispiel #27
0
void
render_info(BITMAP *bmp)
{
	char buf[256];

	scare_mouse();

	rectfill(bmp, 0, bmp->h - 16, bmp->w/2, bmp->h, bgc);
	rectfill(bmp, bmp->w/3, 0, (int)bmp->w*.66, 10, bgc);

	if (selected_node)
	{
		snprintf(buf, sizeof(buf), "%s: %s (ID: %d   coord: %d,%d)",
		         (selected_node->area?selected_node->area:"(unknown area)"),
		         (selected_node->title?selected_node->title:"(unknown title)"),
		         selected_node->id, selected_node->x, selected_node->y);

		textprintf_centre_ex(bmp, font, bmp->w/2, 2, 0, -1, "%s",
		                     buf);
		hline(bmp, bmp->w/2 - text_length(font, buf)/2, 10,
		      bmp->w/2 + text_length(font, buf)/2, 0);

		highlight_node(selected_node, highlight_color);
	}

	textprintf_ex(bmp, font, 2, (bmp->h - 8) - 2 - text_height(font), 0, -1,
		              "Center: %d,%d", (int)(bmp->w/2.0+xoffset), (int)(bmp->h/2.0+yoffset));
	textprintf_ex(bmp, font, 2, bmp->h - 8, 0, -1,
		              "Mouse: %d,%d", mouse_x+xoffset, mouse_y+yoffset);

	if (last_file)
	{
		snprintf(buf, sizeof(buf), "Most recent file: \"%s\"   (%d nodes total)", last_file, vector_len((vector_t *)nodelist));
		rectfill(bmp, text_length(font, buf), bmp->h - text_height(font), bmp->w, bmp->h, bgc);

		textprintf_right_ex(bmp, font, bmp->w, bmp->h-10, 0, -1, "%s", buf);
	}

	unscare_mouse();
}
Beispiel #28
0
/* draws the spline paths */
void draw_splines(void)
{
   int i;

   acquire_screen();

   clear_to_color(screen, makecol(255, 255, 255));

   textout_centre_ex(screen, font, "Spline curve path", SCREEN_W/2, 8,
		     palette_color[255], palette_color[0]);
   textprintf_centre_ex(screen, font, SCREEN_W/2, 32, palette_color[255],
			palette_color[0], "Curviness = %.2f",
			fixtof(curviness));
   textout_centre_ex(screen, font, "Up/down keys to alter", SCREEN_W/2, 44,
		     palette_color[255], palette_color[0]);
   textout_centre_ex(screen, font, "Space to walk", SCREEN_W/2, 68,
		     palette_color[255], palette_color[0]);
   textout_centre_ex(screen, font, "C to display control points", SCREEN_W/2,
		     92, palette_color[255], palette_color[0]);
   textout_centre_ex(screen, font, "T to display tangents", SCREEN_W/2, 104,
		     palette_color[255], palette_color[0]);

   for (i=1; i<node_count-2; i++)
      draw_spline(nodes[i], nodes[i+1]);

   for (i=1; i<node_count-1; i++) {
      draw_node(i);

      if (show_tangents) {
	 line(screen, nodes[i].x - fixtoi(fixcos(nodes[i].tangent) * 24),
		      nodes[i].y - fixtoi(fixsin(nodes[i].tangent) * 24),
		      nodes[i].x + fixtoi(fixcos(nodes[i].tangent) * 24),
		      nodes[i].y + fixtoi(fixsin(nodes[i].tangent) * 24),
		      palette_color[1]);
      }
   }

   release_screen();
}
Beispiel #29
0
void draw_oneplayer_frame()
{
//    if (FPS >30)
//       vsync();

   textprintf_centre_ex
   (
      screen,font,600,450,1,-1,
      "fps %d ",
      FPS
   );
      
   points1->update(screen, 42,SCREEN_H - 86);
   energ1->update(screen,  42,SCREEN_H - 44);
   
   stars1->update(screen, 232,SCREEN_H - 86);
   stuts1->update(screen, 232,SCREEN_H - 44);
   lives1->update(screen, 432,SCREEN_H - 86);
   houws1->update(screen, 432,SCREEN_H - 44);

   if (playfield->map_dirty)
   {
      clear(screen_buffer);
      for (int i=0;i< NR_OF_LAYERS;i++)
           playfield->draw(screen_buffer,i);

      stretch_blit(screen_buffer,screen,0,0, screen_buffer->w, screen_buffer->h, 0,0,SCREEN_W,SCREEN_H- 96);
      playfield->map_dirty = 0;
      return;
   }
   for (int i=-1;i< NR_OF_LAYERS;i++)
   {
       drawlist->draw(screen_buffer,i);
   }
   drawlist->for_all(dirty_blit);
   drawlist->reset();
   
}
Beispiel #30
0
void Level::Draw( BITMAP *buffer, BITMAP *tileset, int MAX_X, int MAX_Y )
{
    for ( int i=0; i<MAX_X; i++ )
    {
        for ( int j=0; j<MAX_Y; j++ )
        {
            if ( tile[0][i][j].X() >= xOff-32 && tile[0][i][j].X() <= xOff+1024 &&
                    tile[0][i][j].Y() >= yOff-32 && tile[0][i][j].Y() <= yOff+768 )
            {
                //x, y, w, h, filmstrip x, solidity
                tile[0][i][j].Draw( buffer, tileset, xOff, yOff );
                tile[1][i][j].Draw( buffer, tileset, xOff, yOff );
                tile[2][i][j].Draw( buffer, tileset, xOff, yOff );
                tile[3][i][j].Draw( buffer, tileset, xOff, yOff );

                if ( grid )
                    rect( buffer, i*32-xOff, j*32-yOff, i*32+32-xOff, j*32+32-yOff, makecol( 100, 100, 100 ) );

                textprintf_centre_ex( buffer, font, i*32+16-xOff, 64, makecol( 255, 255, 255 ), -1, "%i", i );
                textprintf_ex( buffer, font, 48, 16+j*32-yOff, makecol( 255, 255, 255 ), -1, "%i", j );
            }
        }
    }
}