• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ create_bitmap函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: update_room0_cache

void
update_room0_cache (enum em em, enum vm vm)
{
  room_view = 0;
  struct pos mouse_pos_bkp = mouse_pos;
  invalid_pos (&mouse_pos);
  con_caching = true;

  if (! room0) room0 = create_bitmap (ORIGINAL_WIDTH, ORIGINAL_HEIGHT);

  clear_bitmap (room0, TRANSPARENT_COLOR);

  mr.dx = 0;
  mr.dy = 0;
  draw_room (room0, 0, em, vm);

  con_caching = false;
  mouse_pos = mouse_pos_bkp;
}
开发者ID:oitofelix,项目名称:mininim,代码行数:19,代码来源:multi-room.c


示例2: startGame

int startGame(){
	configAll();

	BITMAP * nave = load_bitmap("img/35x45/nave.bmp",NULL);
	BITMAP * alien = load_bitmap("img/35x45/alien.bmp", NULL);
	BITMAP * gun = load_bitmap("img/35x45/gun.bmp", NULL);
	BITMAP * init = load_bitmap("img/start.bmp", NULL);
	BITMAP * bg = load_bitmap("img/bartop.bmp", NULL);
	BITMAP * buffer = create_bitmap(SCREEN_W,SCREEN_H);
	SAMPLE * sound = load_wav("wav/tiro.wav");
	SAMPLE * music = load_sample("wav/laserHit.wav");

	initStart(buffer,init);
	install_int_ex(countXa,SECS_TO_TIMER(1));
	install_int_ex(countGun,MSEC_TO_TIMER(1));
	gameControll(nave,buffer,alien,gun,bg,sound,music);
	destroyAll(nave,buffer,alien,gun,init,bg,sound,music);
	return 0;
}
开发者ID:narukaioh,项目名称:Space-Invaders,代码行数:19,代码来源:main.c


示例3: throw

void Animation::load(PACKFILE* f) throw (std::bad_alloc, ReadError)
{
	int nameLen = igetl(f);

	name = (char*)malloc(nameLen+1);

	for (int i = 0; i < nameLen; i++)
		name[i] = my_pack_getc(f);
	name[nameLen] = 0;

	numFrames = igetl(f);
	int width = igetl(f);
	int height = igetl(f);

	try {
		frames = new BITMAP*[numFrames];

		for (int i = 0; i < numFrames; i++)
			frames[i] = 0;

		for (int i = 0; i < numFrames; i++) {
			frames[i] = create_bitmap(width, height);
			if (!frames[i])
				throw new std::bad_alloc();
		}

		delays = new int[numFrames];

		for (int i = 0; i < numFrames; i++) {
			loadFrame(width, height, frames[i], &delays[i], f);
		}
	}
	catch (...) {
		free(name);
		for (int i = 0; i < numFrames; i++)
			if (frames[i])
				destroy_bitmap(frames[i]);
		if (delays)
			delete[] delays;
		throw new std::bad_alloc();
	}
}
开发者ID:carriercomm,项目名称:monster,代码行数:42,代码来源:animation.cpp


示例4: main

int main(void)
{
    BITMAP *memory_bitmap;
    int x, y;

    if (allegro_init() != 0)
        return 1;
    install_keyboard();

    if (set_gfx_mode(GFX_AUTODETECT, 320, 200, 0, 0) != 0) {
        if (set_gfx_mode(GFX_SAFE, 320, 200, 0, 0) != 0) {
            set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
            allegro_message("Unable to set any graphic mode\n%s\n", allegro_error);
            return 1;
        }
    }

    set_palette(desktop_palette);

    /* make a memory bitmap sized 20x20 */
    memory_bitmap = create_bitmap(20, 20);

    /* draw some circles onto it */
    clear_bitmap(memory_bitmap);
    for (x=0; x<16; x++)
        circle(memory_bitmap, 10, 10, x, palette_color[x]);

    /* blit lots of copies of it onto the screen */
    acquire_screen();

    for (y=0; y<SCREEN_H; y+=20)
        for (x=0; x<SCREEN_W; x+=20)
            blit(memory_bitmap, screen, 0, 0, x, y, 20, 20);

    release_screen();

    /* free the memory bitmap */
    destroy_bitmap(memory_bitmap);

    readkey();
    return 0;
}
开发者ID:kazzmir,项目名称:allegro4-to-5,代码行数:42,代码来源:exmem.c


示例5: create_bitmap

