Example #1
0
int ball::ball_lost() {
    //ball lost
    rectfill(screen, 0, 0, 640, 480, 0);
    draw_sprite(screen, balllost, 0, 0);
    rest(1000);
    
    if (ball_left < 0){
        blit(gameover, screen, 0, 0, 0, 0, 640, 480); 
        rest(1500); 
        return -1; //All chances are over
    } 
     
    return 0;
}
Example #2
0
int menu_oui_non(BITMAP* buffer, char* yolo)
{
    BITMAP* sauvegarde;
    BITMAP* ecran_noir;
    int compteur=0;
    ecran_noir= create_bitmap(192+5*32, 160);
    clear_to_color(ecran_noir, makecol(0, 0, 0));
    sauvegarde= create_bitmap(19*TSPRITE, 15*TSPRITE);
    textprintf_ex(ecran_noir, font, 0, 0, makecol(255, 255, 255),-1, "voulez-vous sauvegarder ce %s?", yolo);
    blit(ecran_noir, sauvegarde ,0,0,0,0, 19*TSPRITE, 15*TSPRITE);
    textprintf_ex(ecran_noir, font, 0, LIGNE+7, makecol(255, 255, 255),-1, "-> oui        non");
    draw_sprite(buffer, ecran_noir, 192-2*32, 160);
    blit(buffer, screen ,0,0,0,0, 19*TSPRITE, 15*TSPRITE);
    rest(200);
    while(!key[KEY_ENTER])
    {
        if((key[KEY_LEFT])||(key[KEY_A]))
        {
            blit(sauvegarde, ecran_noir,0,0,0,0, 19*TSPRITE, 15*TSPRITE);
            textprintf_ex(ecran_noir, font, 0, LIGNE+7, makecol(255, 255, 255),-1, "-> oui        non");
            draw_sprite(buffer, ecran_noir, 192-2*32, 160);
            blit(buffer, screen ,0,0,0,0, 19*TSPRITE, 15*TSPRITE);
            compteur=0;
        }
        if((key[KEY_RIGHT]||key[KEY_D]))
        {
            blit(sauvegarde, ecran_noir,0,0,0,0, 19*TSPRITE, 15*TSPRITE);
            textprintf_ex(ecran_noir, font, 0, LIGNE+7, makecol(255, 255, 255),-1, "   oui     -> non");
            draw_sprite(buffer, ecran_noir, 192-2*32, 160);
            blit(buffer, screen ,0,0,0,0, 19*TSPRITE, 15*TSPRITE);
            compteur=1;
        }

    }
clear_keybuf();
return compteur;
}
Example #3
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]);
Example #4
0
static void gtk_draw_menu_item(MENU *m, int x, int y, int w, int h, int bar, int sel)
{
    BITMAP *bmp = gui_get_screen();
    int fg, bg;
    int i, j;
    char buf[256], *tok;

    if (m->flags & D_DISABLED) {
        fg = nshadow;
        bg = normal;
    }
    else {
        fg = black;
        bg = (sel) ? highlight : normal;
    }

    rectfill(bmp, x+1, y+1, x+w-3, y+h-4, bg);

    if (ugetc(m->text)) {
        i = 0;
        j = ugetc(m->text);

        while ((j) && (j != '\t')) {
            i += usetc(buf+i, j);
            j = ugetc(m->text+i);
        }

        usetc(buf+i, 0);

        gui_textout_ex(bmp, buf, x+8, y+1, fg, bg, FALSE);

        if (j == '\t') {
            tok = m->text+i + uwidth(m->text+i);
            gui_textout_ex(bmp, tok, x+w-gui_strlen(tok)-10, y+1, fg, bg, FALSE);
        }

        if ((m->child) && (!bar))
            draw_sprite(bmp, menu_arrow_bmp, x+w-12, y+(h-menu_arrow_bmp->h)/2);
    }
    else {
        hline(bmp, x+4, y+text_height(font)/2+2, x+w-4, nshadow);
        hline(bmp, x+4, y+text_height(font)/2+3, x+w-4, highlight);
    }

    if (m->flags & D_SELECTED) {
        line(bmp, x+1, y+text_height(font)/2+1, x+3, y+text_height(font)+1, fg);
        line(bmp, x+3, y+text_height(font)+1, x+6, y+2, fg);
    }
}
Example #5
0
void mapa2::dibujar_mapa()
{
    int row,col;
    for(row = 0; row < MAXFILAS; row ++)
    {
        for(col = 0; col <MAXCOLS; col++)
        {
            if(m[row][col] == 'X')
            {

                draw_sprite(buffer, roca , col*30 , row*30); //escala de 30 a 1 por eso se multiplica por 30
            }
            else if(m[row][col] == 'O')
            {
                draw_sprite(buffer, comida , col*30 , row*30); //escala de 30 a 1 por eso se multiplica por 30
                if(py/30 == row && px/30 == col)
                {
                    m[row][col] = ' ';
                    z++;
                }
            }
        }
    }
Example #6
0
void TB_StageSelect::Draw(void)
{
	if (!fVisible)
		return;
	
	// handle user input
	HandleInput();
	
	// draw "- WARP -" text
	fWarpY -= WARP_Y_SPEED;
	if (fWarpY < WARP_Y) fWarpY = WARP_Y;
	
	draw_sprite(WARP_X, fWarpY, SPR_TEXT_WARP, 0);
	
	// draw teleporter locations
	int nslots = CountActiveSlots();
	int total_spacing = ((nslots - 1) * LOCS_SPACING);
	int total_width = total_spacing + (nslots * sprites[SPR_STAGEIMAGE].w);
	int x = (Graphics::SCREEN_WIDTH / 2) - (total_width / 2);
	
	for(int i=0;i<nslots;i++)
	{
		int sprite;
		GetSlotByIndex(i, &sprite, NULL);
		
		draw_sprite(x, LOCS_Y, SPR_STAGEIMAGE, sprite);
		
		if (i == fSelectionIndex)
		{
			fSelectionFrame ^= 1;
			draw_sprite(x, LOCS_Y, SPR_SELECTOR_ITEMS, fSelectionFrame);
		}
		
		x += (sprites[SPR_STAGEIMAGE].w + LOCS_SPACING);
	}
}
Example #7
0
void HUD::render_cursor()
{
	if(!gameclient.snap.local_character)
		return;
		
	mapscreen_to_group(gameclient.camera->center.x, gameclient.camera->center.y, layers_game_group());
	gfx_texture_set(data->images[IMAGE_GAME].id);
	gfx_quads_begin();

	// render cursor
	select_sprite(data->weapons.id[gameclient.snap.local_character->weapon%NUM_WEAPONS].sprite_cursor);
	float cursorsize = 64;
	draw_sprite(gameclient.controls->target_pos.x, gameclient.controls->target_pos.y, cursorsize);
	gfx_quads_end();
}
Example #8
0
BITMAP* affiche_buffer(BITMAP* affiche[15][19])
{
    BITMAP* buffer;
    buffer= create_bitmap(TSPRITE*19, TSPRITE*15);
    int i,j;

    for (i=0; i<15; i++)
    {
        for(j=0; j<19; j++){
                if (affiche[i][j]!=NULL) draw_sprite(buffer, affiche[i][j], TSPRITE*j, TSPRITE*i);
        }
    }

return buffer;
}
Example #9
0
void Animation::drawFrame(BITMAP *dest, int frame, int x, int y, bool hflip, bool vflip)
{
	BITMAP *src = getFrame(frame);

	if (hflip && vflip) {
		draw_sprite_vh_flip(dest, src, x, y);
	} else if (hflip && !vflip) {
		draw_sprite_h_flip(dest, src, x, y);
	} else if (!hflip && vflip) {
		draw_sprite_v_flip(dest, src, x, y);
	} else {
		draw_sprite(dest, src, x, y);
	}
	return;
}
Example #10
0
void update(){
              draw_sprite( screen, buffer, 0, 0);
              draw_sprite( buffer, scene1, 0, 0);
              if(flip==0){draw_sprite(buffer,bobby, 600, 600); flip=1; loop=1;}
              if(flip==1 && loop==0){draw_sprite_h_flip(buffer,bobby, 600, 600); flip=0;}
              loop=0;
              
              angle=angle+5;                      
              rotate_sprite(buffer, bobby, 400, 600, itofix(angle));
              
              stretch_sprite(buffer, bobby, 500, 600, w, h);
              
              stretch_sprite(buffer, bobby, 300, 600, w, 50);
              
              stretch_sprite(buffer, bobby, 200, 600, 50, h);
              
              w++;
              h++;
              
              if(w==75){w=25;}
              if(h==75){h=25;}

              rest(100);
}
Example #11
0
/********************************************//**
 * \brief Affiche les obstacles - ATTENTION ILS TOURNENT TOUS
 *
 * \param page BITMAP* Buffer d'affichage
 * \param images BITMAP** Tableau de BITAMAP -> obstacles
 * \param scroll_x int
 * \param nbr_obstacle int Taille du tableau d'obstacles
 * \param obstacle t_obstacle* Info des obstacles
 * \return void
 *
 ***********************************************/
void afficher_obstacle(BITMAP* page,BITMAP** images,int scroll_x, int nbr_obstacle,t_obstacle* obstacle)
{
    int i;

    for (i = 0 ; i < nbr_obstacle ; i ++ )
    {
        if (obstacle[i].type != 2)
            rotate_sprite(page,images[obstacle[i].type],obstacle[i].coord.x-scroll_x,obstacle[i].coord.y,itofix(scroll_x));
        else
        {
            draw_sprite(page,images[obstacle[i].type],obstacle[i].coord.x-scroll_x,obstacle[i].coord.y);
            rotate_sprite(page,images[obstacle[i].type],obstacle[i].coord2.x-scroll_x,obstacle[i].coord2.y,itofix(64*2));
        }
    }
}
Example #12
0
static void draw_speed(void)
{
	chtype pair = GET_PAIR_FOR(MENU_ACTIVE_COLOR);
	int dy = menu_speed_d_pos.y - menu_speed_u_pos.y - 2;
	Vector2i pos = { speed_pos.y + dy+1 - 2*stgs.speed, speed_pos.x }; // TODO better way for speed slider pos

	wattrset(menuw, pair);
	draw_sprite(menuw, (SpriteInfo) { arrow_sprites[DIR_UP], MENU_UDARROW_WIDTH, MENU_UDARROW_HEIGHT },
				menu_speed_u_pos, FALSE);
	draw_sprite(menuw, (SpriteInfo) { arrow_sprites[DIR_DOWN], MENU_UDARROW_WIDTH, MENU_UDARROW_HEIGHT },
				menu_speed_d_pos, FALSE);
	wattrset(menuw, ui_pair);
	mvwvline(menuw, menu_speed_u_pos.y+2, menu_speed_u_pos.x+1, ACS_VLINE, dy);

	wattrset(menuw, pair);
	mvwvline(menuw, pos.y+1, pos.x-3, ACS_BLOCK, 3);
	wattrset(menuw, fg_pair | A_REVERSE);
	draw_rect(menuw, speed_pos, MENU_DIGIT_WIDTH, dy+4);
	wattroff(menuw, A_REVERSE);
	draw_sprite(menuw, (SpriteInfo) { digit_sprites[stgs.speed], 3, 5 }, pos, TRUE);

	wattrset(menuw, GET_PAIR_FOR(has_enough_colors(stgs.colors) ? MENU_ACTIVE_COLOR : MENU_INACTIVE_COLOR));
	draw_sprite(menuw, (SpriteInfo) { stepup_sprite, 3, 3 }, menu_stepup_pos, FALSE);
}
Example #13
0
void menu::draw_menu() {
	if (!is_open) return;
	if (current_index[current_menu] + 2 > option_count && current_menu == Players) current_index[current_menu] = option_count - 1;
	float difference = ((option_count > MAX_PP ? MAX_PP : option_count) * (.035 * 10)) / 10;
	draw_rect(x_axis, y_axis + .018, .205, .074, shader_color);
	draw_rect(x_axis, y_axis + .055 + difference / 2, .205, difference, background_color);
	draw_rect(x_axis, y_axis + .074 + difference, .205, .038, shader_color);
	draw_text(title, 1, 1, x_axis, y_axis - .024, white, center);
	draw_text(sub_title, 1, .55, x_axis, y_axis + .022, white, center);
	draw_text(creator_text, 1, .455, x_axis - .097, y_axis + difference + .058, white);
	draw_text((string)(current_index[current_menu] + 1) + "/" + (string)option_count, 1, .455, x_axis + .095, y_axis + difference + .058, white, right);
	draw_sprite("commonmenu", "arrowright", x_axis - .095, y_axis + .074 + (.035 * c_drawing_index), .022, .022, pointer_color);
	draw_instructions();
	draw_arrows();
}
Example #14
0
// draws particle depending on map offset (ox and oy)
void draw_particle(BITMAP *bmp, Tparticle*p, int ox, int oy) {
	int x = p->x - ox;
	int y = p->y - oy;

	// is the particle inside the screen
	if (x < -16 || x > bmp->w + 16 || y < -16 || y > bmp->h +16) return;

	// draw it
	if (p->bmp == -1)
		putpixel(bmp, x, y, p->color);
	else {
		BITMAP *b = data[p->bmp + (p->color == -1 ? p->count>>1 : 0)].dat;
		draw_sprite(bmp, b, x - b->w/2, y - b->h/2);
	}
}
Example #15
0
void ttk_button_draw(gfx_context_t * ctx, struct TTKButton * button) {
	if (button->width == 0) {
		return;
	}

	int hilight = button->hilight & 0xFF;
	int disabled = button->hilight & 0x100;

	/* Dark edge */
	if (hilight < 3) {
		struct gradient_definition edge = {button->height, button->y, rgb(166,166,166), rgb(136,136,136)};
		draw_rounded_rectangle_pattern(ctx, button->x, button->y, button->width, button->height, 4, gfx_vertical_gradient_pattern, &edge);
	}

	/* Sheen */
	if (hilight < 2) {
		draw_rounded_rectangle(ctx, button->x + 1, button->y + 1, button->width - 2, button->height - 2, 3, rgb(238,238,238));
	/* Button face - this should normally be a gradient */
		if (hilight == 1) {
			struct gradient_definition face = {button->height-3, button->y + 2, rgb(240,240,240), rgb(230,230,230)};
			draw_rounded_rectangle_pattern(ctx, button->x + 2, button->y + 2, button->width - 4, button->height - 3, 2, gfx_vertical_gradient_pattern, &face);
		} else {
			struct gradient_definition face = {button->height-3, button->y + 2, rgb(219,219,219), rgb(204,204,204)};
			draw_rounded_rectangle_pattern(ctx, button->x + 2, button->y + 2, button->width - 4, button->height - 3, 2, gfx_vertical_gradient_pattern, &face);
		}
	} else if (hilight == 2) {
		struct gradient_definition face = {button->height-2, button->y + 1, rgb(180,180,180), rgb(160,160,160)};
		draw_rounded_rectangle_pattern(ctx, button->x + 1, button->y + 1, button->width - 2, button->height - 2, 3, gfx_vertical_gradient_pattern, &face);
	}

	if (button->title[0] != '\033') {
		int label_width = draw_sdf_string_width(button->title, 16, SDF_FONT_THIN);
		int centered = (button->width - label_width) / 2;

		int centered_y = (button->height - 16) / 2;
		draw_sdf_string(ctx, button->x + centered + (hilight == 2), button->y + centered_y + (hilight == 2), button->title, 16, disabled ? rgb(120,120,120) : rgb(0,0,0), SDF_FONT_THIN);
	} else {
		sprite_t * icon = icon_get_16(button->title+1);
		int centered = button->x + (button->width - icon->width) / 2 + (hilight == 2);
		int centered_y = button->y + (button->height - icon->height) / 2 + (hilight == 2);
		if (disabled) {
			draw_sprite_alpha(ctx, icon, centered, centered_y, 0.5);
		} else {
			draw_sprite(ctx, icon, centered, centered_y);
		}
	}

}
Example #16
0
// draws a given number using sprite 's' as the font
// the numbers are drawn right-aligned to "x".
void DrawNumberRAlign(int x, int y, int s, int num)
{
   char str[50];
   int i, len;
   int fontwidth = sprites[s].w;

	snprintf(str, sizeof(str), "%d", num);
	x -= strlen(str) * fontwidth;
	
	len = strlen(str);
	for(i=0;i<len;i++)
	{
		draw_sprite(x, y, s, str[i] - '0');
		x += fontwidth;
	}
}
Example #17
0
void desenhaExplosoes(BITMAP *buffer, EXPLOSAO *explosoes)
{
	int i, index;
	EXPLOSAO *e;
	
	for (i = 0; i < NUM_CIRC; i++)
	{
		e = (explosoes + i);
		
		if (e->status == 0)
			continue;
			
		index = (e->imgIndex % 100) / 5;
		draw_sprite(buffer, spritesExplosao[index], e->x, e->y);	
	}
}
Example #18
0
 void Player::draw() {
     char buf[32];
     
     sprintf(buf, "%d / %d", health, maxHealth);
     textout_ex(Screen::BUFFER, font, buf, x, y - 20, Screen::RED, -1);
     draw_sprite(Screen::BUFFER, sprites[dir], x, y);
     
     /*Screen::printNum(x, 20, 20, Screen::GREEN);
     Screen::printNum(y, 100, 20, Screen::GREEN);
     
     Screen::printNum(movement->getTerminalX(), 20, 40, Screen::BLUE);
     Screen::printNum(movement->getTerminalY(), 100, 40, Screen::BLUE);
     Screen::printNum(lastMove->getTerminalX(), 20, 60, Screen::RED);
     Screen::printNum(lastMove->getTerminalY(), 100, 60, Screen::RED);*/
     
 }
Example #19
0
void BlitToScreen(void)
{
	if (in_gui) {
		float x_ratio = (float)BUFFER_WIDTH / (float)SCREEN_W;
		float y_ratio = (float)BUFFER_HEIGHT / (float)SCREEN_H;
		int mx = (int)((float)mouse_x * x_ratio);
		int my = (int)((float)mouse_y * y_ratio);
		draw_sprite(buffer, mouse_sprite, mx, my);
	}
	if (SCREEN_W == BUFFER_WIDTH && SCREEN_H == BUFFER_HEIGHT) {
		blit(buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
	}
	else {
		stretch_blit(buffer, screen, 0, 0, BUFFER_WIDTH, BUFFER_HEIGHT, 0, 0, SCREEN_W, SCREEN_H);
	}
}
Example #20
0
static void* slide_title_in(void* data, float elapsed_ms, float progress)
{
    struct rectangle c = { 0, 0, 192, 108 };
    struct rectangle r = { 0, 0, 64, 64 };
    struct level_data* ldata = data;
    UNUSED(elapsed_ms);
    clear_image(ldata->title.mask,
                color_from_RGB(255 * progress, 255 * progress, 255 * progress));
    draw_on_image(ldata->title.mask);
    draw_image(ldata->title.spot, -15, 40, &r, 0);
    draw_on_screen();
    draw_image(ldata->title.mask, 0, 0, &c, 0);
    draw_sprite(ldata->title.sprite,
                interpolate(-100, 20, progress, circular_ease_out), 10);
    return NULL;
}
Example #21
0
void carrega_mapa(BITMAP *mapa,BITMAP *texturas[MAX_TERRENOS],int matriz_tela[ALTURA_MAPA/32][LARGURA_MAPA/32])
{
    int i,j;
    clear_bitmap(mapa);
    //rectfill(mapa,0,0,640*5,480,makecol(127,127,127));
    rectfill(mapa,0,0,LARGURA_MAPA,ALTURA_MAPA,makecol(255,0,255));
    for(i=0;i<ALTURA_MAPA/32;i++)
    {
        for(j=0;j<LARGURA_MAPA/32;j++)
        {
            if(matriz_tela[i][j]!=-1)
            {
                draw_sprite(mapa,texturas[matriz_tela[i][j]],j*32,i*32);
            }
        }
    }
}
Example #22
0
    /**
     * Runs the Allegro application.
     */
    void run()
    {
        while(!key[KEY_ESC])
        {
            // Now we let the Gui object perform its logic.
            globals::gui->logic();
            // Now we let the Gui object draw itself.
            globals::gui->draw();

            // We draw the mouse pointer manually, as Allegro's mouse
            // drawing code is so wierd.
            draw_sprite(screenBuffer, mouse_sprite, mouse_x, mouse_y);

            // Finally we update the screen.
            blit(screenBuffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
        }
    }
Example #23
0
static void
draw_sprites (ModeInfo *mi)
{
  slideshow_state *ss = &sss[MI_SCREEN(mi)];
  int i;

  glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

  glPushMatrix();

/*
  {
    GLfloat rot = current_device_rotation();
    glTranslatef (0.5, 0.5, 0);
    glRotatef(rot, 0, 0, 1);
    if ((rot >  45 && rot <  135) ||
        (rot < -45 && rot > -135))
      {
        GLfloat s = MI_WIDTH(mi) / (GLfloat) MI_HEIGHT(mi);
        glScalef (s, 1/s, 1);
      }
    glTranslatef (-0.5, -0.5, 0);
  }
*/

  for (i = 0; i < ss->nsprites; i++)
    draw_sprite (mi, ss->sprites[i]);
  glPopMatrix();

  if (debug_p)				/* draw a white box (the "screen") */
    {
      int wire = MI_IS_WIREFRAME(mi);

      if (!wire) glDisable (GL_TEXTURE_2D);

      glColor4f (1, 1, 1, 1);
      glBegin (GL_LINE_LOOP);
      glVertex3f (0, 0, 0);
      glVertex3f (0, 1, 0);
      glVertex3f (1, 1, 0);
      glVertex3f (1, 0, 0);
      glEnd();

      if (!wire) glEnable (GL_TEXTURE_2D);
    }
}
Example #24
0
void move_sprite(Sprite *sprt, int x, int y, char *base)
{
	int xi = (x > sprt->x) ? sprt->x : x;
	int yi = (y > sprt->y) ? sprt->y : y;
	int xf = (x > sprt->x) ? x + sprt->width : sprt->x + sprt->width;
	int yf = (y > sprt->y) ? y + sprt->height : sprt->y + sprt->height;

	video_buffer = realloc(video_buffer, HRES * VRES);
	flip_buffer_partial(video_buffer, base, xi, yi, xf - xi, yf - yi);

	delete_sprite(sprt, video_buffer);
	sprt->x = x;
	sprt->y = y;
	draw_sprite(sprt, video_buffer);

	flip_buffer_partial(base, video_buffer, xi, yi, xf - xi, yf - yi);
}
void Tile::Draw(BITMAP* buffer, Vector top_left)
{
    int graphic = 5;
    switch (tile_type) {
        case 0: graphic = GLOBDAT_tile_wall1; break;
        case 1: graphic = GLOBDAT_tile_wall2; break;
        case 2: graphic = GLOBDAT_tile_wall3; break; // You never know, there might be enough room for them all
        case 3: graphic = GLOBDAT_tile_path1; break;
        case 4: graphic = GLOBDAT_tile_path2; break;
        default:
        case 5: graphic = GLOBDAT_tile_path3; break;
        case 6: graphic = GLOBDAT_tile_bloodstainedpath;
    }

    if (global_datafile[graphic].dat != NULL)
        draw_sprite(buffer, (BITMAP*)global_datafile[graphic].dat, top_left.XInt(), top_left.YInt());
}
Example #26
0
/* d1 used for group number. */
int d_agtk_radio_proc(int msg, DIALOG *d, int c)
{
    if (msg == MSG_DRAW) {
        BITMAP *bmp = gui_get_screen();
        draw_base(bmp, d);
        draw_sprite(bmp, (d->flags & D_SELECTED) ? radio_down_bmp : radio_up_bmp, d->x+3, d->y+d->h/2-5);

        if (d->dp) {
            gui_textout_ex(bmp, (char *)d->dp,
                           d->x+18, d->y+d->h/2-text_height(font)/2,
                           (d->flags & D_DISABLED) ? nshadow : black, -1, FALSE);
        }
        return D_O_K;
    }

    return d_radio_proc(msg, d, c);
}
Example #27
0
void pon_tortuga(int x1,int y1,int orientacion){
	

	switch (orientacion){
	case 0: draw_sprite(buffer2, im_tortuga, 0,0);
			break;
	//case 1: rotate_sprite(buffer2,im_tortuga,0,0,itofix(64));
	//		break;
	//case 2: rotate_sprite(buffer2,im_tortuga,0,0,itofix(128));
	//		break;
	//case 3: rotate_sprite(buffer2,im_tortuga,0,0,itofix(192));
	//		break;
	default:rotate_sprite(buffer2,im_tortuga,0,0,itofix(orientacion));break;
	}

		  blit(buffer2, screen, 0,0,x1,y1,64,70);
}
Example #28
0
void atirar(){
    tiro.vida = 0; 													// Quando tempo ele ficara na tela?									// Posicao do tiro (eixo X)
    tiro.py = ynave[e];  											// Posicao do tiro (eixo Y)
    int local1 = ((ini * 125) + 15) + 30;           				// Define a posição inicial da colisão
    int local2 = (local1 + 125) - 50;               				// Define a posição final da colisão
    int i = 0;
    if (e == 0){
        tiro.px = xnave[e] + 90;
	}
	else {
	    if (e == 1){
			tiro.px = xnave[e] + 150;
		}
		else {
			if (e == 2){
		        tiro.px = xnave[e] + 60;

			}
		}
	}
    
	while (tiro.vida <= 19){
        blit(buffer, screen, 0,0,0,0,1280,720);     				//Limpa a tela
       	clear_bitmap(buffer);                       				//Limpa a tela
       	draw_sprite(buffer, background[back], 0, 0);      			//Coloca a imagem na tela
       	draw_sprite(screen, nave[e], xnave[e],ynave[e]);     		//Põe a nave na tela
       	if (tiro.py > yini + 125){
        	circlefill(buffer, tiro.px, tiro.py, 5, makecol(255, 0, 0));
			draw_sprite(screen, inimigo[p], xini, yini); 				//Põe a nave na tela
		}
        tiro.py -= 20;												//Velocidade em Y (deslocamento do tiro)
    	tiro.vida += 1;                             				//Contador do "While"

        if (tiro.py <= 105){
			if ((tiro.px >= local1 ) && (tiro.px <= local2 )){
				colisao();
	        	tiro.vida = 25;
        	}
	        else{
				inimigos();
				c += 1;
			}
  }
		if (c == 3){
	        draw_sprite(screen, inimigo[p], xini,yini);   			//Põe os inimigos na tela
			perdeu();
		}
   	}
	blit(buffer, screen, 0,0,0,0,1280,720);     					//Limpa a tela
   	clear_bitmap(buffer);                       					//Limpa a tela
   	draw_sprite(buffer, background[back], 0, 0);      				//Coloca a imagem na tela
   	draw_sprite(screen, nave[e], xnave[e],ynave[e]);     			//Põe a nave na tela
}
Example #29
0
void draw_a_donkey(BITMAP *bmp, BITMAP *sprite, int x, int y, int color, int flip, fixed angle, fixed scale)
{
  BITMAP *temp = create_bitmap(sprite->w, sprite->h);
  clear(temp);

  ((flip)? draw_sprite_h_flip: draw_sprite)(temp, sprite, 0, 0);

  color_map = tint_map;
  draw_lit_sprite(temp, temp, 0, 0, color);
  color_map = NULL;

  if ((angle == itofix(1)) && (scale == itofix(1)))
    draw_sprite(bmp, temp, x, y);
  else
    rotate_scaled_sprite(bmp, temp, x, y, angle, scale);

  destroy_bitmap(temp);
}
Example #30
0
void Font::drawCenter( BITMAP* aBuffer, const std::string& aText, int aX, int aY, int aWidth, int aHeight, int aNumberOfCharacters)
{
	int x = aX + aWidth / 2 - getWidth(aText) / 2;
	int y = aY + aHeight / 2 - getHeight() / 2;

	int characters = aText.size();
	if (aNumberOfCharacters >= 0 && aNumberOfCharacters <= aText.size())
	{
		characters = aNumberOfCharacters;
	}

	for(unsigned int i = 0; i < characters; i++)
	{
		BITMAP* bitmap = getBitmapForGlyph(aText[i]);
		draw_sprite(aBuffer, bitmap, x, y);
		x += bitmap->w;
	}
}