void SFCaveGame :: draw( SDL_Surface *screen ) { Game::preDraw( screen ); if ( parent->getState() == STATE_PLAYING ) { // Screen drawing goes here terrain->drawTerrain( screen ); player->draw( screen ); drawBlocks( screen ); } else { // Screen drawing goes here terrain->drawTerrain( screen ); drawBlocks( screen ); player->draw( screen ); } Game::draw( screen ); }
world::world () { // creating the game window GameWindow.create(sf::VideoMode(500,500),"Brick Breaker v0.1"); // showing the splash screen GameSplashScreen = new SplashScreen ; GameSplashScreen->show("welcome.png",GameWindow); delete GameSplashScreen ; //showing the main menu MenuScreen = new menu ; MenuScreen->show(GameWindow); delete MenuScreen ; //setting up the blocks sf::Texture BlockTexture; BlockTexture.loadFromFile("block.png"); for (int i = 0 ; i < 5 ; i++) { for (int j = 0 ; j < 5 ; j++ ) { blocks[i][j].GameObjectSprite.setTexture(BlockTexture); blocks[i][j].setPositon(i*100,j*25); } } drawBlocks(); GameWindow.display(); // entering the game loop while(true) { GameLoop(); } }
void Lines::paintEvent(QPaintEvent *e){ Q_UNUSED(e); QPainter qp(this); /*Create serial object */ try { // Make a SimpleSerial object with the parameter for your Wunderboard/OS this->tmp = this->wunder->readLine(); /*handles odd SimpleSerial Problems*/ if(this->tmp.length() != 3) adcval = MADC; //send it back to the middle else adcval = atoi(this->tmp.c_str()) - MADC ; } catch(boost::system::system_error& e) { std::cerr<<tmp<<": Error: "<<std::endl;//<<e.what()<<std::endl; } qp.setWindow(0,0, 800, 600); drawBoundary(&qp); drawPaddle(&qp); drawBall(&qp); drawBlocks(&qp); check_collision(); }
void world::updateWorld() { if ((int(WorldTime.getElapsedTime().asSeconds() *1000) ) % 2 == 1 ) { PlayerPadel.update(GameWindow); GameBall.update(GameWindow,PlayerPadel,blocks); GameWindow.clear(sf::Color(150,0,255)); PlayerPadel.draw(GameWindow); GameBall.draw(GameWindow); drawBlocks(); GameWindow.display(); WorldTime.restart(); } }
void PuzzlePrinter::print (const ksudoku::Game & game) { const ksudoku::Puzzle * puzzle = game.puzzle(); const SKGraph * graph = puzzle->graph(); if (graph->sizeZ() > 1) { KMessageBox::information (m_parent, i18n("Sorry, cannot print three-dimensional puzzles.")); return; } const int leastCellsToFit = 20; // Avoids huge cells in small puzzles. // Set up a QPrinter and a QPainter and allocate space on the page. bool pageFilled = setupOutputDevices (leastCellsToFit, graph->sizeX()); if (! m_printer) { return; // The user did not select a printer. } // Draw the puzzle grid and its contents. bool hasBlocks = (graph->specificType() != Mathdoku); bool hasCages = ((graph->specificType() == Mathdoku) || (graph->specificType() == KillerSudoku)); bool killerStyle = (graph->specificType() == KillerSudoku); if (hasBlocks) { // Only Mathdoku has no blocks. drawBlocks (puzzle, graph); } if (hasCages) { // Mathdoku and KillerSudoku have cages. drawCages (puzzle, graph, killerStyle); // KillerSudoku has blocks too. } drawValues (game, graph); // Print starting and filled-in values. if (pageFilled) { endPrint(); // Print immediately. } else { KMessageBox::information (m_parent, i18n ("The KSudoku setting for printing several puzzles per page " "is currently selected.\n\n" "Your puzzle will be printed when no more will fit on the " "page or when KSudoku terminates.")); } }
// This paints the button pixmaps upon loading the style. void QuartzHandler::createPixmaps() { // Obtain titlebar blend colours, and create the block stuff on pixmaps. QColorGroup g2 = options()->colorGroup(ColorTitleBlend, true); QColor c2 = g2.background(); g2 = options()->colorGroup(ColorTitleBar, true); QColor c = g2.background().light(130); titleBlocks = new KPixmap(); titleBlocks->resize(normalTitleHeight * 25 / 18, normalTitleHeight); drawBlocks(titleBlocks, *titleBlocks, c, c2); g2 = options()->colorGroup(ColorTitleBlend, false); c2 = g2.background(); g2 = options()->colorGroup(ColorTitleBar, false); c = g2.background().light(130); ititleBlocks = new KPixmap(); ititleBlocks->resize(normalTitleHeight * 25 / 18, normalTitleHeight); drawBlocks(ititleBlocks, *ititleBlocks, c, c2); // Set the on all desktops pin pixmaps; QColorGroup g; QPainter p; g = options()->colorGroup(onAllDesktopsButtonOnLeft ? ColorTitleBar : ColorTitleBlend, true); c = onAllDesktopsButtonOnLeft ? g.background().light(130) : g.background(); g2 = options()->colorGroup(ColorButtonBg, true); pinUpPix = new KPixmap(); pinUpPix->resize(16, 16); p.begin(pinUpPix); p.fillRect(0, 0, 16, 16, c); kColorBitmaps(&p, g2, 0, 1, 16, 16, true, pinup_white_bits, pinup_gray_bits, NULL, NULL, pinup_dgray_bits, NULL); p.end(); pinDownPix = new KPixmap(); pinDownPix->resize(16, 16); p.begin(pinDownPix); p.fillRect(0, 0, 16, 16, c); kColorBitmaps(&p, g2, 0, 1, 16, 16, true, pindown_white_bits, pindown_gray_bits, NULL, NULL, pindown_dgray_bits, NULL); p.end(); // Inactive pins g = options()->colorGroup(onAllDesktopsButtonOnLeft ? ColorTitleBar : ColorTitleBlend, false); c = onAllDesktopsButtonOnLeft ? g.background().light(130) : g.background(); g2 = options()->colorGroup(ColorButtonBg, false); ipinUpPix = new KPixmap(); ipinUpPix->resize(16, 16); p.begin(ipinUpPix); p.fillRect(0, 0, 16, 16, c); kColorBitmaps(&p, g2, 0, 1, 16, 16, true, pinup_white_bits, pinup_gray_bits, NULL, NULL, pinup_dgray_bits, NULL); p.end(); ipinDownPix = new KPixmap(); ipinDownPix->resize(16, 16); p.begin(ipinDownPix); p.fillRect(0, 0, 16, 16, c); kColorBitmaps(&p, g2, 0, 1, 16, 16, true, pindown_white_bits, pindown_gray_bits, NULL, NULL, pindown_dgray_bits, NULL); p.end(); }