//draw with rotation
void sprite::drawframe(BITMAP *dest, int angle)  {
    if (!this->image) return;

    //create scratch frame if necessary
    if (!this->frame) {
        this->frame = create_bitmap(this->width, this->height);
    }


    //first, draw frame normally but send it to the scratch frame image
    int fx = this->animstartx + (this->curframe % this->animcolumns) * this->width;
    int fy = this->animstarty + (this->curframe / this->animcolumns) * this->height;
    blit(this->image, this->frame, fx, fy, 0, 0, this->width, this->height);

    //draw rotated image in scratch frame onto dest 
    //adjust for Allegro's 16.16 fixed trig (256 / 360 = 0.7) then divide by 2 radians
    rotate_sprite(dest, this->frame, (int)this->x, (int)this->y, 
        itofix((int)(angle / 0.7f / 2.0f)));

}
开发者ID:davecalkins,项目名称:space-words,代码行数:21,代码来源:sprite.cpp


示例6: IniciaGrafica

void IniciaGrafica(){
    if (allegro_init() != 0) return;
    install_keyboard();
    install_timer();

   if (set_gfx_mode(GFX_AUTODETECT_WINDOWED, VentanaX, VentanaY, 0, 0) != 0) {
      if (set_gfx_mode(GFX_SAFE, VentanaX, VentanaY, 0, 0) != 0) {
     set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
     allegro_message("Unable to set any graphic mode\n%s\n", allegro_error);
     return;
      }
   }
    set_palette(desktop_palette);
    /* allocate the memory buffer */
    buffer = create_bitmap(SCREEN_W, SCREEN_H);
    clear_keybuf();

    divisionY = VentanaY/nCeldas_i;
    divisionX = VentanaX/nCeldas_j;
}
开发者ID:baceituno,项目名称:tesis-hexapodo,代码行数:20,代码来源:Nodo5_ConstruccionDeMapa.cpp


示例7: init_moveable

/*
  ==============================
  =  Stuff that didn't fit in  =
  ==============================
*/
int init_moveable(DIALOG *dialog)
{
 BITMAP *backbuffer = create_bitmap(dialog->w+1, dialog->h+1);
 BILLWIN_INFO_STRUCTURE *infostruct = malloc(sizeof(BILLWIN_INFO_STRUCTURE));

 /* We do NOT need to memverify the above, if they aren't there, the window will
    notice, and disable the moving routine */

 if (backbuffer) {
  scare_mouse();
  blit(screen, backbuffer, dialog->x, dialog->y, 0, 0, dialog->w+1, dialog->h+1);
  unscare_mouse();
 }

 if(infostruct)
  infostruct->backbuffer = backbuffer;
 dialog->dp3 = infostruct;

 return 0;
}
开发者ID:rofl0r,项目名称:GfxRip,代码行数:25,代码来源:bgui.c


示例8: rfs_fmat

void rfs_fmat(device_t * devp)
{
    printfk("rfs_fmat begin\n\r");
    if(create_superblk(devp) == FALSE)
    {
	hal_sysdie("create superblk failed");
    }

    if(create_bitmap(devp) == FALSE)
    {
	hal_sysdie("create bitmap failed");
    }

    if(create_rootdir(devp) == FALSE)
    {
	hal_sysdie("create rootdir failed");
    }

    return;
}
开发者ID:jian-tian,项目名称:myproc,代码行数:20,代码来源:drvfs.c


示例9: draw_block

void draw_block(BITMAP *bmp, int x, int y, BLOCK block, int dark)
{
  if (!block_bmp)
    block_bmp = create_bitmap(BLOCK_SIZE, BLOCK_SIZE);

  if (block) {
    if (!(block & 0xf0) || ((block & 0xf0) == BLOCK_GRAY))
      blit(datafile[BLOCK_BMP].dat, block_bmp, 0, 0, 0, 0, BLOCK_SIZE, BLOCK_SIZE);
    else {
      blit(datafile[BLOCK_BMP].dat, block_bmp,
        ((block & 0xf0) >> 4) * BLOCK_SIZE, 0, 0, 0, BLOCK_SIZE, BLOCK_SIZE);

      block = PAL_GRAY;
      dark = FALSE;
    }

    color_map = (dark)? tint_dark_map: tint_map;
    draw_lit_sprite(bmp, block_bmp, x, y, (block & 0x0f));
  }
}
开发者ID:dacap,项目名称:tetrisqueen,代码行数:20,代码来源:block.c


示例10: initialize_jukebox

/**
 * Switches to graphics mode, installs Allegro drivers and initializes
 * variables used by the jukebox.
 */
