当前位置: 首页>>代码示例>>C++>>正文


C++ draw_sprite函数代码示例

本文整理汇总了C++中draw_sprite函数的典型用法代码示例。如果您正苦于以下问题:C++ draw_sprite函数的具体用法?C++ draw_sprite怎么用?C++ draw_sprite使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了draw_sprite函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: rectfill

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;
}
开发者ID:ArsalanKhairani,项目名称:A3S-Golf,代码行数:14,代码来源:ball.cpp

示例2: menu_oui_non

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;
}
开发者ID:Gotoligcol,项目名称:finn_ice_info,代码行数:37,代码来源:level_editor.c

示例3: lerNomeRecorde

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]);
开发者ID:flaviocdc,项目名称:asteroids-comp1,代码行数:49,代码来源:records.c

示例4: gtk_draw_menu_item

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);
    }
}
开发者ID:ufaith,项目名称:d2imdev,代码行数:49,代码来源:agtk.c

示例5: draw_sprite

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++;
                }
            }
        }
    }
开发者ID:bryancjd1,项目名称:IPOO-2016,代码行数:23,代码来源:mapa2.cpp

示例6: HandleInput

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);
	}
}
开发者ID:CliffsDover,项目名称:NXEngine-iOS,代码行数:36,代码来源:StageSelect.cpp

示例7: mapscreen_to_group

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();
}
开发者ID:Berzzzebub,项目名称:TeeFork,代码行数:15,代码来源:hud.cpp

示例8: affiche_buffer

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;
}
开发者ID:Gotoligcol,项目名称:finn_ice_info,代码行数:15,代码来源:level_editor.c

示例9: getFrame

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;
}
开发者ID:weimingtom,项目名称:db-speedhack07,代码行数:15,代码来源:animation.cpp

示例10: update

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);
}
开发者ID:danwardvs,项目名称:Old-Games,代码行数:24,代码来源:main.cpp

示例11: afficher_obstacle

/********************************************//**
 * \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));
        }
    }
}
开发者ID:perrodma,项目名称:projet_badman,代码行数:26,代码来源:niveaux.c

示例12: draw_speed

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);
}
开发者ID:IntelligAnt,项目名称:langtons-ant,代码行数:24,代码来源:menu_window.c

示例13: draw_rect

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();
}
开发者ID:l3op,项目名称:GTA_Menu_Base,代码行数:15,代码来源:Menu.cpp

示例14: draw_particle

// 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);
	}
}
开发者ID:EXio4,项目名称:Lex4,代码行数:16,代码来源:particle.c

示例15: ttk_button_draw

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);
		}
	}

}
开发者ID:klange,项目名称:toaruos,代码行数:48,代码来源:button.c


注:本文中的draw_sprite函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。