Example #1
0
//-----------------------------------------------------------------------------
void KBusyPtr :: loadCursor (const char* cursorName,const char* maskName)
{
  int i, ix, iy, numX, numY, x, y;
  QBitmap map, mask;
  QBitmap cmap(16,16), cmask(16,16);

  numCursors = 0;

  if (!loadBitmap(map,cursorName)) return;
  if (!loadBitmap(mask,maskName)) return;

  numX = map.width() >> 4;
  numY = map.height() >> 4;
  numCursors = numX * numY;

  if (bitmapList) delete[] bitmapList;
  QSize size(16,16);
  bitmapList = new QBitmap[numCursors];//(size);
  if (cursorList) delete[] cursorList;
  cursorList = new QCursor[numCursors];

  for (i=0,iy=0,y=0; iy<numY; iy++, y+=16)
  {
    for (ix=0,x=0; ix<numX; ix++, x+=16, i++)
    {
      bitBlt(&cmap, 0, 0, &map, x, y, 16, 16);
      bitBlt(&cmask, 0, 0, &mask, x, y, 16, 16);
      cursorList[i] = QCursor(cmap, cmask, 8, 8);
    }
  }
}
Example #2
0
ChopperDrop* initializeChopperDrop()
{
	ChopperDrop* game = (ChopperDrop*) malloc(sizeof(ChopperDrop));

	// Subscribe devices
	game->IRQ_SET_KB = subscribeKeyboard();
	game->IRQ_SET_TIMER = subscribeTimer();
	game->IRQ_SET_MOUSE = subscribeMouse();
	game->IRQ_SET_RTC = subscribeRTC();

	game->done = 0;
	game->draw = 1;
	game->scancode = 0;
	game->timer = newTimer();
	game->date = newDate();

	game->currentState = MAIN_MENU_STATE;
	game->state = newMainMenuState();

    game->mouseCursor = loadBitmap("/home/images/cursor.bmp");

    // Load digits
    int i;
    for (i = 0; i < 10; i++)
    {
    	char filename[40];
    	sprintf(filename, "/home/images/digits/%d.bmp", i);
    	digits[i] = loadBitmap(filename);
    }

    slash = loadBitmap("/home/images/slash.bmp");
    colon = loadBitmap("/home/images/colon.bmp");

	return game;
}
Example #3
0
void init(void)
{
 //背景色
  glClearColor(0.2, 0.2, 0.3, 1.0);

  setCamera();//視点を求める
  setLight(); //光源設定 
	glEnable(GL_DEPTH_TEST);
  glEnable(GL_NORMALIZE);
  printf("マウス/キー操作の説明には'h'キーをプッシュ \n");

  glGenTextures(2, texName);//テクスチャオブジェクトの名前付け
  //Terrainデータの作成
	makeTerrainData();
  Bitmap* bm0 = new Bitmap();
  loadBitmap(bm0, "../../bmp/altgrad4.bmp");
  makeTerrainImage(bm0);
  setTerrainTexture(0);

	//particle用テクスチャ
  Bitmap* bm1 = new Bitmap();
  loadBitmap(bm1, "../../bmp/snow1.bmp");
  makeParticleImage(bm1);
  setParticleTexture(1);
	//時間計測
  lastTime = timeGetTime();
  elapseTime1 = 0.0;
  elapseTime2 = 0.0;
	countP = 0.0;

}
Example #4
0
Bullet* InitBullet(int x_pos, int y_pos, int velx, int vely, int cnn_orientation){
     Bullet *b = (Bullet *)malloc(sizeof(Bullet));
     b->x = x_pos;
     b->y = y_pos;
     b->x_vel = velx;
     b->y_vel = vely;
     b->inUse = 1;
     b->explosion_counter = 0;

	if (cnn_orientation == 1 || cnn_orientation == 3 || cnn_orientation == 5
			|| cnn_orientation == 7)
		b->bullet_bmp = loadBitmap("/home/lcom/Tanks/res/Bullet1.bmp");
	else{
		b->bullet_bmp = loadBitmap("/home/lcom/Tanks/res/Bullet2.bmp");
	}

	b->bulletOrientation = cnn_orientation;
	b->width = b->bullet_bmp->bitmapInfoHeader.width;
	b->height = b->bullet_bmp->bitmapInfoHeader.height;

    switch(cnn_orientation){
    case 1: rotateBitmap(b->bullet_bmp, 4); break;
    case 2: rotateBitmap(b->bullet_bmp, 4); break;
    case 3: rotateBitmap(b->bullet_bmp, -2); break;
    case 4: rotateBitmap(b->bullet_bmp, -2); break;
    case 7: rotateBitmap(b->bullet_bmp, 2); break;
    case 8: rotateBitmap(b->bullet_bmp, 2); break;
    default: break;
    }
     return b;
}
Example #5
0
HighScores* InitHighScores() {
	HighScores* hs = (HighScores*) malloc(sizeof(HighScores));
	hs->HighScore = loadBitmap("/home/lcom/Tanks/res/Highscores.bmp");
	hs->Exit = loadBitmap("/home/lcom/Tanks/res/Exit.bmp");
	hs->Highlight = loadBitmap("/home/lcom/Tanks/res/Selection.bmp");
	hs->exit = 0;
	hs->option = 0;
	hs->counter = 0;
	FILE *file;
	file = fopen("/home/lcom/Tanks/src/Highscores.txt", "r");
	if (file != NULL) {
		int i;
		for(i = 0; i < 9; ++i)
		{
		  if(fgets(hs->cells[i], sizeof hs->cells[i], file) == NULL)
		  {
		   return NULL;
		  }
		  LOG_MSG(hs->cells[i]);
		}
	} else
		return NULL;
	fclose(file);
	int i;
	return hs;
}
Example #6
0
PauseMenu* InitPauseMenu(){
	PauseMenu* pm = (PauseMenu*) malloc(sizeof(PauseMenu));
	pm->ResumeBmp = loadBitmap("/home/lcom/Tanks/res/Resume.bmp");
	pm->ExitBmp = loadBitmap("/home/lcom/Tanks/res/Exit.bmp");
	pm->Highlight = loadBitmap("/home/lcom/Tanks/res/Selection.bmp");
	pm->resume = 0;
	pm->exit = 0;
	pm->option = 0;
	return pm;
}
Example #7
0
void PaletteColor::LoadIcons(){
	Logger::AddLine("Loading refresh.tif",1);
	loadBitmap(m_refreshIcon,"refresh.tif");
	Logger::AddLine("Loading leftArrow.tif",1);
	loadBitmap(m_leftArrowIcon,"leftArrow.tif");
	Logger::AddLine("Loading rightArrow.tif",1);
	loadBitmap(m_rightArrowIcon,"rightArrow.tif");
	Logger::AddLine("Loading cross.tif",1);
    loadBitmap(m_crossIcon, "cross.tif");
}
Example #8
0
Chopper* newChopper()
{
	Chopper* chopper = (Chopper*) malloc(sizeof(Chopper));

	chopper->spriteRight = loadBitmap("/home/lcom/proj/code/images/chopperRight.bmp");
	chopper->spriteLeft = loadBitmap("/home/lcom/proj/code/images/chopperLeft.bmp");

	chopper->width = chopper->spriteLeft->bitmapInfoHeader.width;
	chopper->height = chopper->spriteLeft->bitmapInfoHeader.height;
	chopper->x = - chopper->width - 50;
	chopper->y = STARTING_HEIGHT;

	return chopper;
}
Example #9
0
revtrie loadRevTrie(FILE *f, lztrie trie)
 { 
    revtrie T;
    uint *emptybmap, *id;
    unsigned long long aux;
    T = malloc(sizeof(struct srevtrie));
    if (fread(&T->n,sizeof(uint),1,f) != 1) {
       fprintf(stderr,"Error: Cannot read RevTrie from file\n");
       exit(1);
    }
    T->pdata = loadParentheses(f, 2*T->n,false);
    T->data  = T->pdata->data;
    // loads the bitstring indicating the empty nodes
    emptybmap = malloc(((T->n+W-1)/W)*sizeof(uint));
    if (fread(emptybmap,sizeof(uint),(T->n+W-1)/W,f) != (T->n+W-1)/W) {
       fprintf(stderr,"Error: Cannot read RevTrie from file\n");
       exit(1);
    }
    // creates, from the above bitstring, the bitmap indicating the empty nodes
    T->B = loadBitmap(f,T->n,emptybmap);
    T->nbits = bits(T->n-1);
    T->trie = trie;
    // loads the array of elements of the id permutation
    if (fread(&PARAMETER_T_RIDS,sizeof(uint),1,f) != 1) {
       fprintf(stderr,"Error: Cannot read RevTrie from file\n");
       exit(1);
    }
    T->rids = loadPerm(f);
    T->rids->t = PARAMETER_T_RIDS;
    return T;
 }