void initialize_jukebox() {
    // Switch to graphics mode.
    initialize_allegro();
    screen_gfx_mode();
    initialize_sound();
    load_flim_dat();

    // Prepare for the jukebox loop.
    buffer = create_bitmap(SCREEN_W, SCREEN_H);
    RGB *pal = get_starfield_palette();
    add_flim_palette_colors(pal);
    set_palette(pal);
    free(pal);
    font_height = FLIM_HEIGHT;
    help_text_x = SCREEN_W / 2;
    help_text_y1 = SCREEN_H - (font_height * 5) - (font_height / 2);
    help_text_y2 = SCREEN_H - (font_height * 4) - (font_height / 2);
    help_text_y3 = SCREEN_H - (font_height * 3);
    help_text_y4 = SCREEN_H - (font_height * 2);
}
开发者ID:msikma,项目名称:ceegee,代码行数:24,代码来源:jukebox.c


示例11: mCharacter

Opponent::Opponent(Character character):
	mCharacter(character)
{
	mPositionX = 900;
	mPositionY = 520;

	mBitmap = create_bitmap(32, 32);

	switch (mCharacter)
	{
		case Luigi:
			mSprite = load_bitmap("Data/Luigi.bmp", NULL);
			break;
		case Peach:
			mSprite = load_bitmap("Data/Peach.bmp", NULL);
	}

	floodfill(mBitmap, 0, 0, makecol(0, 0, 0));
	blit(mSprite, mBitmap, 0, 0, 0, 0, 32, 32);
}
开发者ID:gustavosbarreto,项目名称:mario-kart,代码行数:20,代码来源:Opponent.cpp


示例12: get_tiles

int get_tiles()
{
	int x,y,z;
	for(x=0 ; x<=(tilebuffer_height_in_tiles * tilebuffer_width_in_tiles) ; x++)
	{
		tile[x] = create_bitmap(tile_width , tile_width);
	}

	z=0;
	for (y=0 ; y < tilebuffer_height_in_tiles * tile_width ; y+=32)
	{
		for (x=0 ; x < tilebuffer_width_in_tiles * tile_width ; x+=32)
		{	
			blit ( tile_buffer, tile[z], x,y, 0,0, tile_width,tile_width);
			z++;
		}
	}

	return 0;
}
开发者ID:SamPearson,项目名称:game-engine,代码行数:20,代码来源:gfx.cpp


示例13: enemy_init

/*! \brief Initialise enemy & sprites for combat
 *
 * If required, load the all the enemies, then
 * init the ones that are going into battle, by calling make_enemy() and
 * copying the graphics sprites into cframes[] and tcframes[].
 * Looks at the cf[] array to see which enemies to do.
 *
 * \author PH
 * \date 2003????
 */
void enemy_init (void)
{
   int i, p;
   s_fighter *f;
   if (enemies == NULL)
      load_enemies ();
   for (i = 0; i < numens; ++i) {
      f = make_enemy (cf[i], &fighter[i + PSIZE]);
      for (p = 0; p < MAXCFRAMES; ++p) {
         /* If, in a previous combat, we made a bitmap, destroy it now */
         if (cframes[i + PSIZE][p])
            destroy_bitmap (cframes[i + PSIZE][p]);
         /* and create a new one */
         cframes[i + PSIZE][p] = create_bitmap (f->img->w, f->img->h);
         blit (f->img, cframes[i + PSIZE][p], 0, 0, 0, 0, f->img->w,
               f->img->h);
         tcframes[i + PSIZE][p] = copy_bitmap (tcframes[i + PSIZE][p], f->img);
      }
   }
}
开发者ID:rj76,项目名称:kq,代码行数:30,代码来源:enemyc.c


示例14: allegro_init

	void Screen::init() {
		allegro_init(); // Starts allegro
		set_color_depth(COLOR_DEPTH); // Sets the pixel color depth format
		set_gfx_mode(GFX_AUTODETECT_WINDOWED, LENGTH_X, LENGTH_Y, 0, 0); // Creates a windowed screen
		install_keyboard(); // Prepares the keyboard for input
		
		BUFFER = create_bitmap(LENGTH_X, LENGTH_Y); // Creates the buffer bitmap
		
        // Correctly assigns the colors
		BLACK = makecol(0, 0, 0);
		WHITE = makecol(255, 255, 255);
		GRAY = makecol(100, 100, 100);
		RED = makecol(255, 0, 0);
		GREEN = makecol(0, 255, 0);
		BLUE = makecol(0, 0, 255);
		YELLOW = makecol(255, 255, 0);
		ORANGE = makecol(255, 150, 0);
		BROWN = makecol(150, 75, 0);
		PURPLE = makecol(150, 0, 150);
	}
开发者ID:Boskin,项目名称:Labyrinth,代码行数:20,代码来源:screen.cpp


示例15: main

