bool ArkanoidRemakeSdl::SetCurrentLevel(unsigned int n) { if (!ArkanoidRemake::SetCurrentLevel(n)) return false; SetBackground(mLevel[n-1].mBackgroundScene); int blocksize_x = 0; int blocksize_y = 0; mSdlApp.GetSurfMatrixElemSize(mBlockMatrixName,blocksize_x,blocksize_y); for (unsigned int row = 0; row < mBlock.Rows(); row++) { for (unsigned int col = 0; col < mBlock.Cols(); col++) { Block& block = mBlock(row,col); block.Size().X = blocksize_x; block.Size().Y = blocksize_y; block.Pos().X = col * blocksize_x+blocksize_x/2; block.Pos().Y = row * blocksize_y+blocksize_y/2; block.Origin().X = -blocksize_x/2; block.Origin().Y = -blocksize_y/2; } } DrawBlocks(); return true; }
void BreakoutLevel::Bootstrap() { HandleLevelInput(); _ball_x = _pad_position + BLOCK_WIDTH / 2; _ball_y = PAD_Y - BLOCK_HEIGHT; for(uint8_t i = 0; i < BLOCKS; i++) { _blocks[i].active = 1; bool unique = false; while(!unique) { unique = true; _blocks[i].x = random(10); _blocks[i].y = random(4); for(uint8_t j = 0; j < BLOCKS; j++) { if(j == i) continue; if(_blocks[i].x == _blocks[j].x && _blocks[i].y == _blocks[j].y) { unique = false; break; } } } } DrawBlocks(); }
//ボール発射待機中の画面を描画 void Standby_Draw(Gamedata& gameData){ PictureMap& g = gameData.graphicData; DrawBlocks(gameData); if(gameData.intervalVisibleObjs["ready_logo"].Visible()){ if(DrawGraph(READY_X, READY_Y, g["ready"], TRUE) == -1){ pd("ready_logo"); } } DrawBars(gameData); DrawScore(gameData); }
void ArkanoidRemakeSdl::Frame() { if (mSdlApp.ExistsSurface(mSnowfallSurf)) { // Scroll the background mBkgndScroll += 20.0*(mCurrTime-mPrevTime); if (mBkgndScroll>0) mBkgndScroll=-mSdlApp.GetSurfHeight(mSnowfallSurf); } DrawBackground(); DrawPlayArea(); DrawBlocks(); DrawBall(); DrawShip(); DrawBonus(); DrawText(); mSdlApp.UpdateWindow(); }
void CKCBusyProgressCtrl::OnPaint() { CPaintDC dc(this); // device context for painting // create a memory dc if needs be if ( !m_memDC.m_hDC ) { m_memDC.CreateCompatibleDC(&dc); m_memBmp.CreateCompatibleBitmap(&dc, m_rect.Width(), m_rect.Height()); m_pOldBmp = m_memDC.SelectObject(&m_memBmp); } DrawBackground(m_memDC, m_rect); DrawBlocks(m_memDC, m_rect); // render the final image dc.BitBlt(0, 0, m_rect.Width(), m_rect.Height(), &m_memDC, 0, 0, SRCCOPY); }
void Drop_Draw(Gamedata& gameData){ DrawBlocks(gameData); PictureMap g = gameData.graphicData; DrawGraph(DROP_X, DROP_Y, g["drop"], TRUE); }
// // FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) // // PURPOSE: Processes messages for the main window. // // WM_COMMAND - process the application menu // WM_PAINT - Paint the main window // WM_DESTROY - post a quit message and return // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; PAINTSTRUCT ps; HDC hdc; int move = 30; switch (message) { case WM_COMMAND: wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); switch (wmId) { case ID_FILE_NEW: gameOver();//Runs gameOver, so gameover gets set to false, and starts our game over. break; case IDM_ABOUT: DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About); break; case IDM_EXIT: DestroyWindow(hWnd); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } break; case WM_PAINT: hdc = BeginPaint(hWnd, &ps); DrawEnclosure(hWnd, hdc);//Draws our background, and Rectangle enclosure. DrawBlocks(hWnd, hdc);//Draws falling blocks and checks for collisions. drawUser(hWnd, hdc);//Draws the user's block. drawTitle(hWnd, hdc);//Draws the level, and updates the speed of the falling block. EndPaint(hWnd, &ps); break; case WM_TIMER: InvalidateRect(hWnd, NULL, true); break; case WM_KEYDOWN: switch (wParam) { case VK_LEFT://If the left arrow key is pressed. moveLeft();//Moves the user's block left. break; case VK_RIGHT://If the right arrow key is pressed. moveRight();//Moves the user's block right. break; } InvalidateRect(hWnd, NULL, TRUE); UpdateWindow(hWnd); return 0; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }