Beispiel #1
0
BOOL CRussiaGame::OnPaint(HWND hWnd, UINT uMsg, WPARAM wParam,LPARAM lParam)
{
	

	RECT rc;
	::GetClientRect(hWnd, &rc);
	int clientWidth = rc.right - rc.left;
	int clientHeight = rc.bottom - rc.top;
	//SetClassLong(hWnd, GCL_HBRBACKGROUND, (LONG)(HBRUSH)GetStockObject(NULL_BRUSH));
	PAINTSTRUCT ps;
	m_hdc = BeginPaint(hWnd, &ps);		//只响应WM_PAINT,InvalidateRect();最后一个参数为TRUE,则background brush会擦出
	HDC hdc = GetDC(NULL);
	HBITMAP bmp = CreateCompatibleBitmap(hdc, rc.right-rc.left, rc.bottom-rc.top);
	HDC mem_dc = CreateCompatibleDC(hdc);
	HBITMAP old_bmp = (HBITMAP)SelectObject(mem_dc, bmp);
	FillRect(mem_dc, &rc, (HBRUSH)GetStockObject(WHITE_BRUSH));

	DrawLine(mem_dc);
	DrawWord(mem_dc, hWnd);
	DrawBlock(mem_dc,m_currentBlock.Point0.m_x, m_currentBlock.Point0.m_y);
	DrawBlock(mem_dc,m_currentBlock.Point1.m_x, m_currentBlock.Point1.m_y);
	DrawBlock(mem_dc,m_currentBlock.Point2.m_x, m_currentBlock.Point2.m_y);
	DrawBlock(mem_dc,m_currentBlock.Point3.m_x, m_currentBlock.Point3.m_y);
	ReDrawBottomBlock(mem_dc, hWnd, uMsg);
	
	BitBlt(m_hdc, 0, 0, clientWidth, clientHeight, mem_dc, 0, 0, SRCCOPY);
	SelectObject(mem_dc, old_bmp);
	DeleteObject(bmp);
	DeleteObject(mem_dc);

	ReleaseDC(NULL, hdc);
	EndPaint(hWnd, &ps);
	return TRUE;
}
Beispiel #2
0
void Clock::Draw(BView *view, int32)
{
	BScreen screen;
	BBitmap buffer(view->Bounds(), screen.ColorSpace(), true);
	BView offscreen(view->Bounds(), NULL, 0, 0);
	buffer.AddChild(&offscreen);
	buffer.Lock();

	int n;
	float a,R;
	float width = view->Bounds().Width();
	float height = view->Bounds().Height();
	float zoom = (height/1024) * 0.85;

	time(&tmptodaytime);
	TodayTime = localtime(&tmptodaytime);

	todaysecond = TodayTime->tm_sec;
	todayminute = TodayTime->tm_min + (todaysecond/60.0);
	todayhour   = TodayTime->tm_hour + (todayminute/60.0);

	rgb_color bg_color = {0,0,0};
	offscreen.SetHighColor(bg_color);
	offscreen.SetLowColor(bg_color);
	offscreen.FillRect(offscreen.Bounds());

	offscreen.SetHighColor(200,200,200);

	for(n=0,a=0,R=510*zoom;n<60;n++,a+=(2*M_PI)/60) {
		float x = width/2 + R * cos(a);
		float y = height/2 + R * sin(a);
		DrawBlock(&offscreen,x,y,a,14*zoom);
	}

	offscreen.SetHighColor(255,255,255);

	for(n=0,a=0,R=500*zoom;n<12;n++,a+=(2*M_PI)/12) {
		float x = width/2 + R * cos(a);
		float y = height/2 + R * sin(a);
		DrawBlock(&offscreen,x,y,a,32*zoom);
	}

	offscreen.SetHighColor(255,255,255);
	DrawArrow(&offscreen, width/2,height/2, ( ((2*M_PI)/60) * todayminute) - (M_PI/2), 220*zoom, 1, 8*zoom);
	DrawArrow(&offscreen, width/2,height/2, ( ((2*M_PI)/12) * todayhour) - (M_PI/2), 140*zoom, 1, 14*zoom);
	offscreen.FillEllipse(BPoint(width/2,height/2),24*zoom,24*zoom);
	offscreen.SetHighColor(250,20,20);
	DrawArrow(&offscreen, width/2,height/2, ( ((2*M_PI)/60) * todaysecond) - (M_PI/2), 240*zoom, 1, 4*zoom);
	offscreen.FillEllipse(BPoint(width/2,height/2),20*zoom,20*zoom);

	offscreen.Sync();
	buffer.Unlock();
	view->DrawBitmap(&buffer);
	buffer.RemoveChild(&offscreen);
}
Beispiel #3
0
void DrawBoard() {

	BOOL bFound;
	int x, y, PosX, PosY, i;
	char Piece[HPieceBlocks][VPieceBlocks];
	HBRUSH hBrush, hCurPieceBrush, hSavedPiecesBrush;


	hCurPieceBrush = CreateSolidBrush(FallingPieceColor);
	hSavedPiecesBrush = CreateSolidBrush(SavedPiecesColor);

	//Clear the board bitmap
	hBrush = CreateSolidBrush(RGB(0, 0, 0));
	FillRect(hDCMain, &RectWndMain, hBrush);
	DeleteObject(hBrush);
	///////////////////////////////////


	EnterCriticalSection(&crsCurPiece);
	PosX = CurPiece.PosX;
	PosY = CurPiece.PosY;
	memcpy(Piece, CurPiece.Piece, (HPieceBlocks*VPieceBlocks));
	LeaveCriticalSection(&crsCurPiece);

	//Draw current piece
	for (y = 0, i = 0; y<HPieceBlocks; y++) {

		for (x = 0, bFound = FALSE; x<VPieceBlocks; x++) {

			if (Piece[y][x] == 1) {
				bFound = TRUE;
				DrawBlock(hDCMain, (x + PosX), (y + PosY - i), hCurPieceBrush);
			}
		}
		if (bFound == FALSE) { i++; }
	}

	//Draw already saved pieces
	for (y = 0; y<BoardHeight; y++) {

		for (x = 0; x<BoardWidth; x++) {

			if (Board[y][x] == 1) {

				DrawBlock(hDCMain, x, y, hSavedPiecesBrush);
			}
		}
	}

	DeleteObject(hCurPieceBrush);
	DeleteObject(hSavedPiecesBrush);
}
void CBScrollBar::OnDraw(const CEspRect& rect)
{
	IAwsGc* pGc = GetGc();

	if ( ESP_NULL != pGc )
	{
		// »­±³¾°
		DrawBK(pGc, rect);

		// »­¿é
		CEspRect rt;
		if ( ESB_Vertical == m_eDir )
		{
			rt.m_ptLT.m_nX = 0;
			rt.m_ptLT.m_nY = (int)(m_nCurPos * m_fCurScrolldis);
			rt.m_ptRB.m_nX = GetSize()->m_nWidth;
			rt.m_ptRB.m_nY = rt.m_ptLT.m_nY + m_nCurBlockDim;
		}
		else if ( ESB_Horizontal == m_eDir )
		{
			rt.m_ptLT.m_nX = (int)(m_nCurPos * m_fCurScrolldis);
			rt.m_ptLT.m_nY = 0;
			rt.m_ptRB.m_nX = rt.m_ptLT.m_nX + m_nCurBlockDim;
			rt.m_ptRB.m_nY = GetSize()->m_nHeight;
		}

		DrawBlock(pGc, rt);
	}
}
Beispiel #5
0
void CDisplay::Draw()
{
	// convert the variables into strings to be drawn to the screen
	char* tempScore = ltoa(score, new char[sizeof(long) * 8 + 1], 10);

	char* tempLines = itoa(lines, new char[sizeof(int) * 8 + 1], 10);
	char* tempLevel = itoa(level, new char[sizeof(int) * 8 + 1], 10);
	
	al_draw_text(font, al_map_rgb(32,32,32), 78, 206, ALLEGRO_ALIGN_LEFT, tempScore);
	al_draw_text(font, al_map_rgb(32,32,32), 78, 224, ALLEGRO_ALIGN_LEFT, tempLines);
	al_draw_text(font, al_map_rgb(32,32,32), 78, 262, ALLEGRO_ALIGN_LEFT, tempLevel);

	// draw the next block
	for(int i = 0; i < 4; i++) {
		for(int j = 0; j < 4; j++) {
			if(nextBlock->GetDef()[i][j] != 0) {
				DrawBlock(nextBlock->GetDef()[i][j], 
						((j + nextBlock->GetX()) * 32) + 30, 
						((i + nextBlock->GetY()) * 32) + 30);
			}
		}
	}

	for(int i = 0; i < numHighScores; i++) {
		al_draw_text(font, al_map_rgb(0, 0, 0), 26, 360 + (24 * i), 0, itoa(i + 1, new char[2], 10));
		al_draw_text(font, al_map_rgb(0, 0, 0), 44, 360 + (24 * i), 0, highScores[i]);
	}
}
Beispiel #6
0
void Drawer::DrawMine(Block ***obj, Miner obj2, int startDrawX, int startDrawY, int Vision, int Colunas, int Linhas)
{

    int rMinimum = (obj2.getY() - Vision > 0) ? obj2.getY() - Vision : 0;
    int rMaximum = (obj2.getY() + Vision < Linhas) ? obj2.getY() + Vision : obj2.getY() + (Linhas - obj2.getY());

    int cMinimum = (obj2.getX() - Vision > 0) ? obj2.getX() - Vision : 0;
    int cMaximum = (obj2.getX() + Vision < Colunas) ? obj2.getX() + Vision : obj2.getX() + (Colunas - obj2.getX());

    for (int r = 0, mineR = startDrawY; r < 7; r++, mineR++)
        {
            for (int c = 0, mineC = startDrawX; c < 7; c++, mineC++)
                {
                    if (obj2.getX() == mineC && obj2.getY() == mineR)
                        {
                            if (typeid(*obj[mineR][mineC]).name() == typeid(Escada).name())
                                {
                                    Draw(obj2, c * 5, r * 5, SHOW, 1);
                                }
                            else if (typeid(*obj[mineR][mineC]).name() == typeid(Viga).name())
                                {
                                    Draw(obj2, c * 5, r * 5, SHOW, 2);
                                }
                            else
                                Draw(obj2, c * 5, r * 5, SHOW, 0);
                        }
                    else if (mineR >= rMinimum && mineR <= rMaximum && mineC >= cMinimum && mineC <= cMaximum)
                        {
                            DrawBlock(obj[mineR][mineC]->getDrawSequence(), c * 5, r * 5);
                        }
                }
        }
}
void Block::Collide(dxGeom* g1, dxGeom* g2, void* UserData, dNearCallback* Callback){
#ifdef DRAWBLOCKS
	DrawBlock(this);
#endif
	// Collide against local list
	while (g2){
		if (GEOM_ENABLED(g2)){
			collideAABBs (g1, g2, UserData, Callback);
		}
		g2 = g2->next;
	}

	// Collide against children
	if (Children){
		for (int i = 0; i < SPLITS; i++){
			// Early out for empty blocks
			if (Children[i].GeomCount == 0){
				continue;
			}

			// Does the geom's AABB collide with the block?
			// Dont do AABB tests for single geom blocks.
			if (Children[i].GeomCount == 1 && Children[i].First){
				//
			}
			else if (true){
				if (g1->aabb[AXIS0 * 2 + 0] > Children[i].MaxX ||
					g1->aabb[AXIS0 * 2 + 1] < Children[i].MinX ||
					g1->aabb[AXIS1 * 2 + 0] > Children[i].MaxZ ||
					g1->aabb[AXIS1 * 2 + 1] < Children[i].MinZ) continue;
			}
			Children[i].Collide(g1, Children[i].First, UserData, Callback);
		}
	}
}
void GameClass::DrawGameGrid () const {
  ALLEGRO_COLOR color(cWhite);

  for (size_t i = 0; i < gridHeight; i++) {
    for (size_t j = 0; j < gridWidth; j++) {
      int x = j*cTileSize, y = i*cTileSize,
          xf = (j+1)*cTileSize, yf = (i+1)*cTileSize;
      switch (gameGrid[i][j]) {
        case cBlock:
          if (i > 0 && gameGrid[i-1][j] == cNone)
            DrawFloor(x, y, xf, yf);
          else
            DrawBlock(x, y, xf, yf);
          break;
        case cSpike:
          DrawSpike(x, y, xf, yf);
          break;
        case cNone:
          if (i < gridHeight-1 && gameGrid[i+1][j] == cBlock)
            DrawGrass(x, y, xf, yf);
          //Nothing
        default:
          break;
      }
    }
  }

  float x = regionExit->GetX() +
      cTileSize*regionExit->GetWidth()/2;
  float y = regionExit->GetY();
  al_draw_text(hugeFont, cWhite, x, y,
      ALLEGRO_ALIGN_CENTRE, cExit[language].c_str());
}
// 生成新的方块
void NewBlock()
{
 g_CurBlock.id = g_NextBlock.id,  g_NextBlock.id = rand() % 7;
 g_CurBlock.dir = g_NextBlock.dir, g_NextBlock.dir = rand() % 4;
 g_CurBlock.x = (WIDTH - 4) / 2;
 g_CurBlock.y = HEIGHT + 2; // 下移新方块直到有局部显示
 WORD c = g_Blocks[g_CurBlock.id].dir[g_CurBlock.dir];
 while((c & 0xF) == 0)
 {
  g_CurBlock.y--;
  c >>= 4;
 } // 绘制新方块
 DrawBlock(g_CurBlock); // 绘制下一个方块
 setfillstyle(BLACK);
 bar((WIDTH + 1) * SIZE, 0, (WIDTH + 5) * SIZE - 1, 4 * SIZE - 1);
 DrawBlock(g_NextBlock);
}
// 旋转方块
void OnRotate()
{
 // 获取可以旋转的 x 偏移量
 int dx;
 BLOCKINFO tmp = g_CurBlock;
 tmp.dir++;     if (CheckBlock(tmp)) { dx = 0;  goto rotate; }
 tmp.x = g_CurBlock.x - 1; if (CheckBlock(tmp)) { dx = -1; goto rotate; }
 tmp.x = g_CurBlock.x + 1; if (CheckBlock(tmp)) { dx = 1;  goto rotate; }
 tmp.x = g_CurBlock.x - 2; if (CheckBlock(tmp)) { dx = -2; goto rotate; }
 tmp.x = g_CurBlock.x + 2; if (CheckBlock(tmp)) { dx = 2;  goto rotate; }
 return;rotate:
 // 旋转
 DrawBlock(g_CurBlock, HIDE);
 g_CurBlock.dir++;
 g_CurBlock.x += dx;
 DrawBlock(g_CurBlock);
}
Beispiel #11
0
		void operator()() const {
			for( int block_row = 0; block_row < block_image_.mean_array_.rows(); ++block_row ) {
				for( int block_col = 0; block_col < block_image_.mean_array_.cols(); ++block_col ) {
					typename std::map<std::pair<int, int>, cv::Rect_<int> >::const_iterator block_itr
						= block_image_.block_rects_.find( std::pair<int, int>(block_row, block_col));
					const cv::Rect_<int>& block_rect = block_itr->second;
					DrawBlock( block_rect, block_image_.mean_array_.coeff( block_row, block_col ) );
				}
			}
		}