int main(){

allegro_init();
install_keyboard();
/*
install_sound (DIGI_AUTODETECT, MIDI_AUTODETECT, NULL);
MIDI *music;
music = load_midi("./99.midd");
if (!music)
    {std::cerr<<"Couldn't load background music!"<<std::endl;exit(1);}
else
	play_midi(music,1);
*/
set_gfx_mode( GFX_AUTODETECT, 1920, 1200, 0, 0);
buffer = create_bitmap( 1920, 1200); 

 while ( !key[KEY_ESC] ){
    
        clear_keybuf();
        

        
        if (key[KEY_UP]) rotateY(-2);        
        else if (key[KEY_DOWN]) rotateY(2);    
        else if (key[KEY_RIGHT]) rotateX(2);
        else if (key[KEY_LEFT]) rotateX(-2);
		else if (key[KEY_PGUP]) rotateZ(-2);
		else if (key[KEY_PGDN]) rotateZ(2);

        draw();

	}
	/*
	if(music)
	{
	stop_midi();
	destroy_midi(music);
	}
	*/
return 0;
}
开发者ID:shen9175,项目名称:pure-software-CPU-calculation-for-3D-vertex-transformation,代码行数:41,代码来源:allegro.cpp


示例16: Data_UpdateVideoMode

// Convert truecolor graphics stored in datafile in current native format
void    Data_UpdateVideoMode()
{
    int i;
    t_list *bmp_copies;

    assert(g_Datafile != NULL);
    bmp_copies = g_DatafileBitmapCopy32;

    if (bmp_copies == NULL)
    {
		// First time, copy everything into 32-bits buffers.
        fixup_datafile(g_Datafile);
        for (i = 0; g_Datafile[i].type != DAT_END; i++)
        {
            if (g_Datafile[i].type == DAT_BITMAP)
            {
                BITMAP * dat_bmp = g_Datafile[i].dat;
                BITMAP * copy_bmp = create_bitmap_ex(32, dat_bmp->w, dat_bmp->h);
                blit(dat_bmp, copy_bmp, 0, 0, 0, 0, dat_bmp->w, dat_bmp->h);
                list_add_to_end(&g_DatafileBitmapCopy32, copy_bmp);
            }
        }
        bmp_copies = g_DatafileBitmapCopy32;
    }

    for (i = 0; g_Datafile[i].type != DAT_END; i++)
    {
        if (g_Datafile[i].type == DAT_BITMAP)
        {
			// Recreate it all
			BITMAP * src_bmp = bmp_copies->elem;
			BITMAP * dst_bmp = create_bitmap( src_bmp->w, src_bmp->h );
			destroy_bitmap( g_Datafile[i].dat );
			g_Datafile[i].dat = dst_bmp;
			blit(src_bmp, dst_bmp, 0, 0, 0, 0, src_bmp->w, src_bmp->h);
            bmp_copies = bmp_copies->next;
        }
    }
    //fixup_datafile(g_Datafile);
	Data_UpdateNamedPointers();
}
开发者ID:dafyddcrosby,项目名称:meka,代码行数:42,代码来源:data.c


示例17: gui_create_window

int gui_create_window(int x, int y, int w, int h, char *title, int draggable)
{
   /* Note there's a new window, and create it */

   gui_num_windows++;

   gui_window = realloc(gui_window,sizeof(GUI_WINDOW)*gui_num_windows);

   /* Setup its parameters */

   gui_window[gui_num_windows-1].x = x;
   gui_window[gui_num_windows-1].y = y;
   gui_window[gui_num_windows-1].width = w;
   gui_window[gui_num_windows-1].height = h;
   gui_window[gui_num_windows-1].content_changed = TRUE;
   gui_window[gui_num_windows-1].visible = TRUE;
   sprintf(gui_window[gui_num_windows-1].title,"%s",title);

   /* create its rendering bitmap */

   gui_window[gui_num_windows-1].bmp = create_bitmap(w+(gui_border_size*2),h+(gui_border_size*2)+gui_titlebar_height);

   /* Init the rest of its properties */

   gui_window[gui_num_windows-1].draggable = draggable;
   gui_window[gui_num_windows-1].picture = NULL;
   gui_window[gui_num_windows-1].num_labels = 0;
   gui_window[gui_num_windows-1].label = NULL;
   gui_window[gui_num_windows-1].num_buttons = 0;
   gui_window[gui_num_windows-1].button = NULL;
   gui_window[gui_num_windows-1].num_lists = 0;
   gui_window[gui_num_windows-1].list = NULL;

   /* Make this window topmost */

   gui_window_topmost = gui_num_windows-1;

   /* Return this window's ID */

   return gui_num_windows-1;
}
开发者ID:cravo,项目名称:damp,代码行数:41,代码来源:gui.c