Example #10
0
void initEvnTexture() {
    int len = texs.n;
    texs.texture_name = new GLuint[len];
    texs.data = new unsigned char *[len];
    texs.info = new BITMAPINFOHEADER*[len];
    for (int i = 0; i<len; i++) {
        texs.texture_name[i] = -1;
        texs.data[i] = NULL;
    }

    //
    BITMAPINFOHEADER* info_head = new BITMAPINFOHEADER;
    texs.data[0] = loadBitmap("\\texture\\wall_1.bmp",*info_head);
    texs.info[0] = info_head;

    //
    //分配n个名称
    glGenTextures(len,texs.texture_name);
    for (int i =0; i<len; i++) {
        if (texs.data[i] != NULL) {
            glBindTexture(GL_TEXTURE_2D,texs.texture_name[i]);//创建对象
            glTexImage2D(GL_TEXTURE_2D , 0 , 3 , texs.info[i]->biWidth ,
                         texs.info[i]->biHeight,0,GL_RGB,GL_UNSIGNED_BYTE,texs.data[i]);//添加纹理数据
        }
    }
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);// 线形滤波
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);// 线形滤波
    glEnable(GL_TEXTURE_2D);

}
Example #11
0
void initModelTexture() {
    int len = m_texs.n;
    m_texs.texture_name = new GLuint[len];
    m_texs.data = new unsigned char *[len];
    m_texs.info = new BITMAPINFOHEADER*[len];
    for (int i = 0; i<len; i++) {
        m_texs.texture_name[i] = -1;
        m_texs.data[i] = NULL;
    }

    //
    BITMAPINFOHEADER* info_head = new BITMAPINFOHEADER;
    m_texs.data[0] = loadBitmap("\\model\\tris\\blade_black.bmp",*info_head);
    m_texs.info[0] = info_head;
//     BITMAPINFOHEADER* info_head2 = new BITMAPINFOHEADER;
//     m_texs.data[1] = loadBitmap("\\model\\soldier\\AAA.BMP",*info_head2);
//     m_texs.info[1] = info_head2;
    //
    //分配n个名称
    glGenTextures(len,m_texs.texture_name);
    for (int i =0; i<len; i++) {
        if (m_texs.data[i] != NULL) {
            glBindTexture(GL_TEXTURE_2D,m_texs.texture_name[i]);//创建对象
            glTexImage2D(GL_TEXTURE_2D , 0 , 3 , m_texs.info[i]->biWidth ,
                         m_texs.info[i]->biHeight,0,GL_RGB,GL_UNSIGNED_BYTE,m_texs.data[i]);//添加纹理数据
        }
    }
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);// 线形滤波
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);// 线形滤波
    glEnable(GL_TEXTURE_2D);

}
Example #12
0
int main()
{
    char filename[] = "E:\\快盘\\研究生学习\\图像相关科研\\任务\\任务10实现郑培嘉hadamard变换\\实验结果\\watermark\\lena64.bmp";
	printf("%s\n",filename);

	BmpData bmpData;
	initBmpData(&bmpData);
	int ret = 0;

	ret = loadBitmap(filename, &bmpData);
	printf("%d\n",bmpData.bi._bm_compressed);
	printf("%d\n",bmpData.bi._bm_color_depth);
	if( ret != 0 ){
		printf("load bitmap failed! error:%d\n", ret );
		return -1;
	}else{
		printf("load bitmap success!\n" );
	}
    ret=saveBitmap("E:\\快盘\\研究生学习\\图像相关科研\\任务\\任务10实现郑培嘉hadamard变换\\实验结果\\watermark\\lena64OKOKOK.bmp",bmpData);
    if( ret != 0 ){
		printf("save bitmap failed! error:%d\n", ret );
		return -1;
	}else{
		printf("save bitmap success!\n" );
	}


    freeBmpData(&bmpData);

    return 0;
}
Example #13
0
newRecordMenu* newNewRecordMenu(int points){
	newRecordMenu* menu = (newRecordMenu*)malloc(sizeof(newRecordMenu));
	menu->done = 0;
	menu->points = points;

	unsigned long day,month,year;
	getDate(&day,&month,&year);
	year+=2000;
	char dayS[15];
	char monthS[15];
	char yearS[15];
	sprintf(dayS, "%lu", day);
	sprintf(monthS, "%lu", month);
	sprintf(yearS, "%lu", year);

	unsigned int len1 = strlen(dayS);
	unsigned int len2 = strlen(monthS);
	unsigned int len3 = strlen(yearS);

	char *result = (char*)malloc(len1+len2+len3+3);
	memcpy(result, dayS, len1);
	memcpy(result+len1, " ", 1);
	memcpy(result+len1+1, monthS, len2);
	memcpy(result+len1+len2+1, " ", 1);
	memcpy(result+len1+len2+2, yearS, len3+1);//+1 to copy the null-terminator
	menu->data = result;

	menu->nome = "";

	menu->fundo = loadBitmap(getPath("newHighscore.bmp"));
	return menu;
}
Example #14
0
void printBitmap()
{
	int j;

	if(bitmap == NULL)
		loadBitmap();
		
	printf("\n ********** BITMAP MAP  ************\n");
	printf("\n ****[0] -> b7 b6 b5 b4 b3 b2 b1****\n");
	printf("\n ****[1] -> .............. b9 b8****\n");
	printf("\n ***********************************\n");

	for(j=0;j<128;j++)
	{

		printf( "[%3d] -> ", j);

		printBits(sizeof(bitmap[j]),&bitmap[j]);

		printf( "| ");

		if(j%4==3 && j != 0)
			printf( "\n");

		}

	printf("\n ***********************************\n");
}
Example #15
0
void RasterNode::checkReload()
{
    string sLastMaskFilename = m_sMaskFilename;
    string sMaskFilename = m_sMaskHref;
    initFilename(sMaskFilename);
    if (sLastMaskFilename != sMaskFilename) {
        m_sMaskFilename = sMaskFilename;
        try {
            if (m_sMaskFilename != "") {
                AVG_TRACE(Logger::category::MEMORY, Logger::severity::INFO,
                        "Loading " << m_sMaskFilename);
                m_pMaskBmp = loadBitmap(m_sMaskFilename, I8);
                setMaskCoords();
            }
        } catch (Exception & ex) {
            if (ex.getCode() == AVG_ERR_VIDEO_GENERAL) {
                throw;
            }
            m_sMaskFilename = "";
            logFileNotFoundWarning(ex.getStr());
        }
        if (m_sMaskFilename == "") {
            m_pMaskBmp = BitmapPtr();
            getSurface()->setMask(MCTexturePtr());
        }
        if (getState() == Node::NS_CANRENDER && m_pMaskBmp) {
            downloadMask();
        }
    } else {
        setMaskCoords();
    }
}
Example #16
0
revtrie loadRevTrie(FILE *f, lztrie trie)
 { 
    revtrie T;
    uint *emptybmap;
    unsigned long long aux;
    T = malloc(sizeof(struct srevtrie));
    if (fread(&T->n,sizeof(uint),1,f) != 1) {
       fprintf(stderr,"Error: Cannot read RevTrie from file\n");
       exit(1);
    }
    /*aux = (2*(unsigned long long)T->n+W-1)/W;
    T->data = malloc(aux*sizeof(uint));
    if (fread(T->data,sizeof(uint),aux,f) != aux) {
       fprintf (stderr,"Error: Cannot read RevTrie from file\n");
       exit(1);
    } */                                                                      
    T->pdata = loadParentheses(f, 2*T->n, false);
    T->data = T->pdata->data;
    // loads the bitstring indicating the empty nodes
    emptybmap = malloc(((T->n+W-1)/W)*sizeof(uint));
    if (fread(emptybmap,sizeof(uint),(T->n+W-1)/W,f) != (T->n+W-1)/W) {
       fprintf(stderr,"Error: Cannot read RevTrie from file\n");
       exit(1);
    }
    // creates, from the above bitstring, the bitmap indicating the empty nodes
    T->B = loadBitmap(f, T->n, emptybmap);
    T->trie = trie;
    return T;
 }
