Exemplo n.º 1
0
void drawChopper(Chopper* chopper, int timerCounter)
{
	if (timerCounter % 2 == 0)
		drawBitmap(chopper->spriteRight, chopper->x, chopper->y, ALIGN_LEFT);
	else
		drawBitmap(chopper->spriteLeft, chopper->x, chopper->y, ALIGN_LEFT);
}
Exemplo n.º 2
0
void BombField::repaint()
{
	int y = 65, x;
	for (int i = 0; i < length; i++)
	{
		x = 15;
		for (int j = 0; j < width; j++)
		{
			switch (test[i][j].contents)
			{
			case CELL_EMPTY:
				drawBitmap(test[i][j].leftup.x, test[i][j].leftup.y, hBmpEmpty); break;
			case CELL_DIGIT:
				repaintDigit(i,j); break;
			case CELL_FLAG:
				drawBitmap(test[i][j].leftup.x, test[i][j].leftup.y, hBmpFlag); break;
			case CELL_QM:
				drawBitmap(test[i][j].leftup.x, test[i][j].leftup.y, hBmpQm); break;
			case CELL_EXPL:
				drawBitmap(test[i][j].leftup.x, test[i][j].leftup.y, hBmpExploded); break;
			}
			x += 33;
		}
		y += 24;
	}
}
Exemplo n.º 3
0
void drawSaveMenu(SaveMenu* sm){
	Font* font = InitFont();
	drawBitmap(sm->Exit, Exit3X, Exit3Y, ALIGN_LEFT, 0);
	if (sm->exit == 1) {
		drawBitmap(sm->Highlight, Exit3X, Exit3Y, ALIGN_LEFT, 0);
	} else if (sm->flag1 == 1) {
		drawBitmap(sm->Highlight2, 500, 235, ALIGN_LEFT, 0);
	} else if (sm->flag2 == 1) {
		drawBitmap(sm->Highlight2, 550, 235, ALIGN_LEFT, 0);
	} else if (sm->flag3 == 1) {
		drawBitmap(sm->Highlight2, 600, 235, ALIGN_LEFT, 0);
	}
	drawChar(font, sm->Letter1, 500, 200);
	drawChar(font, sm->Letter3, 600, 200);
	drawChar(font, sm->Letter2, 550, 200);
	char str[15];
	sprintf(str, "%d", sm->score);
	char score[] = "SCORE";
	char name[] = "NAME";
	drawText(font, name, 300, 200);
	drawText(font, score, 270, 400);
	drawText(font, str, 500, 400);
	deleteFont(font);

}
Exemplo n.º 4
0
void drawPauseMenu(PauseMenu* pm){
	drawBitmap(pm->ResumeBmp, ResumeX, ResumeY, ALIGN_LEFT, 0);
	drawBitmap(pm->ExitBmp, Exit2X, Exit2Y, ALIGN_LEFT, 0);
	if (pm->resume == 1) {
		drawBitmap(pm->Highlight, ResumeX, ResumeY, ALIGN_LEFT, 0);
	} else if (pm->exit == 1) {
		drawBitmap(pm->Highlight, Exit2X, Exit2Y, ALIGN_LEFT, 0);
	}
}
Exemplo n.º 5
0
void BombField::repaintDigit(int i, int j)
{
	switch (bombsAround(i, j))
	{
	case 1:
		drawBitmap(test[i][j].leftup.x, test[i][j].leftup.y, hBmp1);
		break;
	case 2:
		drawBitmap(test[i][j].leftup.x, test[i][j].leftup.y, hBmp2);
		break;
	case 3:
		drawBitmap(test[i][j].leftup.x, test[i][j].leftup.y, hBmp3);
		break;
	case 4:
		drawBitmap(test[i][j].leftup.x, test[i][j].leftup.y, hBmp4);
		break;
	case 5:
		drawBitmap(test[i][j].leftup.x, test[i][j].leftup.y, hBmp5);
		break;
	case 6:
		drawBitmap(test[i][j].leftup.x, test[i][j].leftup.y, hBmp6);
		break;
	case 7:
		drawBitmap(test[i][j].leftup.x, test[i][j].leftup.y, hBmp7);
		break;
	case 8:
		drawBitmap(test[i][j].leftup.x, test[i][j].leftup.y, hBmp8);
		break;
	default:
		drawBitmap(test[i][j].leftup.x, test[i][j].leftup.y, hBmp0);
	}
}
Exemplo n.º 6
0
void COverlappedWindow::drawMenu(HDC hdc) {

	HBRUSH brush = CreateSolidBrush(RGB(0, 0, 0));
	SelectObject(hdc, brush);
	Rectangle(hdc, win_size_, 0, win_size_ + menu_width_, win_size_);
	DeleteObject(brush);

	drawBitmap(hdc, menu_rects_[10].left, menu_rects_[10].top, menu_buttons_[10], false);

	for (int i = 0; i <= 9; i++) {
		drawBitmap(hdc, menu_rects_[i].left, menu_rects_[i].top, menu_buttons_[i], false);
	}
}
Exemplo n.º 7
0
void BombField::openDigit(int i, int j)
{
	test[i][j].isOpened = true;
	switch(bombsAround(i, j))
	{
	case 1:
		drawBitmap(test[i][j].leftup.x, test[i][j].leftup.y, hBmp1);
		break;
	case 2:
		drawBitmap(test[i][j].leftup.x, test[i][j].leftup.y, hBmp2);
		break;
	case 3:
		drawBitmap(test[i][j].leftup.x, test[i][j].leftup.y, hBmp3);
		break;
	case 4:
		drawBitmap(test[i][j].leftup.x, test[i][j].leftup.y, hBmp4);
		break;
	case 5:
		drawBitmap(test[i][j].leftup.x, test[i][j].leftup.y, hBmp5);
		break;
	case 6:
		drawBitmap(test[i][j].leftup.x, test[i][j].leftup.y, hBmp6);
		break;
	case 7:
		drawBitmap(test[i][j].leftup.x, test[i][j].leftup.y, hBmp7);
		break;
	case 8:
		drawBitmap(test[i][j].leftup.x, test[i][j].leftup.y, hBmp8);
		break;
	default:
		openAround(i, j);
	}
	test[i][j].contents = CELL_DIGIT;
}
Exemplo n.º 8
0
void stub_source_run(je_source_plugin *cookie)
{
	source_private *data = (source_private *)cookie->data;
	BMessage drawBitmap(JE_DRAW_BITMAP);
	BMessage msg;
	
	msg.what = JE_FRAMERATE_CHANGED;
	msg.AddInt64("framerate", 33000);
	msg.AddInt32("which", data->id);
	data->graphics_pipeline->SendMessage(&msg);
	
	msg.RemoveName("framerate");
	msg.what = JE_FRAME_SIZE_CHANGED;
	msg.AddRect("rect", data->outSize);
	data->graphics_pipeline->SendMessage(&msg);
	
	msg.RemoveName("rect");
	msg.what = JE_SOURCE_READY;
	data->graphics_pipeline->SendMessage(&msg);
	
	while (1)
	{
		data->nextFrame = system_time() + 33000;
		snooze_until(data->nextFrame, B_SYSTEM_TIMEBASE);
		
		if (data->exit)
			break;
		
		drawBitmap.RemoveName("bitmap");
		drawBitmap.AddPointer("bitmap", data->frame);
		data->window->SendMessage(&drawBitmap);
	}
	// it's ok to kill us now
	release_sem(data->exitSem);
}
Exemplo n.º 9
0
static void tetris_redraw_main(void)
{
    UINT8   i, j;

    drawSquare(BK_X_OFFSET, BK_Y_OFFSET, MAXX*BOX_WIDTH, MAXY*BOX_WIDTH, WSTL_GAME_BG_01);    
    for (i = 0; i < MAXY; i++)
    {
        for (j = 2; j < MAXX + 2; j++)
        {
            if (back[i][j] == 1)
            {
                drawBitmap(BK_X_OFFSET + (j - 2) * BOX_WIDTH, \
                      BK_Y_OFFSET + i * BOX_WIDTH, BOX_WIDTH, \
                      BOX_WIDTH, IM_GAME_TETRIS_BLOCK_08);
            }
            else
            {
                drawSquare(BK_X_OFFSET + (j - 2) * BOX_WIDTH, \
                      BK_Y_OFFSET + i * BOX_WIDTH, BOX_WIDTH, \
                      BOX_WIDTH, WSTL_GAME_BG_01);
            }
        }   
    }
    set_base(BK_X_OFFSET, BK_Y_OFFSET);
    show(x, y, CurrentShape, Status, BLOCK_ACTIVE);
}
Exemplo n.º 10
0
void COverlappedWindow::drawGrid(HDC hdc) {

	for (int i = 0; i < 9; ++i) {
		for (int j = 0; j < 9; ++j) {
			int x = i * cell_size_;
			int y = j * cell_size_;
			drawBitmap(hdc, x, y, digits[grid[i][j]], false);
		}
	}

	if (is_digit_pressed_) {
		drawBitmap(hdc, i_pressed_ * cell_size_, j_pressed_ * cell_size_, digits_pressed_[grid[i_pressed_][j_pressed_]], false);
	}

	drawField(hdc);

}
Exemplo n.º 11
0
/*-----------------------------------------------------------------------------*/
void
iqRunDisplayLogo()
{
#ifdef _LOGO
    drawBitmap( logo );
#else
    displayCenteredBigTextLine(2, "ROBOTC");
#endif
}
Exemplo n.º 12
0
void drawMainMenu(MainMenu* mm, Date* d){
	drawBitmap(mm->Title1Bmp, Title1X, Title1Y, ALIGN_LEFT, 0);
	drawBitmap(mm->Title2Bmp, Title2X, Title2Y, ALIGN_LEFT, 0);
	drawBitmap(mm->SinglePlayBmp, SinglePlayX, SinglePlayY, ALIGN_LEFT, 0);
	drawBitmap(mm->MultiPlayBmp, MultiPlayX, MultiPlayY, ALIGN_LEFT, 0);
	drawBitmap(mm->HighScoreBmp, HighScoreX, HighScoreY, ALIGN_LEFT, 0);
	drawBitmap(mm->ExitBmp, ExitX, ExitY, ALIGN_LEFT, 0);
	drawDate(d, 10, 10);
	if (mm->singlePlay == 1) {
		drawBitmap(mm->Highlight, SinglePlayX, SinglePlayY, ALIGN_LEFT, 0);
	} else if (mm->highScores == 1) {
		drawBitmap(mm->Highlight, HighScoreX, HighScoreY, ALIGN_LEFT, 0);
	} else if (mm->exit == 1) {
		drawBitmap(mm->Highlight, ExitX, ExitY, ALIGN_LEFT, 0);
	} else if (mm->multiPlay == 1) {
		drawBitmap(mm->Highlight, MultiPlayX, MultiPlayY, ALIGN_LEFT, 0);
	}
}
Exemplo n.º 13
0
namespace SkRecords {

bool Draw::skip(const PairedPushCull& r) {
    if (fCanvas->quickReject(r.base->rect)) {
        fIndex += r.skip;
        return true;
    }
    return false;
}

bool Draw::skip(const BoundedDrawPosTextH& r) {
    return fCanvas->quickRejectY(r.minY, r.maxY);
}

// NoOps draw nothing.
template <> void Draw::draw(const NoOp&) {}

#define DRAW(T, call) template <> void Draw::draw(const T& r) { fCanvas->call; }
DRAW(Restore, restore());
DRAW(Save, save(r.flags));
DRAW(SaveLayer, saveLayer(r.bounds, r.paint, r.flags));
DRAW(PopCull, popCull());
DRAW(PushCull, pushCull(r.rect));
DRAW(Clear, clear(r.color));
DRAW(Concat, concat(r.matrix));
DRAW(SetMatrix, setMatrix(SkMatrix::Concat(fInitialCTM, r.matrix)));

DRAW(ClipPath, clipPath(r.path, r.op, r.doAA));
DRAW(ClipRRect, clipRRect(r.rrect, r.op, r.doAA));
DRAW(ClipRect, clipRect(r.rect, r.op, r.doAA));
DRAW(ClipRegion, clipRegion(r.region, r.op));

DRAW(DrawBitmap, drawBitmap(r.bitmap, r.left, r.top, r.paint));
DRAW(DrawBitmapMatrix, drawBitmapMatrix(r.bitmap, r.matrix, r.paint));
DRAW(DrawBitmapNine, drawBitmapNine(r.bitmap, r.center, r.dst, r.paint));
DRAW(DrawBitmapRectToRect, drawBitmapRectToRect(r.bitmap, r.src, r.dst, r.paint, r.flags));
DRAW(DrawDRRect, drawDRRect(r.outer, r.inner, r.paint));
DRAW(DrawOval, drawOval(r.oval, r.paint));
DRAW(DrawPaint, drawPaint(r.paint));
DRAW(DrawPath, drawPath(r.path, r.paint));
DRAW(DrawPoints, drawPoints(r.mode, r.count, r.pts, r.paint));
DRAW(DrawPosText, drawPosText(r.text, r.byteLength, r.pos, r.paint));
DRAW(DrawPosTextH, drawPosTextH(r.text, r.byteLength, r.xpos, r.y, r.paint));
DRAW(DrawRRect, drawRRect(r.rrect, r.paint));
DRAW(DrawRect, drawRect(r.rect, r.paint));
DRAW(DrawSprite, drawSprite(r.bitmap, r.left, r.top, r.paint));
DRAW(DrawText, drawText(r.text, r.byteLength, r.x, r.y, r.paint));
DRAW(DrawTextOnPath, drawTextOnPath(r.text, r.byteLength, r.path, r.matrix, r.paint));
DRAW(DrawVertices, drawVertices(r.vmode, r.vertexCount, r.vertices, r.texs, r.colors,
                                r.xmode.get(), r.indices, r.indexCount, r.paint));
#undef DRAW

template <> void Draw::draw(const PairedPushCull& r) { this->draw(*r.base); }
template <> void Draw::draw(const BoundedDrawPosTextH& r) { this->draw(*r.base); }

}  // namespace SkRecords
Exemplo n.º 14
0
void menu_draw() {
	al_clear_to_color(al_map_rgb(255,255,255));
	drawBitmap(data.bitmap_parallax1,.5+sinf(animTempo)*.03,.5+cosf(animTempo)*.03,game.idealProp*1.1,1.1,0,0,0);
	drawBitmap(data.bitmap_logo,.5,.2,game.idealProp,.27,0,0,0);
	
	float l = easeOut((scene.tempo > 0)?(scene.tempo):(1+scene.tempo));
	drawBox(.5,.625,.3,.2*l,COLOR_HGHL,COLOR_SCND);
	al_draw_text(data.font_Regular52,(selection == 0)?COLOR_HGHL:COLOR_TEXT,px(.5),py(lerp(.625,.55,l)),ALLEGRO_ALIGN_CENTRE,"jogar");
	al_draw_text(data.font_Regular52,(selection == 1)?COLOR_HGHL:COLOR_TEXT,px(.5),py(lerp(.625,.6,l)),ALLEGRO_ALIGN_CENTRE,"configurações");
	al_draw_text(data.font_Regular52,(selection == 2)?COLOR_HGHL:COLOR_TEXT,px(.5),py(lerp(.625,.65,l)),ALLEGRO_ALIGN_CENTRE,"sair");
	BLENDALPHA();
	al_draw_text(data.font_Regular37,al_map_rgba(255,255,255,110+sinf(animTempo*8)*30),px(.005),py(.95),ALLEGRO_ALIGN_LEFT,"github.com/bencz/BCC_PI2_chernobyl");
	if (selection > 0) {
		drawSpriteSheetTinted(data.bitmap_keys,al_map_rgba_f(1,1,1,.5),.5,lerp(.625,.475,l)-fabs(sinf(animTempo*16))*.007,1./18,1./18,4,2,4,0,0,0);
	}
	if (selection < 2) {
		drawSpriteSheetTinted(data.bitmap_keys,al_map_rgba_f(1,1,1,.5),.5,lerp(.625,.775,l)+fabs(sinf(animTempo*16))*.007,1./18,1./18,4,2,5,0,0,0);
	}
	drawSpriteSheetTinted(data.bitmap_keys,al_map_rgba_f(1,1,1,.5),.675+fabs(sinf(animTempo*16))*.007,.625,1./18,1./18,4,2,0,0,0,0);
	BLENDDEFAULT();
}
Exemplo n.º 15
0
void BombField::setFlag(POINT pt)
{
	gameStarted = true;
	firstClick = false;
	// paint in the proper cell according to the cursor's coordinates
	for (int i = 0; i < length; ++i)
	{
		for (int j = 0; j < width; ++j)
		{
			if (pt.x > test[i][j].leftup.x && pt.x < test[i][j].rightlow.x
				&& pt.y - 20 > test[i][j].leftup.y + 6 && pt.y - 20 < test[i][j].rightlow.y + 6)
			{
				if (test[i][j].contents == CELL_EMPTY)
				{
					if (flagsCount != bombCount)
					{
						drawBitmap(test[i][j].leftup.x, test[i][j].leftup.y, hBmpFlag);
						test[i][j].contents = CELL_FLAG;
						flagsCount++;
						defuseBomb(test[i][j]);
					}
					break;
				}
				else if(test[i][j].contents == CELL_FLAG)
				{
					unDefuseBomb(test[i][j]);
					flagsCount--;
					drawBitmap(test[i][j].leftup.x, test[i][j].leftup.y, hBmpQm);
					test[i][j].contents = CELL_QM;
					break;					
				}else if(test[i][j].contents == CELL_QM)
				{
					drawBitmap(test[i][j].leftup.x, test[i][j].leftup.y, hBmpEmpty);
					test[i][j].contents = CELL_EMPTY;
					break;					
				}
			}
		}
	}	
}
Exemplo n.º 16
0
void drawOptionsMenu(OptionsMenu* state) {

	drawBitmap(state->board, 0, 0, ALIGN_LEFT);
	drawBitmapWithoutBg(state->easyBtn, 250, 200, ALIGN_LEFT);
	drawBitmapWithoutBg(state->mediumBtn, 250, 300, ALIGN_LEFT);
	drawBitmapWithoutBg(state->hardBtn, 250, 400, ALIGN_LEFT);
	drawBitmapWithoutBg(state->btn30, 400, 200, ALIGN_LEFT);
	drawBitmapWithoutBg(state->btn90, 400, 300, ALIGN_LEFT);
	drawBitmapWithoutBg(state->btn120, 400, 400, ALIGN_LEFT);
	drawBitmapWithoutBg(state->backBtn, 20, 500, ALIGN_LEFT);


}
Exemplo n.º 17
0
void drawHighScores(HighScores* hs){
	drawBitmap(hs->HighScore, HighScore2X, HighScore2Y, ALIGN_LEFT, 0);
	drawBitmap(hs->Exit, Exit3X, Exit3Y, ALIGN_LEFT, 0);
	if (hs->exit == 1) {
		drawBitmap(hs->Highlight, Exit3X, Exit3Y, ALIGN_LEFT, 0);
	}
	Font* font = InitFont();
	int i, j;
	int Xpos = 350;
	int Ypos = 150;
	for (i = 0; i < 9; i++) {
		for (j = 0; j < 11; j++) {
			drawChar(font, hs->cells[i][j], Xpos, Ypos);
			Xpos = Xpos + 30;
		}
		if (Xpos == 680) {
			Xpos = 350;
			Ypos += 50;
		}
	}
	deleteFont(font);
	hs->counter++;
}
Exemplo n.º 18
0
void BombField::showExplodedBombs()
{
	for (int i = 0; i < length; ++i)
	{
		for (int j = 0; j < width; ++j)
		{
			if(test[i][j].isBomb == true)
			{
				drawBitmap(test[i][j].leftup.x, test[i][j].leftup.y, hBmpExploded);
				test[i][j].contents = CELL_EXPL;
			}						
		}
	}
}
Exemplo n.º 19
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;
		}
	}
}
Exemplo n.º 20
0
void BombField::openAround(int string, int column)
{
	drawBitmap(test[string][column].leftup.x, test[string][column].leftup.y, hBmp0);
	for (int i = string - 1; i < string + 2; i++)
	{
		for (int j = column - 1; j < column + 2; j++)
		{
			if (!(j >= width || i >= length || j < 0 || i < 0))
			{
				if(!isOpened(i,j))
					openDigit(i, j);
			}
		}
	}

}
Exemplo n.º 21
0
	void GuiPainter::printingStatus(const uint8_t percentage, bool progress_bar)
	{
		Area save_working_area = m_working_area;
		uint8_t save_color_index = m_impl.getColorIndex();

		Area status_area(0, 19, 95, 25);
		setWorkingArea(status_area);
		setColorIndex(1);
		setFont(FontType_t::BODY_FONT);

		// Draw SD small icon
		drawBitmap(m_working_area.x_init, m_working_area.y_init, little_icon_width, little_icon_height, bits_sd_small);

		// Draw the percentage done
		m_working_area.x_init += little_icon_width + 4;
		char s_percentage[4] = { 0 };
		strcpy(s_percentage, itostr3left(percentage));
		setPrintPos(m_working_area.x_init, m_working_area.y_init);
		print(s_percentage);
		print("%");

		if(progress_bar == true)
		{

			// Draw the progress bar
			m_working_area.x_init += (strlen(s_percentage) + 1) * max_font_width + 1;
			m_working_area.y_init += 1;
			m_impl.drawBox(m_working_area.x_init, m_working_area.y_init, m_working_area.width(), m_working_area.height());

			setColorIndex(0);
			m_working_area.x_init += 1;
			m_working_area.x_end -= 1;
			m_working_area.y_init += 1;
			m_working_area.y_end -= 1;
			m_impl.drawBox(m_working_area.x_init, m_working_area.y_init, m_working_area.width(), m_working_area.height());

			setColorIndex(1);
			m_working_area.x_init += 1;
			m_working_area.x_end -= 1;
			m_working_area.y_init += 1;
			m_working_area.y_end -= 1;
			m_impl.drawBox(m_working_area.x_init, m_working_area.y_init, m_working_area.width() * percentage / 100, m_working_area.height());
		}

		setWorkingArea(save_working_area);
		setColorIndex(save_color_index);
	}
Exemplo n.º 22
0
void BombField::clearField()
{
	firstClick = true;
	int y = 65, x;
	for (int i = 0; i < length; ++i)
	{
		x = 15;
		for (int j = 0; j < width; ++j)
		{
			test[i][j].contents = CELL_EMPTY;
			drawBitmap(x, y, hBmpEmpty);   //paint an empty cell

			x += 33;
		}
		y += 24;
	}
}
Exemplo n.º 23
0
void Design::render(Patterns &patterns) {
	Common::MemoryReadStream in(_data, _len);
	bool needRender = true;

	while (needRender) {
		byte fillType = in.readByte();
		byte borderThickness = in.readByte();
		byte borderFillType = in.readByte();
		int type = in.readByte();

		if (in.eos())
			break;

		debug(8, "fill: %d borderFill: %d border: %d type: %d", fillType, borderFillType, borderThickness, type);
		switch (type) {
		case 4:
			drawRect(_surface, in, patterns, fillType, borderThickness, borderFillType);
			break;
		case 8:
			drawRoundRect(_surface, in, patterns, fillType, borderThickness, borderFillType);
			break;
		case 12:
			drawOval(_surface, in, patterns, fillType, borderThickness, borderFillType);
			break;
		case 16:
		case 20:
			drawPolygon(_surface, in, patterns, fillType, borderThickness, borderFillType);
			break;
		case 24:
			drawBitmap(_surface, in);
			break;
		default:
			warning("Unknown type => %d", type);
			break;
		}

		//g_system->copyRectToScreen(_surface->getPixels(), _surface->pitch, 0, 0, _surface->w, _surface->h);
		//((WageEngine *)g_engine)->processEvents();
		//g_system->updateScreen();
		//g_system->delayMillis(500);
	}
}
Exemplo n.º 24
0
static void show(INT16 x, INT16 y, INT8 CurrentShape, INT8 Status, UINT8 active)
{
    UINT8 l, p;
    UINT16 rsc_id;

    rsc_id = active ? shape_color[CurrentShape] : IM_GAME_TETRIS_BLOCK_08;
    for (l = 0; l < 4; l++)
    {
        for (p = 0; p < 4; p++)
        {
            if (shape[CurrentShape][Status][p][l] == 1)
            {
                drawBitmap(x_base + (l + x - 2) * BOX_WIDTH, \
                      y_base + (p + y) * BOX_WIDTH, BOX_WIDTH, \
                      BOX_WIDTH, rsc_id);
            }
        }
    }

}
Exemplo n.º 25
0
void updateProcStart(GContext* _ctx) {

  renderFloor(_ctx, 0);

  static const char* _a = "YOU";
  static const char* _b = "CANNOT";
  static const char* _c = "GO";
  static const char* _d = "BACK!";

  renderBorderText(_ctx, GRect(45, 15, 80, 100),  fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD), _a, 2, GTextAlignmentCenter, false);
  renderBorderText(_ctx, GRect(45, 45, 80, 100),  fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD), _b, 2, GTextAlignmentCenter, true);
  renderBorderText(_ctx, GRect(45, 75, 80, 100),  fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD), _c, 2, GTextAlignmentCenter, false);
  renderBorderText(_ctx, GRect(45, 105, 80, 100), fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD), _d, 2, GTextAlignmentCenter, true);
  renderClutter(_ctx);
  renderPlayer(_ctx);
  renderWalls(_ctx, true, true, true, true);
  renderWallClutter(_ctx);

  drawBitmap(_ctx, m_flagstone[ m_dungeon.m_finalPuzzle ], 0, 9);

  renderArrows(_ctx, 15, 4, 4);
}
Exemplo n.º 26
0
Arquivo: ft.cpp Projeto: nixz/covise
void FT::drawString(ft_pixmap *pixmap, ft_string *string)
{
    FT_Vector where;
    ft_char *glyph;
    int n, error;

    where.x = -string->bbox.xMin + 1;
    where.y = string->bbox.yMax;
    glyph = string->glyphs;

    for (n = 0; n < string->num_glyphs; ++n, ++glyph)
    {
        FT_Glyph image;
        FT_Vector vec; /* 26.6 */
        FT_BitmapGlyph bit;

        // make copy to transform
        if (!glyph->image)
        {
            fprintf(stderr, "no image\n");
            continue;
        }
        error = FT_Glyph_Copy(glyph->image, &image);
        if (error)
        {
            fprintf(stderr, "couldn't copy image\n");
            continue;
        }

        /* transform it */
        vec = glyph->pos;
        FT_Vector_Transform(&vec, &string->transform);

        bit = (FT_BitmapGlyph)image;
        drawBitmap(pixmap, bit, where);
        FT_Done_Glyph(image);
    }
}
Exemplo n.º 27
0
//-----------------------------------------------------------------------------
void CDrawContext::fillRectWithBitmap (CBitmap* bitmap, const CRect& srcRect, const CRect& dstRect, float alpha)
{
	if (srcRect.isEmpty () || dstRect.isEmpty ())
		return;

	CRect bitmapPartRect;
	CCoord left;
	CCoord top;
	CPoint sourceOffset (srcRect.left, srcRect.top);

	CRect currentClip = getClipRect (currentClip);

	for (top = dstRect.top; top < dstRect.bottom; top += srcRect.getHeight ())
	{
		bitmapPartRect.top = top;
		bitmapPartRect.bottom = top + srcRect.getHeight ();
		if (bitmapPartRect.bottom > dstRect.bottom)
			bitmapPartRect.bottom = dstRect.bottom;
		// The following should never be true, I guess
		if (bitmapPartRect.getHeight () > srcRect.getHeight ())
			bitmapPartRect.setHeight (srcRect.getHeight ());
		
		for (left = dstRect.left; left < dstRect.right; left += srcRect.getWidth ())
		{
			bitmapPartRect.left = left;
			bitmapPartRect.right = left + srcRect.getWidth ();
			if (bitmapPartRect.right > dstRect.right)
				bitmapPartRect.right = dstRect.right;
			// The following should never be true, I guess
			if (bitmapPartRect.getWidth () > srcRect.getWidth ())
				bitmapPartRect.setWidth (srcRect.getWidth ());
			
			if (currentClip.rectOverlap (bitmapPartRect))
				drawBitmap (bitmap, bitmapPartRect, sourceOffset, alpha);
		}
	}
}
Exemplo n.º 28
0
// Main Function
void main(void)
{ 
  
  uint8_t last = 0;
  
  WDTCTL = WDTPW + WDTHOLD;             // Stop watchdog timer
  BCSCTL1 = CALBC1_16MHZ;               // Set DCO to 1, 8, 12 or 16MHz
  DCOCTL = CALDCO_16MHZ;
  BCSCTL1 |= DIVA_0;                    // ACLK/1 [ACLK/(0:1,1:2,2:4,3:8)]
  //BCSCTL2 |= DIVS_3;                  // SMCLK/8 [SMCLK/(0:1,1:2,2:4,3:8)]
  BCSCTL3 |= LFXT1S_2;                  // LFXT1 = VLO Clock Source
  
  P1OUT |= BIT0;				// P1.0 out
  P1DIR |= BIT0;				// P1.0 high
  
  P2DIR |= BIT0 | BIT1 | BIT4 | BIT5;			// Configure  Port 2 pins outputs

  // Initialize Baseline measurement
  TI_CAPT_Init_Baseline(&button_bar);
  
  // Update baseline measurement (Average 5 measurements)
  TI_CAPT_Update_Baseline(&button_bar,5);  
  
  SPISetup();                         // Initialize SPI Display
  //drawBitmap(blackbird_96_64, 96, 8, 0, 0);    
  
  clear();
  //setcharmode(1); //largechars
  //writeString(2,1,"Press button!");
  
  // Main loop starts here
  while (1)
  {
  	
  	#ifdef ELEMENT_CHARACTERIZATION_MODE
	// Get the raw delta counts for element characterization 
	TI_CAPT_Custom(&button_bar,wheelCnt);
	__no_operation(); 					// Set breakpoint here	
	#endif
	
	
	#ifndef ELEMENT_CHARACTERIZATION_MODE
	// Return the pointer to the element which has been touched
	keyPressed = (struct Element *)TI_CAPT_Buttons(&button_bar);
	
	// If a button has been touched, then take some action
	if(keyPressed)
	{
		// Up Element
		if(keyPressed == &a_element)
		{
			P1OUT |= BIT0;				// Turn on center LED
                        if (last != 2) {                        
                            clear();
                            last = 2;
                            drawBitmap(big_1, 32, 6, 32, 1);
                            //writeString(4,3,"A Pressed");
                        }
		}
		if(keyPressed == &b_element)
		{
			P1OUT |= BIT0;				// Turn on center LED
                        if (last != 3) {                        
                            clear();
                            last = 3;
                            drawBitmap(big_2, 32, 6, 32, 1);
                            //writeString(4,3,"B Pressed");
                        }
		}
		if(keyPressed == &c_element)
		{
			P1OUT |= BIT0;				// Turn on center LED
                        if (last != 1) {                        
                            clear();
                            last = 1;
                            drawBitmap(big_3, 32, 6, 32, 1);
                            //writeString(4,3,"C Pressed");
                        }
		}
		if(keyPressed == &d_element)
		{
			P1OUT |= BIT0;				// Turn on center LED
                        if (last != 4) {                        
                            clear();
                            last = 4;
                            drawBitmap(big_4, 32, 6, 32, 1);
                            //writeString(4,3,"D Pressed");
                        }
		}		
	  }
	  else
	  {
	      P1OUT &= ~(BIT0);				// Turn off center LED
              if (last != 0) 
              {
                drawBitmap(blackbird_96_64, 96, 8, 0, 0);  
                //writeString(4,4,"Press a button");
                last = 0;
              }
	  }      
        
    // Put the MSP430 into LPM3 for a certain DELAY period
    sleep(DELAY);
    #endif

  }
} // End Main
Exemplo n.º 29
0
void ofxFlashBitmap :: drawOnFrame ()
{
	drawBitmap();
}
Exemplo n.º 30
0
void drawBitmap(Adafruit_ILI9341* display, int x, int y, int height, int width, Icon * icon)
{
	drawBitmap(display, x, y, height, width, icon, 0);
}