示例18: erlog

void AnimFrame::Draw(BITMAP* bmp, Vector pos, float scale, bool vertical_flip, float rotation, int alpha)
{
    BITMAP* graphic = (BITMAP*)global_datafile[graphic_id].dat;
    if (graphic == NULL) {
        erlog("Graphic ID out of bounds in frame draw", 3);
        return;
    }
    if (bmp == NULL) {
        erlog("Buffer out of bounds in frame draw", 3);
        return;
    }
    if (scale == 0.0 && vertical_flip == false && rotation == 0.0 && (alpha >= 256 || alpha < 0)) {
        draw_sprite(bmp, graphic, pos.XInt(), pos.YInt());
        return;
    }
    if (alpha >= 256 || alpha < 0) {
        if (vertical_flip == false) {
            rotate_scaled_sprite(bmp, graphic, pos.XInt(), pos.YInt(), fixmul(ftofix(rotation), radtofix_r), ftofix(scale));
            return;
        }
        rotate_scaled_sprite_v_flip(bmp, graphic, pos.XInt(), pos.YInt(), fixmul(ftofix(rotation), radtofix_r), ftofix(scale));
        return;
    }


    float fdiagonal = sqrt(static_cast<float>(graphic->w*graphic->w + graphic->h*graphic->h));
    int diagonal = static_cast<int>(fdiagonal + 1);
    BITMAP* temp_bmp = create_bitmap(diagonal, diagonal);

    if (vertical_flip == false) {
        rotate_scaled_sprite(temp_bmp, graphic, 0, 0, fixmul(ftofix(rotation), radtofix_r), ftofix(scale));
    }
    else {
        rotate_scaled_sprite_v_flip(temp_bmp, graphic, 0, 0, fixmul(ftofix(rotation), radtofix_r), ftofix(scale));
    }

    set_trans_blender(0, 0, 0, alpha);
    drawing_mode(DRAW_MODE_TRANS, 0, 0, 0);
    draw_trans_sprite(temp_bmp, bmp, pos.XInt(), pos.YInt());
    drawing_mode(DRAW_MODE_SOLID, 0, 0, 0);
}
开发者ID:amarillion,项目名称:TINS-Is-not-speedhack-2010,代码行数:41,代码来源:animation.cpp


示例19: Abertura

void Abertura (void)
{
	BITMAP *buffer;
	SAMPLE *som, *grito, *som2, *som3;

	buffer = create_bitmap(LARGURA, ALTURA);

	carregaSom_Abertura(&som3, "../audio/thunder.wav");
	play_sample(som3, 255, 128, 1000, FALSE);
	rest (1000);

	carregaImg_Abertura(&buffer, "../grafics/img01.tga");
	highcolor_fade_in_Abertura(buffer, 3);

	carregaSom_Abertura(&som, "../audio/00.wav");
	play_sample(som, 255, 128, 1000, FALSE);

	carregaSom_Abertura(&som2, "../audio/a_thunder.wav");
	play_sample(som2, 255, 128, 1000, FALSE);
	rest (2500);

	carregaImg_Abertura(&buffer, "../grafics/img02.tga");

	play_sample(som, 255, 128, 1000, FALSE);

	carregaSom_Abertura(&som, "../audio/01.wav");
	play_sample(som, 1000, 128, 1000, FALSE);

	carregaSom_Abertura(&grito, "../audio/scream05.wav");
	play_sample(grito, 255, 128, 1000, FALSE);

	blit(buffer,screen,0,0,0,0,LARGURA,ALTURA);
	highcolor_fade_out_Abertura (5);
	rest(1000);

	destroy_sample(som);
	destroy_sample(som2);
	destroy_sample(som3);
	destroy_sample(grito);
	destroy_bitmap(buffer);
}
开发者ID:rafaelol,项目名称:bejewled,代码行数:41,代码来源:abertura.c


示例20: main

int main()
{
    allegro_init();
    install_keyboard();

    set_color_depth(32);
    set_gfx_mode(GFX_AUTODETECT_WINDOWED, 900, 600, 0, 0);

    buffer = create_bitmap(900, 600);
    roca = load_bitmap("Images/roca.bmp", NULL);

    while(!key[KEY_ESC])
    {

        dibujar_mapa();
        pantalla();
    }


    return 0;
}
开发者ID:emipochettino,项目名称:Pacman,代码行数:21,代码来源:main.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ create_bitmap_ex函数代码示例发布时间:2022-05-30
下一篇:
C++ create_area函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap