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


C++ create_bitmap函数代码示例

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


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


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