Beispiel #12
0
void base_tetrix_scene::user_down()
{
	m_pblock->fall_slow();
	DrawBlock();

	if ( m_pblock->isBlockDown() != 0 )
	{
		CheckGameStatus();
	}
}
Beispiel #13
0
void base_tetrix_scene::user_fall()
{
	while ( m_pblock->isBlockDown() == 0 )
	{
		m_pblock->fall_slow();
		DrawBlock();
	}

	CheckGameStatus();
}
Beispiel #14
0
		void operator()( const tbb::blocked_range2d<int>& range ) const {
			for( int block_row = range.rows().begin(); block_row != range.rows().end(); ++block_row ) {
				for( int block_col = range.cols().begin(); block_col != range.cols().end(); ++block_col ) {
					typename std::map<std::pair<int, int>, cv::Rect_<int> >::const_iterator block_itr
						= block_image_.block_rects_.find( std::pair<int, int>(block_row, block_col));
					const cv::Rect_<int>& block_rect = block_itr->second;
					DrawBlock( block_rect, block_image_.mean_array_.coeff( block_row, block_col ) );
				}
			}
		}
Beispiel #15
0
void Board::DrawBoard()
{
	for (int i = 0; i < BOARD_SIZE; i++)
		for (int j = 0; j < BOARD_SIZE; j++){
			SDL_Rect rect = {i*BLOCK_SIZE, j*BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE};
			switch(board[i][j]){
				case COLOR_BLUE:
					DrawBlock(&rect, 0x00, 0x00, 0xff);
					break;
				case COLOR_GREEN:
					DrawBlock(&rect, 0x00, 0x80, 0x00);
					break;
				case COLOR_ORANGE:
					DrawBlock(&rect, 0xff, 0xa5, 0x00);
					break;
				case COLOR_RED:
					DrawBlock(&rect, 0xff, 0x00, 0x00);
					break;
				case COLOR_VIOLET:
					DrawBlock(&rect, 0xee, 0x82, 0xee);
					break;
				case COLOR_YELLOW:
					DrawBlock(&rect, 0xff, 0xff, 0x00);
					break;
			}
		}
}
Beispiel #16
0
void Lcd_t::DrawImage(int x, int y, const uint8_t* img) {
	assert(y % 8 == 0);
	y /= 8; // y is now rows, not pixels
    uint8_t width = *img++;
    uint8_t height = *img++;
    for(int fy = y; fy < y+height; fy++) {
        int index = x + fy*LCD_WIDTH;
        for(int fx = x; fx < x+width; fx++) {
            DrawBlock(index++, *img++, 255);
            if (index > LCD_VIDEOBUF_SIZE) break;
        }
    }
}
Beispiel #17
0
void CRussiaGame::ReDrawBottomBlock(HDC hdc, HWND hWnd, UINT uMsg)
{
	for (int i = 0; i < 12; i++)
	{
		for(int j = 0; j < 20; j++)
		{
			if (m_iMap[i][j] == 1)
			{
				DrawBlock(hdc, i, j);
			}
		}
	}
}
Beispiel #18
0
void CHSScrollBar::Draw( CDC* pDC )
{
	if (m_rect.IsRectEmpty())
	{
		return;
	}

	pDC->FillSolidRect(&m_rect, m_clrBK);

	DrawBorder(pDC);
	DrawArrow(pDC);
	DrawBlock(pDC);
}
Beispiel #19
0
void TesseractWidget::paintGL() {
    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(75,aspect,.1,1000);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    gluLookAt(TheWorld->Myself->Position.x,TheWorld->Myself->Position.y,TheWorld->Myself->Position.z,TheWorld->Myself->LookAt.x,TheWorld->Myself->LookAt.y,TheWorld->Myself->LookAt.z,TheWorld->Myself->HeadVector.x,TheWorld->Myself->HeadVector.y,TheWorld->Myself->HeadVector.z);
    emit TheWorld->drawBeginSignal();
    for (QMap<int,Bnode>::iterator it=TheWorld->Blocks.begin(); it!=TheWorld->Blocks.end(); ++it) {
        bool Cancel=0;
        emit TheWorld->drawBlockSignal(it,Cancel);
        if (Cancel==0) {
            if (it.value().PointedAt==0)
                DrawBlock(it.value(),2);
            else
                DrawBlock(it.value(),3);
        }
    }
    if (creatingblock)
        DrawBlock(Bnode(currentblocktype,(TheWorld->Myself->LookAt+tempc)/2,((TheWorld->Myself->LookAt-tempc)/2).Abs()),1);
    for (QMap<int,Player>::iterator it=TheWorld->Players.begin(); it!=TheWorld->Players.end(); ++it)
        if (it!=TheWorld->Myself)
            DrawPlayer(it.value());
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glDisable(GL_DEPTH_TEST);
    glDisable(GL_LIGHTING);
    emit TheWorld->drawDoneSignal();
    SetColor(TheWorld->BlockTypes[currentblocktype].Color);
    renderText(20,20,currentblocktype);
    glEnable(GL_LIGHTING);
    glEnable(GL_DEPTH_TEST);
    glFlush();
}
void Block::Collide(void* UserData, dNearCallback* Callback){
#ifdef DRAWBLOCKS
	DrawBlock(this);
#endif
	// Collide the local list
	dxGeom* g = First;
	while (g){
		if (GEOM_ENABLED(g)){
			Collide(g, g->next, UserData, Callback);
		}
		g = g->next;
	}

	// Recurse for children
	if (Children){
		for (int i = 0; i < SPLITS; i++){
			if (Children[i].GeomCount <= 1){	// Early out
				continue;
			}
			Children[i].Collide(UserData, Callback);
		}
	}
}
Beispiel #21
0
void LevelEditor () {
	int i=0;
	int j=0;
	if (Panel==0) {
		if ((Key=='d' || Arrow=='M') && Tile_X<399) Tile_X++;
		if ((Key=='a' || Arrow=='K') && Tile_X>0) Tile_X--;
		if ((Key=='s' || Arrow=='P') && Tile_Y<8) Tile_Y++;
		if ((Key=='w' || Arrow=='H') && Tile_Y>0) Tile_Y--;
		if ((Key==' ' || Arrow==28)) {
			if (Tile_Type==5) {
				for (i=0; i<LEVEL_MAXLEN; i++) if (*(Levels[CURRENT_LEVEL]+0*LEVEL_MAXLEN+i)==5) *(Levels[CURRENT_LEVEL]+0*LEVEL_MAXLEN+i)=0;
				*(Levels[CURRENT_LEVEL]+0*LEVEL_MAXLEN+Tile_X)=5;
			} else {
				*(Levels[CURRENT_LEVEL]+Tile_Y*LEVEL_MAXLEN+Tile_X)=Tile_Type;
			}
		}
	}
	if (Panel==1) {
		if ((Key=='s' || Arrow=='P') && Tile_Type<5) Tile_Type++;
		if ((Key=='w' || Arrow=='H') && Tile_Type>0) Tile_Type--;
	}
	if (Panel==2) {
		if ((Key=='s' || Arrow=='P') && Q_SELECTED<5) Q_SELECTED++;
		if ((Key=='w' || Arrow=='H') && Q_SELECTED>0) Q_SELECTED--;
		if ((Key==' ' || Arrow==28) && Q_SELECTED==0) {
			GAME_TYPE=1;
			if (GLOBAL_CHECKPOINT>0) {
				int isCheck=0;
				for (i=0;i<9; i++) {
					int CurBlock=*(Levels[CURRENT_LEVEL]+i*LEVEL_MAXLEN+GLOBAL_CHECKPOINT);
					if (CurBlock==4) {
						SPAWN_Y=(i+1)*43+41+70-DeltaH[HeroSides];
						isCheck=1;
						break;
					}
				}
				if (isCheck==0) {
					DrawText (100,300,"error (checkpoint not found)",GLOBAL_FRONTCOLOR);
					Update();
					_ksys_delay(200);
					GAME_TYPE=3;
					Panel=1;
					return;
				}
				ResetLevel(CURRENT_LEVEL);
				isRestart=0;
				HeroIsDead=0;
				HeroFly=0;
				HeroY=SPAWN_Y;
				if (HeroSides>7) HeroY-=22;
				if (HeroSides%2==0) {
				       HeroAngle=360/(HeroSides*2);
				} else {
				       HeroAngle=0;
				}
			}
		}
		if (Q_SELECTED==1) {
			if ((Key=='d' || Arrow=='M') && GLOBAL_CHECKPOINT<399) GLOBAL_CHECKPOINT++;
			if ((Key=='a' || Arrow=='K') && GLOBAL_CHECKPOINT>0) GLOBAL_CHECKPOINT--;
		}
		if ((Key==' ' || Arrow==28) && Q_SELECTED==2) {
			for (i=0; i<9; i++) {
				for (j=0; j<LEVEL_MAXLEN; j++) {
					*(Levels[CURRENT_LEVEL]+i*LEVEL_MAXLEN+j)=0;
				}
			}
		}
		if ((Key==' ' || Arrow==28) && Q_SELECTED==3) SaveArray();
		if (Q_SELECTED==4) {
			if ((Key=='a' || Arrow=='K') && LevelProps[CURRENT_LEVEL][2]>3) LevelProps[CURRENT_LEVEL][2]--;
			if ((Key=='d' || Arrow=='M') && LevelProps[CURRENT_LEVEL][2]<10) LevelProps[CURRENT_LEVEL][2]++;
			HeroSides=LevelProps[CURRENT_LEVEL][2];
		}
		if ((Key==' ' || Arrow==28) && Q_SELECTED==5) GAME_TYPE=0;
	}
	if (Key=='e') {
		if (Panel==0) {
			Panel=1;
		} else {
			Panel=0;
		}
	}
	if (Key=='q') {
		if (Panel==0) {
			Panel=2;
		} else {
			Panel=0;
		}
	}
	//Draw grid
	for (i=0; i<=10; i++) {
		DrawLine (43*i,0,43*i,43*9,GLOBAL_FRONTCOLOR);
	}
	for (i=0; i<=9; i++) {
		DrawLine (0,43*i,430,43*i,GLOBAL_FRONTCOLOR);
	}
	//Draw panel
	DrawText (450,10,"e_tools",GLOBAL_FRONTCOLOR);
	IntToStr (Tile_X,NUMBER);
	DrawText (450,30,"(",GLOBAL_FRONTCOLOR);
	DrawText (470,30,NUMBER,GLOBAL_FRONTCOLOR);
	DrawText (530,30,"/",GLOBAL_FRONTCOLOR);
	IntToStr (Tile_Y,NUMBER);
	DrawText (550,30,NUMBER,GLOBAL_FRONTCOLOR);
	DrawText (570,30,")",GLOBAL_FRONTCOLOR);

	DrawLine (480,70,530,70,GLOBAL_FRONTCOLOR);
	DrawLine (480,70,480,70+300,GLOBAL_FRONTCOLOR);
	DrawLine (530,70,530,70+300,GLOBAL_FRONTCOLOR);
	for (i=1;i<=6; i++) DrawLine (480,70+50*i,530,70+50*i,GLOBAL_FRONTCOLOR);
	//Empty block
	DrawLine (480+4,70+4,480+42,70+42,GLOBAL_FRONTCOLOR);
	DrawLine (480+4,70+42,480+42,70+4,GLOBAL_FRONTCOLOR);
	DrawBlock (480+4,70+4+50,GLOBAL_FRONTCOLOR);
	DrawPit (480+7,70+4+100,GLOBAL_FRONTCOLOR);
	DrawBatut (480+4,70+4+150,GLOBAL_FRONTCOLOR);
	DrawFlag (480+8,70+4+200,GLOBAL_FRONTCOLOR);
	DrawText (480+14,70+14+250,"f",GLOBAL_FRONTCOLOR);
	DrawText (450,400,TILENAME [Tile_Type],GLOBAL_FRONTCOLOR);

	//Draw properties
	DrawText (10,410,"q_properties",GLOBAL_FRONTCOLOR);
	DrawText (10,430+20,"test level",GLOBAL_FRONTCOLOR);
	DrawText (10,470,"start column <     >",GLOBAL_FRONTCOLOR);
	IntToStr (GLOBAL_CHECKPOINT,NUMBER);
	DrawText (270,470,NUMBER,GLOBAL_FRONTCOLOR);
	DrawText (10,490,"reset level",GLOBAL_FRONTCOLOR);
	DrawText (10,510,"save as 2d array (for developers)",GLOBAL_FRONTCOLOR);
	DrawText (10,530,"hero sides <   >",GLOBAL_FRONTCOLOR);
	IntToStr (LevelProps[CURRENT_LEVEL][2],NUMBER);
	DrawText (230,530,NUMBER,GLOBAL_FRONTCOLOR);
	DrawText (10,550,"back to menu",GLOBAL_FRONTCOLOR);

	if (Panel==0) {
		DrawLine ((Tile_X%10)*43,0,(Tile_X%10)*43,400,HeroColor);
		DrawLine ((Tile_X%10)*43+43,0,(Tile_X%10)*43+43,400,HeroColor);
		DrawLine (0,(Tile_Y%10)*43,440,(Tile_Y%10)*43,HeroColor);
		DrawLine (0,(Tile_Y%10)*43+43,440,(Tile_Y%10)*43+43,HeroColor);
	}
	if (Panel==1) {
		DrawText (450,10,"e_tools",HeroColor);
		DrawLine (480,70+Tile_Type*50,530,70+Tile_Type*50,HeroColor);
		DrawLine (480,70+Tile_Type*50,480,70+50+Tile_Type*50,HeroColor);
		DrawLine (480,70+Tile_Type*50+50,530,70+50+Tile_Type*50,HeroColor);
		DrawLine (530,70+Tile_Type*50,530,70+Tile_Type*50+50,HeroColor);
		DrawText (450,400,TILENAME [Tile_Type],HeroColor);
	}
	if (Panel==2) {
	       DrawText (10,410,"q_properties",HeroColor);
	       if (Q_SELECTED==0) DrawText (10,450,"test level",HeroColor);
	       if (Q_SELECTED==1) DrawText (10,470,"start column <     >",HeroColor);
	       if (Q_SELECTED==2) DrawText (10,490,"reset level",HeroColor);
	       if (Q_SELECTED==3) DrawText (10,510,"save as 2d array (for developers)",HeroColor);
	       if (Q_SELECTED==4) DrawText (10,530,"hero sides <   >",HeroColor);
	       if (Q_SELECTED==5) DrawText (10,550,"back to menu",HeroColor);
	}

	for (i=0; i<10; i++) {
		for (j=0; j<9; j++) {
			int CurBlock=*(Levels[CURRENT_LEVEL]+j*LEVEL_MAXLEN+Tile_X-Tile_X%10+i);
			if (CurBlock==1) DrawBlock (43*i,43*j,GLOBAL_BLOCKCOLOR);
			if (CurBlock==2) DrawPit (43*i,43*j,GLOBAL_PITCOLOR);
			if (CurBlock==3) DrawBatut (43*i,43*j,GLOBAL_BATUTCOLOR);
			if (CurBlock==4) DrawFlag (43*i,43*j,GLOBAL_FLAGCOLOR);

		}
		if (*(Levels[CURRENT_LEVEL]+0*LEVEL_MAXLEN+Tile_X-Tile_X%10+i)==5) {
			for (j=0; j<9;j++) {
				DrawText (43*i+10,43*j+10,"f",GLOBAL_FRONTCOLOR);
			}
		}
	}
	if (Key==27) {
		GAME_TYPE=0;
	}
}
Beispiel #22
0
void Tetris::DrawBoard(game_info* gi)
{
	// set up materials for the board posts:

	glMaterialfv(GL_FRONT, GL_AMBIENT, board_piece_amb);
	glMaterialfv(GL_FRONT, GL_DIFFUSE, board_piece_diff);
	glMaterialfv(GL_FRONT, GL_SPECULAR, board_piece_spec);
	glMaterialfv(GL_FRONT, GL_SHININESS, &board_piece_shine);
	glMaterialfv(GL_FRONT, GL_EMISSION, board_piece_emi);

	// left
	glPushMatrix();
	
	glTranslatef(gi->side * 3.75,0,0);

	glRotatef(gi->side * gi->rot,0,1,0);
	glRotatef(-gi->rot2,1,0,0);
	
	glTranslatef(-2.625,-0.125,0);
	glScalef(0.25,12,0.5);

	engine.DrawCube();

	glPopMatrix();

	// right
	glPushMatrix();
	
	glTranslatef(gi->side * 3.75,0,0);

	glRotatef(gi->side * gi->rot,0,1,0);
	glRotatef(-gi->rot2,1,0,0);
	
	glTranslatef(2.625,-0.125,0);
	glScalef(0.25,12,0.5);

	engine.DrawCube();

	glPopMatrix();
	


	

	// bottom
	glPushMatrix();
	
	glTranslatef(gi->side * 3.75,0,0);

	glRotatef(gi->side * gi->rot,0,1,0);
	glRotatef(-gi->rot2,1,0,0);
	
	glTranslatef(0,-6,0);
	glScalef(5,0.25,0.5);

	engine.DrawCube();

	glPopMatrix();

	int i,j;

	
	engine.EnableTextures();
	
	for (i=0; i<10; i++)
	{
		for (j=0; j<24; j++)
		{
			if(gi->board[i][j] != -1)
			{
				DrawBlock(gi->board[i][j], gi, 0.5 * (double)i, 0.5 * (double)j);
			}
		}
	}

	engine.DisableTextures();
}
Beispiel #23
0
void Tetris::DrawPiece(game_info* gi, double x, double y)
{
	engine.EnableTextures();

	switch (gi->curpiece)
	{
	case 0:
		if (gi->curdir % 2)
		{
			DrawBlock(gi->curpiece, gi, x-0.5, y);
			DrawBlock(gi->curpiece, gi, x-1.0, y);
			DrawBlock(gi->curpiece, gi, x, y);
			DrawBlock(gi->curpiece, gi, x+0.5, y);
		}
		else
		{
			DrawBlock(gi->curpiece, gi, x, y);
			DrawBlock(gi->curpiece, gi, x, y+0.5);
			DrawBlock(gi->curpiece, gi, x, y+1.0);
			DrawBlock(gi->curpiece, gi, x, y-0.5);
		}
		break;
	case 1:
		if (gi->curdir % 2)
		{
			DrawBlock(gi->curpiece, gi, x+0.5, y);
			DrawBlock(gi->curpiece, gi, x, y+0.5);
			DrawBlock(gi->curpiece, gi, x, y);
			DrawBlock(gi->curpiece, gi, x+0.5, y-0.5);
		}
		else
		{
			DrawBlock(gi->curpiece, gi, x+0.5, y);
			DrawBlock(gi->curpiece, gi, x, y-0.5);
			DrawBlock(gi->curpiece, gi, x, y);
			DrawBlock(gi->curpiece, gi, x-0.5, y-0.5);
		}
		break;
	case 2:
		if (gi->curdir % 2)
		{
			DrawBlock(gi->curpiece, gi, x-0.5, y);
			DrawBlock(gi->curpiece, gi, x, y+0.5);
			DrawBlock(gi->curpiece, gi, x, y);
			DrawBlock(gi->curpiece, gi, x-0.5, y-0.5);
		}
		else
		{
			DrawBlock(gi->curpiece, gi, x-0.5, y);
			DrawBlock(gi->curpiece, gi, x, y-0.5);
			DrawBlock(gi->curpiece, gi, x, y);
			DrawBlock(gi->curpiece, gi, x+0.5, y-0.5);
		}
		break;
	case 3:
		DrawBlock(gi->curpiece, gi, x+0.5, y);
		DrawBlock(gi->curpiece, gi, x, y+0.5);
		DrawBlock(gi->curpiece, gi, x, y);
		DrawBlock(gi->curpiece, gi, x+0.5, y+0.5);
		break;
	case 4:
		if (gi->curdir == 0)
		{
			DrawBlock(gi->curpiece, gi, x, y);
			DrawBlock(gi->curpiece, gi, x, y+0.5);
			DrawBlock(gi->curpiece, gi, x, y-0.5);
			DrawBlock(gi->curpiece, gi, x+0.5, y+0.5);
		}
		else if (gi->curdir == 1)
		{
			DrawBlock(gi->curpiece, gi, x, y);
			DrawBlock(gi->curpiece, gi, x+0.5, y);
			DrawBlock(gi->curpiece, gi, x-0.5, y);
			DrawBlock(gi->curpiece, gi, x-0.5, y+0.5);
		}
		else if (gi->curdir == 2)
		{
			DrawBlock(gi->curpiece, gi, x, y);
			DrawBlock(gi->curpiece, gi, x, y+0.5);
			DrawBlock(gi->curpiece, gi, x, y-0.5);
			DrawBlock(gi->curpiece, gi, x-0.5, y-0.5);
		}
		else
		{
			DrawBlock(gi->curpiece, gi, x, y);
			DrawBlock(gi->curpiece, gi, x+0.5, y);
			DrawBlock(gi->curpiece, gi, x-0.5, y);
			DrawBlock(gi->curpiece, gi, x+0.5, y-0.5);
		}
		break;
	case 5:
		if (gi->curdir == 0)
		{
			DrawBlock(gi->curpiece, gi, x, y);
			DrawBlock(gi->curpiece, gi, x, y+0.5);
			DrawBlock(gi->curpiece, gi, x, y-0.5);
			DrawBlock(gi->curpiece, gi, x-0.5, y+0.5);
		}
		else if (gi->curdir == 1)
		{
			DrawBlock(gi->curpiece, gi, x, y);
			DrawBlock(gi->curpiece, gi, x+0.5, y);
			DrawBlock(gi->curpiece, gi, x-0.5, y);
			DrawBlock(gi->curpiece, gi, x-0.5, y-0.5);
		}
		else if (gi->curdir == 2)
		{
			DrawBlock(gi->curpiece, gi, x, y);
			DrawBlock(gi->curpiece, gi, x, y+0.5);
			DrawBlock(gi->curpiece, gi, x, y-0.5);
			DrawBlock(gi->curpiece, gi, x+0.5, y-0.5);
		}
		else
		{
			DrawBlock(gi->curpiece, gi, x, y);
			DrawBlock(gi->curpiece, gi, x+0.5, y);
			DrawBlock(gi->curpiece, gi, x-0.5, y);
			DrawBlock(gi->curpiece, gi, x+0.5, y+0.5);
		}
		break;
	case 6:
		if (gi->curdir == 0)
		{
			DrawBlock(gi->curpiece, gi, x, y);
			DrawBlock(gi->curpiece, gi, x+0.5, y);
			DrawBlock(gi->curpiece, gi, x-0.5, y);
			DrawBlock(gi->curpiece, gi, x, y-0.5);
		}
		else if (gi->curdir == 1)
		{
			DrawBlock(gi->curpiece, gi, x, y);
			DrawBlock(gi->curpiece, gi, x+0.5, y);
			DrawBlock(gi->curpiece, gi, x, y+0.5);
			DrawBlock(gi->curpiece, gi, x, y-0.5);
		}
		else if (gi->curdir == 2)
		{
			DrawBlock(gi->curpiece, gi, x, y);
			DrawBlock(gi->curpiece, gi, x+0.5, y);
			DrawBlock(gi->curpiece, gi, x-0.5, y);
			DrawBlock(gi->curpiece, gi, x, y+0.5);
		}
		else
		{
			DrawBlock(gi->curpiece, gi, x, y);
			DrawBlock(gi->curpiece, gi, x-0.5, y);
			DrawBlock(gi->curpiece, gi, x, y+0.5);
			DrawBlock(gi->curpiece, gi, x, y-0.5);
		}
		break;
	}

	engine.DisableTextures();
}
Beispiel #24
0
void base_tetrix_scene::user_rotate()
{
	m_pblock->rotate();
	DrawBlock();
}
void CKCBusyProgressCtrl::DrawBlocks(CDC& dc, CRect& /* rect */)
{
    CRect				bRect;
    double				dXOffset = 0;
    int					i;
    CPen				nPen, *pOldPen = NULL;
    CBrush				nBrush, *pOldBrush = NULL;

    // create some drawing tools
    nPen.CreatePen( PS_SOLID, 0, m_colBlockEdge );
    nBrush.CreateSolidBrush( m_colBlockFace );
    pOldPen = dc.SelectObject(&nPen);
    pOldBrush = dc.SelectObject(&nBrush);

    // create the initial rectangle
    bRect.top = 0; bRect.bottom = (int) m_dBlockHeight;
    bRect.left = 0; bRect.right = (int) m_dBlockWidth;
    for ( i = 0; i < m_nNumSteps; i++ )
    {
        if ( m_nMode & BPC_MODE_BUSY )
        {
            switch ( m_nBusyFill )
            {
            case	BPC_BUSYFILL_BLOCK:
                {
                    if ( i == m_nCurPos )
                        DrawHiliteBlock(dc, bRect);
                    else
                        DrawBlock(dc, bRect);
                }
                break;

            case	BPC_BUSYFILL_SMOOTH:
                {
                    double		dDiff = (double)m_nNumStepsSmooth;
                    double		dPerc = ((double) m_nCurPos / dDiff);
                    int			nFull = (int) (dPerc*(double)m_nNumSteps)-1;
                    double		dPerc2 = (((dPerc * (double)m_nNumSteps)-1) - nFull);
                    int			nPartial = (int)(m_dBlockWidth * dPerc2);

                    if ( i <= nFull )
                        DrawHiliteBlock(dc, bRect);
                    else
                    {
                        DrawBlock(dc, bRect);
                        if ( i == nFull + 1 && nPartial )
                            DrawPartialBlock(dc, bRect, nPartial);
                    }
                }
                break;
            }
        }
        else if ( m_nMode & BPC_MODE_PROGRESS )
        {
            double		dDiff = (double)(m_nUpper - m_nLower);
            double		dPerc = ((double) m_nCurPos / dDiff);
            int			nFull = (int) (dPerc*(double)m_nNumSteps)-1;
            double		dPerc2 = (((dPerc * (double)m_nNumSteps)-1) - nFull);
            int			nPartial = (int)(m_dBlockWidth * dPerc2);

            if ( i <= nFull )
                DrawHiliteBlock(dc, bRect);
            else
            {
                DrawBlock(dc, bRect);
                if ( i == nFull + 1 && nPartial )
                    DrawPartialBlock(dc, bRect, nPartial);
            }
        }
        // offset the rectangle a bit
        dXOffset += m_dBlockWidth + (double) m_nIBPadding;
        bRect.left = (int) dXOffset;
        bRect.right = (int)(dXOffset + m_dBlockWidth);
    }

    // cleanup after ourselves...
    dc.SelectObject(pOldPen);
    dc.SelectObject(pOldBrush);
    nPen.DeleteObject();
    nBrush.DeleteObject();
}
void Chunk::DrawBlock(int blockId)
{
    //glDisable ( GL_TEXTURE_2D );
    switch (blockId)
    {
        case 1: //Stone
        case 14: //Gold Ore
        case 15: //Iron Ore
        case 16: //Coal
        case 43: //Double Stone Slab
        case 44: //Stone Slab
        case 56: //Diamond Ore
        case 61: //Fernace
        case 62: //Burning Furnace
        case 70: //Stone Pressure Plate
        case 73: //Redstone Ore
        case 74: //Glowing Redstone Ore
            //glEnable ( GL_TEXTURE_2D );
            //glBindTexture ( GL_TEXTURE_2D, 1 );
            DrawBlock(Color(255, 255, 255));
            //DrawBlock(Color(143, 143, 143));
            return;

        case 2: //Grass
            DrawBlock(Color(108, 172, 66));
            return;

        case 3: //Dirt
        case 60: //Soil
            DrawBlock(Color(121, 85, 58));
            return;

        case 4: //Cobblestone
        case 67: //Cobblestone Stairs
            DrawBlock(Color(92, 92, 92));
            return;

        case 5: //Wood
        case 47: //Bokshelf
        case 53: //Wooden Stairs
        case 54: //Chest
        case 58: //Workbench
        case 72: //Wooden Pressure Plate
        case 84: //Jukebox
            DrawBlock(Color(180, 144, 90));
            return;

        case 7: //Bedrock
            DrawBlock(Color(0, 0, 0));
            return;

        case 8: //Water
        case 9: //Water moving
            DrawBlock(Color(38, 92, 255));
            return;

        case 10: //Lava
        case 11: //Lava Moving
            DrawBlock(Color(198, 58, 4));
            return;

        case 12: //Sand
            DrawBlock(Color(211, 204, 149));
            return;

        case 13: //Granite
            DrawBlock(Color(179, 140, 128));
            return;

        case 17: //Tree
            DrawBlock(Color(108, 87, 54));
            return;

        case 18: //Leaves
            DrawBlock(Color(85, 245, 53));
            return;

        case 19: //Sponge?
            DrawBlock(Color(206, 206, 70));
            return;

        case 35: //Wool
            DrawBlock(Color(186, 186, 186));
            return;

        case 41: //Gold
            DrawBlock(Color(255, 255, 98));
            return;

        case 42: //Iron
            DrawBlock(Color(197, 197, 197));
            return;

        case 45: //Brick
            DrawBlock(Color(122, 60, 43));
            return;

        case 46: //TNT
            DrawBlock(Color(219, 68, 26));
            return;

        case 48: //Moss Stone
            DrawBlock(Color(111, 111, 82));
            return;

        case 49: //Obsidian
            DrawBlock(Color(60, 48, 86));
            return;

        case 50: //Torch
            DrawBlock(Color(255, 255, 151));
            return;

        case 51: //Fire
            DrawBlock(Color(213, 137, 11));
            return;

        case 52: //Monster Spawner
            DrawBlock(Color(50, 79, 97));
            return;

        case 57: //Diamond
            DrawBlock(Color(165, 236, 233));
            return;

        case 66: //Minecart Tracks
            DrawBlock(Color(100, 79, 42));
            return;

        case 75: //Redstone Torch (off)
        case 76: //Redstone Torch (on)
            DrawBlock(Color(253, 0, 0));
            return;

        case 78: //Snow
        case 80: //Snow Block
            DrawBlock(Color(238, 255, 255));
            return;

        case 79: //Ice
            DrawBlock(Color(170, 203, 255));
            return;

        case 81: //Cactus
            DrawBlock(Color(15, 114, 26));
            return;

        case 82: //Clay
            DrawBlock(Color(183, 128, 128));
            return;

        case 86: //Pumpkin
        case 91: //Jack-O-Latern
            DrawBlock(Color(227, 144, 29));
            return;

        case 87: //Netherrack
            DrawBlock(Color(146, 86, 86));
            return;

        case 88: //Soul Sand
            DrawBlock(Color(145, 121, 106));
            return;

        case 89: //GlowStone
            DrawBlock(Color(192, 143, 70));
            return;

        default:
            return;
    }
}
Beispiel #27
0
void base_tetrix_scene::user_left()
{
	m_pblock->move_left();
	DrawBlock();
}
void Chunk::Render(int mode, void *params)
{
    switch(mode)
    {
    case TOP_DOWN_LOW_RES:
    case TOP_DOWN_LOW_RES_HEIGHT:
    case TOP_DOWN_LOW_RES_LIGHT:
            for (int x = 0; x < 16; x++)
            {
                for (int z = 0; z < 16; z++)
                {
                    for (int y = 127; y >= 0; y--)
                    {
                        int id = blocks->content[y + z * 128 + x * 128 * 16];

                        if(IsDrawable(id))
                        {
                            switch(mode)
                            {
                            case TOP_DOWN_LOW_RES_HEIGHT:
                                img[x + z * 16] = Color(y / 127.0f * 255, y / 127.0f * 255, y / 127.0f * 255);
                                break;
                            case TOP_DOWN_LOW_RES:
                            case TOP_DOWN_LOW_RES_LIGHT:
                                img[x + z * 16] = GetBlockColor(id);
                                break;
                            }
                            break;
                        }
                    }
                }
            }
            break;
            
        case OPEN_GL_RENDER:
            for (int x = 0; x < 16; x++)
            {
                //glPushMatrix();
                
                //glTranslatef(x / 16.0f, 0, 0);
                
                for (int z = 0; z < 16; z++)
                {
                
                    //glPushMatrix();

                    //glTranslatef(0, 0, z / 16.0f);
                    
                    for (int y = 0; y < 128; y++)
                    {
                        int id = blocks->content[y + z * 128 + x * 128 * 16];

                        if(IsDrawable(id))
                        {
                            //glPushMatrix();
                            
                            //glTranslatef(0, y / 16.0f, 0);
                            //glTranslatef(1/32.0, 1/32.0, 1/32.0);
                            
                            DrawBlock(id);
                            
                            //glPopMatrix();
                        }
                    }
                    
                    //glPopMatrix();
                    
                }
                
                //glPopMatrix();
            }
            
         case CAVES_LOW_RES:
         case CAVES_LOW_RES_HEIGHT:
         case CAVES_LOW_RES_LIGHT:
            for (int x = 0; x < 16; x++)
            {
                for (int z = 0; z < 16; z++)
                {
                    img[x + z * 16] = Color(0, 0, 0, 0);

                    bool cave = false;
                    bool exit = false;
                    bool first = true;
                    bool bottom = false;
                    for (int y = 127; y >= 0; y--)
                    {
                        int id = blocks->content[y + z * 128 + x * 128 * 16];

                        if(IsDrawable(id))
                        {
                            if(first && !cave)
                                img[x + z * 16] = GetBlockColor(id);

                            first = false;

                            if(cave)
                                bottom = true;

                            if(id != 17 && id != 18)
                            {
                                cave = true;
                            }
                            else
                            {
                                cave = false;
                                bottom = false;
                            }
                        }

                        Color c;

                        float alpha = *((float*)params);

                        if(cave && id == 50)
                        {
                            c = img[x + z * 16];
                            Color c2 = GetBlockColor(id);
                            img[x + z * 16] = Color((int)(c2.r * (1 - alpha) + c.r * alpha), (int)(c2.g * (1 - alpha) + c.g * alpha), (int)(c2.b * (1 - alpha) + c.b * alpha));
                            break;
                        }
                        
                        if(cave && bottom)
                        {
                            switch(id)
                            {
                                case 0:
                                    c = img[x + z * 16];
                                    switch(mode)
                                    {
                                    case CAVES_LOW_RES_HEIGHT:
                                        img[x + z * 16] = Color((int)((y / 127.0f) * 256 * (1 - alpha) + c.r * alpha), (int)((y / 127.0f) * 265 * (1 - alpha) + c.g * alpha), (int)((y / 127.0f) * 256 * (1 - alpha) + c.b * alpha));
                                        break;
                                    case CAVES_LOW_RES:
                                    case CAVES_LOW_RES_LIGHT:
                                        img[x + z * 16] = Color((int)(c.r * alpha), (int)(c.g * alpha), (int)(c.b * alpha));
                                        break;
                                    }
                                    exit = true;
                                    break;
                                    
                                //case 8: //Water
                                //case 9: //Water moving
                                    //img[x + z * 16] = Color(38, 92, 255);
                                    //exit = true;
                                    break;

                                case 10: //Lava
                                case 11: //Lava Moving
                                    c = img[x + z * 16];
                                    img[x + z * 16] = Color((int)(198 * (1 - alpha) + c.r * alpha), (int)(58 * (1 - alpha) + c.g * alpha), (int)(4 * (1 - alpha) + c.b * alpha));
                                    exit = true;
                                    break;                              
                            }
                        }
                        
                        if(exit)
                            break;
                    }
                }
            }
            break;                       
        break;
    }
}
Beispiel #29
0
 inline void DrawRow(unsigned y, T get)
 {
     for(int x=1; x<Width-1; ++x) DrawBlock(x,y, get(x));
 }
Beispiel #30
0
/*
 * Prints char at specified buf indx, returns next indx
 */
void Lcd_t::DrawChar(int *index, uint8_t AChar) {
    for(uint8_t i=0; i < 6; i++) {
        DrawBlock((*index)++, Font_6x8_Data[AChar][i], 0xFF);
        if (*index >= LCD_VIDEOBUF_SIZE) *index = 0;
    }
}