Example #17
0
void Image::setFilename(const std::string& sFilename, TextureCompression comp)
{
    assertValid();
    AVG_TRACE(Logger::category::MEMORY, Logger::severity::INFO, "Loading " << sFilename);
    BitmapPtr pBmp = loadBitmap(sFilename);
    if (comp == TEXTURECOMPRESSION_B5G6R5 && pBmp->hasAlpha()) {
        throw Exception(AVG_ERR_UNSUPPORTED, 
                "B5G6R5-compressed textures with an alpha channel are not supported.");
    }
    changeSource(FILE);
    m_pBmp = pBmp;

    m_sFilename = sFilename;

    switch (comp) {
        case TEXTURECOMPRESSION_B5G6R5:
            m_pBmp = BitmapPtr(new Bitmap(pBmp->getSize(), B5G6R5, sFilename));
            if (!BitmapLoader::get()->isBlueFirst()) {
                FilterFlipRGB().applyInPlace(pBmp);
            }
            m_pBmp->copyPixels(*pBmp);
            break;
        case TEXTURECOMPRESSION_NONE:
            break;
        default:
            assert(false);
    }

    if (m_State == GPU) {
        m_pSurface->destroy();
        setupSurface();
    }
    assertValid();
}
Example #18
0
void init(void)
{
 //背景色
  glClearColor(0.2, 0.2, 0.3, 1.0);

  setCamera();//視点を求める
  setLight(); //光源設定 
	glEnable(GL_DEPTH_TEST);
  glEnable(GL_NORMALIZE);
  printf("マウス/キー操作の説明には'h'キーをプッシュ \n");

  //Terrainデータの作成
	makeTerrainData();
  Bitmap* bm0 = new Bitmap();
  loadBitmap(bm0, "../../bmp/altgrad4.bmp");
  makeTerrainImage(bm0);
  setTerrainTexture();
	//particle
  countP = 0;
  fps = 0;
  elapseTime1 = 0.0;//1sec間以内の経過時間
  elapseTime2 = 0.0; //init()後の総経過時間
  for(int i = 0; i < NUM_PARTICLE; i++) p[i] = CParticle();
  for(int i = 0; i < NUM_PARTICLE2; i++) q[i] = CParticle2();
	frameCount = 0;
}
Example #19
0
SaveMenu* InitSaveMenu(int score) {
	SaveMenu* sm = (SaveMenu*) malloc(sizeof(SaveMenu));
	sm->Exit = loadBitmap("/home/lcom/Tanks/res/Exit.bmp");
	sm->Highlight = loadBitmap("/home/lcom/Tanks/res/Selection.bmp");
	sm->Highlight2 = loadBitmap("/home/lcom/Tanks/res/Selection2.bmp");
	sm->flag1 = 0;
	sm->flag2 = 0;
	sm->flag3 = 0;
	sm->Letter1 = 'X';
	sm->Letter2 = 'X';
	sm->Letter3 = 'X';
	sm->key = 0;
	sm->exit = 0;
	sm->option = 0;
	sm->score = score;
	return sm;
}
Example #20
0
// Verifica se bloco está livre ou ocupado
// Retorna 1 se está ocupado e 0 se está livre
int bitStatus(unsigned int block)
{
	// bit verificado
	int bitOffset = block%BITS_PER_WORD;
	// caracter verificado
	int wordOffset = block/BITS_PER_WORD;
   
	if(bitmap == NULL)
		loadBitmap();

	if(block < 0 || block > NOF_BLOCKS)
		return -1;

	if(bitmap == NULL)
		loadBitmap();
	
	return (bitmap[wordOffset] & (1 << bitOffset));
}
Example #21
0
void OBMButton::Create(CWnd *parent, int res, int resD, int resI, const CPoint &pos, UINT id, bool tabStop) {
  int flags = WS_CHILD | WS_VISIBLE | BS_NOTIFY | BS_OWNERDRAW;
  if(tabStop) flags |= WS_TABSTOP;

  if(!CBitmapButton::Create(EMPTYSTRING
                           ,flags
                           ,CRect(pos.x,pos.y,pos.x+16,pos.y+16)
                           ,parent
                           ,id)) {
    throwException(_T("%s:CBitmapButton::Create failed"), __TFUNCTION__);
  }
  loadBitmap(m_bitmap        ,res );
  loadBitmap(m_bitmapSel     ,resD);
  loadBitmap(m_bitmapFocus   ,res );
  loadBitmap(m_bitmapDisabled,resI);
  SizeToContent();
  SetPosition(pos.x,pos.y,false);
}
Example #22
0
BitmapPtr ResourceLoader::getBitmap(const char *fname) {
	for (Common::List<Bitmap *>::const_iterator i = _bitmaps.begin(); i != _bitmaps.end(); ++i) {
		Bitmap *b = *i;
		if (strcmp(fname, b->filename()) == 0) {
			return b;
		}
	}

	return loadBitmap(fname);
}
Example #23
0
GameOverState* newGameOverState()
{
	GameOverState* state = (GameOverState*) malloc(sizeof(GameOverState));

	state->done = 0;

	state->background = loadBitmap("/home/images/gameOver.bmp");

	return state;
}
Example #24
0
bool IFFDecoder::loadStream(Common::SeekableReadStream &stream) {
	destroy();

	const uint32 form = stream.readUint32BE();

	if (form != ID_FORM) {
		warning("Failed reading IFF-file");
		return false;
	}

	stream.skip(4);

	const uint32 type = stream.readUint32BE();

	switch (type) {
		case ID_ILBM:
			_type = TYPE_ILBM;
			break;
		case ID_PBM:
			_type = TYPE_PBM;
			break;
	}

	if (type == TYPE_UNKNOWN) {
		warning("Failed reading IFF-file");
		return false;
	}

	while (1) {
		const uint32 chunkType = stream.readUint32BE();
		const uint32 chunkSize = stream.readUint32BE();

		if (stream.eos())
			break;

		switch (chunkType) {
		case ID_BMHD:
			loadHeader(stream);
			break;
		case ID_CMAP:
			loadPalette(stream, chunkSize);
			break;
		case ID_CRNG:
			loadPaletteRange(stream, chunkSize);
			break;
		case ID_BODY:
			loadBitmap(stream);
			break;
		default:
			stream.skip(chunkSize);
		}
	}

	return true;
}
Example #25
0
void IEToolbar::setupToolbarImages() {
  // Determine if MS Windows is right aligned and load toolbar icons
  // depending on it
  int resId = isBiDi(LOCALE_SYSTEM_DEFAULT) ? 
    IDB_IETOOLBAR_BUTTONS_RTL : IDB_IETOOLBAR_BUTTONS;
  const BitmapPtr buttonsBitmap = loadBitmap(resId);
  const ImageListPtr buttonsImageList = createButtonsImageList(*buttonsBitmap);
  toolbarWindow_.setImageList(buttonsImageList);

  shareButtonBitmap_ = generateShareBitmap(false);
}
Example #26
0
void loadTextures(){
  int i;
  
  for(i=0;i<nBitmaps;i++){
    if(i > NTEXTURES - 1){
      perror("Ran out of room for textures... won't read any more\n");
      break;
    }
    loadBitmap(bitmaps[i], texNames[i], TEXW, TEXH);
    texcount++;
  }
}
Example #27
0
void makeTexture()
{
  glGenTextures(6, texName);
	
	Bitmap* bm0 = new Bitmap();
	loadBitmap(bm0, "../../bmp/disk4.bmp");
	makeTexImage(bm0);
	setColorMap(0);
	makeNormalMap(bm0);
	setNormalMap(0);

	loadBitmap(bm0, "../../bmp/brick2.bmp");
	makeTexImage(bm0);
	setColorMap(1);
	makeNormalMap(bm0);
	setNormalMap(1);

	loadBitmap(bm0, "../../bmp/stones1.bmp");
	makeTexImage(bm0);
	setColorMap(2);
	makeNormalMap(bm0);
	setNormalMap(2);
}
Example #28
0
void updateBulletPool(BulletPool *bp){
	int i;
	for (i = 0; i < 5; i++) {
		if (bp->particles_[i]->inUse == 1 && bp->particles_[i]->explosion_counter == 0){
			moveBullet(bp->particles_[i]);
			if(checkScreenCollision(bp->particles_[i])){
				bp->particles_[i]->inUse = 0;
				bp->particles_[i]->explosion_counter = 1;
				bp->particles_[i]->bullet_exp = loadBitmap("/home/lcom/Tanks/res/Spark1.bmp");
			}
		}
		else if(bp->particles_[i]->inUse == 0 && bp->particles_[i]->explosion_counter == 5)
			bp->particles_[i] = CreateBullet(0);
	}
}
Example #29
0
void drawBullet(Bullet* b) {
	if (b->inUse)
		drawBitmap(b->bullet_bmp, b->x, b->y, ALIGN_LEFT, 0);
	else if(b->explosion_counter > 0 && b->explosion_counter <= 5){
		drawBitmap(b->bullet_exp, b->x, b->y, ALIGN_LEFT, 0);
		b->explosion_counter++;
		switch (b->explosion_counter) {
		case 2:
			b->bullet_exp = loadBitmap(
					"/home/lcom/Tanks/res/Spark2.bmp");
			break;
		case 3:
			b->bullet_exp = loadBitmap(
								"/home/lcom/Tanks/res/Spark3.bmp");
			break;
		case 4:
			b->bullet_exp = loadBitmap("/home/lcom/Tanks/res/Spark4.bmp");
			break;
		case 5:
			b->bullet_exp = loadBitmap("/home/lcom/Tanks/res/Spark5.bmp");
			break;
		}
	}
}
Example #30
0
// Procura pelo primeiro bloco livre
unsigned int findFreeBlock()
{

	unsigned int i;

	if(bitmap == NULL)
		loadBitmap();

	for(i=0;i<NOF_BLOCKS;i++)
		if(!bitStatus(i))
			return i;

	// Não achou nenhum bloco livre
	return -1;

}