int main() { int yPosition = INIT_Y; int xPosition = INIT_X; char ar; ar = 0; drawBoard(&yPosition, &xPosition, ar); while (1) { if (_kbhit()) drawBoard(&yPosition, &xPosition, getInput()); } return 0; }
void BoardItem::doMove(PieceItem* piece, const Game::Move &move) { qDebug("Board::doMove!"); if ( !move.isValid() ) return; Game::Board board = d->game->board(); movePiece(piece, move.from() , move.to()); if (d->game->atEnd()) { d->game->addMove(move); } else { qFatal("No variants for now..."); } d->game->forward(); if( move.isCastling() || move.isEnPassant()/* || move.isSpecial()*/ ) { drawBoard(); // FIXME: fix this lazy way! =P } }
void draw(void) { glClearColor(0.0f,0.0f,0.0f,0.0f); glClear(GL_COLOR_BUFFER_BIT); drawBoard(); glFlush(); }
void Game::update() { m_timer->update(); if (m_match->isStarted()) { m_match->update(); m_renderer->beginRender(); drawBoard(m_board->getBoard()); if (m_selectedJewel != -1) { drawSelected(); } drawScoreAndTime(); m_renderer->endRender(); } else if (m_match->isFinished()) { drawGameOverScreen(); } else { drawWelcomeScreen(); } }
void drawPuzzle(void) { bool isPlaying = (state == STATE_FREE || state == STATE_PICKED); if (toDrawAll) { arduboy.clear(); drawBoard(0); drawPieces(); toDrawAll = false; } else if (isPlaying && focusPieceIdx >= 0) { drawPiece(focusPieceIdx); } if (state == STATE_FREE) { drawCursor(); } if (state == STATE_CLEAR) { drawClearEffect(); } if (isHelpVisible && isPlaying) { HELP_T idx; if (state == STATE_FREE) { idx = HELP_FREE; } else { idx = (arduboy.buttonPressed(A_BUTTON)) ? HELP_HOLD : HELP_PICK; } drawHelp(idx, helpX, helpY); } }
void shadowDisplay(void (*drawScene)(const BoardData *, const BoardData3d *, const renderdata *), const BoardData* bd, const BoardData3d *bd3d, const renderdata *prd) { /* Pass 1: Draw model, ambient light only (some diffuse to vary shadow darkness) */ float zero[4] = {0,0,0,0}; float d1[4]; float specular[4]; float diffuse[4]; drawScene(bd, bd3d, prd); /* Create shadow volume in stencil buffer */ glEnable(GL_STENCIL_TEST); draw_shadow_volume_to_stencil(bd3d); /* Pass 2: Redraw model, full light in non-shadowed areas */ glStencilFunc(GL_NOTEQUAL, midStencilVal, (GLuint)~0); glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); glGetLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse); d1[0] = d1[1] = d1[2] = d1[3] = prd->dimness; glLightfv(GL_LIGHT0, GL_DIFFUSE, d1); /* No specular light */ glGetLightfv(GL_LIGHT0, GL_SPECULAR, specular); glLightfv(GL_LIGHT0, GL_SPECULAR, zero); if (renderingBase) drawScene(bd, bd3d, prd); else drawBoard(bd, bd3d, prd); glLightfv(GL_LIGHT0, GL_SPECULAR, specular); glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse); glDisable(GL_STENCIL_TEST); }
void t_chessGui::run() { chessCegui.init(); loadImages(); loadSprites(); initCegui(); initServer(); initConnect(); RedBox = sf::Shape::Rectangle(0,0,100,100,sf::Color(255,0,0)); BlackBox = sf::Shape::Rectangle(0,0,100,100,sf::Color(0,255,0)); BlueBox = sf::Shape::Rectangle(0,0,100,100,sf::Color(0,0,255)); BrownBox = sf::Shape::Rectangle(0,0,100,100,sf::Color(255,255,0)); PurpleBox = sf::Shape::Rectangle(0,0,100,100,sf::Color(160,32,240)); PinkBox = sf::Shape::Rectangle(0,0,100,100,sf::Color(255,182,193)); while (App.IsOpened()) { processEvents(); checkBuffer(); App.Clear(); drawBoard(); CEGUI::System::getSingleton().renderGUI(); App.Display(); } return; }
void gameLogic(){ int i; mode=NORMAL; playing=0; for (i=0;i<2;i++){ PALETTE[i]=LifeGame_palette[i]; } drawImage4(0,0,240,160,LifeGame); while(!(KEY_DOWN_NOW(BUTTON_START))){ } u16 colors[]={BLACK,LTGREY,RED,GREEN,BLUE,WHITE,DKGREY,YELLOW}; int numcolors = sizeof(colors)/sizeof(colors[0]); for (i=0;i<numcolors;i++){ PALETTE[i]=colors[i]; } clear();//Clear array to start game toReset=1; drawBoard(); mouseLogic(); }
static void display(Flipflopcreen *c) { GLfloat amb[] = { 0.8, 0.8, 0.8, 1.0 }; glClear(clearbits); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, 1.2); glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.15/board_avg_size ); glLightf(GL_LIGHT0, GL_QUADRATIC_ATTENUATION, 0.15/board_avg_size ); glLightfv(GL_LIGHT0, GL_AMBIENT, amb); /** setup perspectif */ glTranslatef(0.0, 0.0, -c->reldist*board_avg_size); glRotatef(22.5, 1.0, 0.0, 0.0); gltrackball_rotate (c->trackball); glRotatef(c->theta*100, 0.0, 1.0, 0.0); glTranslatef(-0.5*board_x_size, 0.0, -0.5*board_y_size); /* Center the board */ drawBoard(c); if (!c->button_down_p) { c->theta += .01 * spin; } }
void MainWindow::redraw() { if(state != STATE_RUNNING) return; drawBoard (game->brd); drawBlock (game->now); if (dropPreview) drawPreview (game->now.FakeDropToBottom(game->brd)); }
/* * drawScene() handles the animation and the redrawing of the * graphics window contents. */ void drawScene(void) { int i, k, x, y; float *color; // Clear the rendering window glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); /* Draw Board */ drawBoard( ); /* Draw Panel */ drawPanel( ); /* Draw the stones of all turns */ glBegin(GL_POINTS); for ( i = 0; i < g_curr_turn + 1; i++ ) { /* For all players */ for ( k = 0; k < g_num_players; k++ ) { /* Draw if the player has already played this turn */ if ( i < g_curr_turn || (k < g_curr_player && i == g_curr_turn) ) { x = g_players[k].stones[i].x; y = g_players[k].stones[i].y; color = g_players[k].color; glColor3f( color[0], color[1], color[2] ); glVertex2f( x, y ); } } } glEnd(); // Flush the pipeline. (Not usually necessary.) glFlush(); }
void drawWoodPlanks(double width, double length, double height, int boardCount, int boardGap) { ErrCheck("Before drawWoodPlanks"); double averageBoardWidth = width/(boardCount*1.0); double currentWidth = 0; for(int ii = 0; ii < boardCount; ii++) { glPushMatrix(); double boardWidth = (rand()%(10*int(boardCount*.7)) + 100-int(boardCount*.7)*5)/100.0*averageBoardWidth; double boardHeight = (rand()%10+95)/100.0*height; if(ii == boardCount - 1) { boardWidth = width - currentWidth; } glTranslated(currentWidth + boardWidth/2.0 , 0, 0); glRotated(90,0,1,0); if(rand()%2) { glTranslated(length,0,0); glRotated(180,0,1,0); } drawBoard(length,boardHeight,boardWidth*(1-boardGap)); currentWidth += boardWidth; glPopMatrix(); } ErrCheck("After drawWoodPlanks"); }
static int display(Queenscreen *qs) { int polys = 0; glClear(clearbits); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); /* setup light attenuation */ glEnable(GL_COLOR_MATERIAL); glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, 0.8/(0.01+findAlpha(qs))); glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.06); /** setup perspective */ glTranslatef(0.0, 0.0, -1.5*qs->BOARDSIZE); glRotatef(30.0, 1.0, 0.0, 0.0); gltrackball_rotate (qs->trackball); glRotatef(qs->theta*100, 0.0, 1.0, 0.0); glTranslatef(-0.5*qs->BOARDSIZE, 0.0, -0.5*qs->BOARDSIZE); /* find light positions */ qs->position[0] = qs->BOARDSIZE/2.0 + qs->BOARDSIZE/1.4*-sin(qs->theta*100*M_PI/180.0); qs->position[2] = qs->BOARDSIZE/2.0 + qs->BOARDSIZE/1.4*cos(qs->theta*100*M_PI/180.0); qs->position[1] = 6.0; if(!wire) { glEnable(GL_LIGHTING); glLightfv(GL_LIGHT0, GL_POSITION, qs->position); glEnable(GL_LIGHT0); } /* draw reflections */ if(!wire) { polys += draw_reflections(qs); glEnable(GL_BLEND); } polys += drawBoard(qs); if(!wire) glDisable(GL_BLEND); glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.1); glTranslatef(0.5, 0.0, 0.5); polys += drawPieces(qs); /* rotate camera */ if(!qs->button_down_p) qs->theta += .002; /* zero out board, find new solution of size MINBOARD <= i <= MAXBOARD */ if(++qs->steps == 1024) { qs->steps = 0; blank(qs); qs->BOARDSIZE = MINBOARD + (random() % (MAXBOARD - MINBOARD + 1)); qs->colorset = (qs->colorset+1)%COLORSETS; go(qs); } return polys; }
/* openGL display function */ void display() { GLfloat light_position[] = {0.0,0.0,0.0,0.0}; light_position[0] = light1_x; light_position[1] = light1_y; light_position[2] = light1_z; /* the shadow matrix */ M[0]= 1; M[4]= 0; M[8] =(-1*(light1_x)/light1_z); M[12]= 0; M[1]= 0; M[5]= 1; M[9] =(-1*(light1_y)/light1_z); M[13]= 0; M[2]= 0; M[6]= 0; M[10]= 0; M[14]= 0; M[3]= 0; M[7]= 0; M[11]= 0; M[15]= 1; /* specular highlights have color 'mat_specular'*/ glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, mat_specular); /* shininess ('N') = mat_shininess*/ glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, mat_shininess); /* replaces the matrix in the top of the stack with the identity matrix */ glLoadIdentity(); /* If the window is the main one, we want the 2D view, otherwise we want the position alterable 3D view */ if(glutGetWindow() == window_main) gluLookAt(set_eye_x,set_eye_y,set_eye_z, 0,0,0, 0,0,1); else{ gluLookAt(18,4,10, 0,0,0, 0,0,1); glRotatef(sphi, 0, 0, 1); glRotatef(stheta, 1, 0, 0); } /* move light0 to 'light_position' */ glLightfv(GL_LIGHT0, GL_POSITION, light_position); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); /* initialize the quadric object */ quadObj = gluNewQuadric(); /* Draws the TRING Board */ drawBoard(); /* Displays the cue arrow */ if(no_motion) display_arrow(); /* specular highlights have color 'mat_specular'*/ glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, mat_specular); /* shininess ('N') = mat_shininess*/ glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, mat_shininess); /* Display the balls */ drawPoolBalls(); glutSwapBuffers(); glFlush(); }
void BoardWidget::resizeEvent(QResizeEvent *e) { PieceWidget::resizeEvent(e); drawBoard(); if (renderMode) updatePieces(); update(); }
void BoardDrawer::resetSize(int width, int height) { m_width = width; m_height = height; if (m_board) { setTransform(); drawBoard(); } }
void CPlayer::draw(IDirect3DDevice9* pd3dDevice,double eTime) { //그려주기 drawBoard(pd3dDevice); //임팩트주기 drawEffect(pd3dDevice,eTime); }
void GameView::draw() { ofBackground(ofColor::white); // draw board drawBoard(x_ + border_width_, y_ + border_height_, width_ - 2 * border_width_, height_ - 2 * border_height_); // draw status text drawStatusText(x_ + border_width_, y_ + height_ - status_text_offset_, font_size_); }
void MainWindow::paintEvent(QPaintEvent *) { QPainter *p = new QPainter(this); // BOARD ISNT DRAWING WTF anyNewKings(); drawBoard(p); drawPieces(p); }
void mouseLogic(){ while(1){ if(KEY_DOWN_NOW(BUTTON_SELECT)){ while(KEY_DOWN_NOW(BUTTON_SELECT)); toReset=1; } if(KEY_DOWN_NOW(BUTTON_DOWN)){ delay(10); if (mouse->r>(UpperLeftRow+MAXR*4-6)){ while(KEY_DOWN_NOW(BUTTON_DOWN)); menuLogic(); } else{mouse->r+=4;} } if(KEY_DOWN_NOW(BUTTON_UP)){ delay(10); if (mouse->r<=(UpperLeftRow)){ while(KEY_DOWN_NOW(BUTTON_UP)); menuLogic(); } else{mouse->r-=4;} } if(KEY_DOWN_NOW(BUTTON_RIGHT)){ //while(KEY_DOWN_NOW(BUTTON_RIGHT)); delay(10); if (mouse->c>=(UpperLeftCol+(4*MAXC)-6)){ mouse->c=UpperLeftCol-2; } else{mouse->c+=4;} } if(KEY_DOWN_NOW(BUTTON_LEFT)){ delay(10); //while(KEY_DOWN_NOW(BUTTON_LEFT)); if (mouse->c<=UpperLeftCol){ mouse->c=(UpperLeftCol+(4*MAXC))-6; } else{mouse->c-=4;} } if(KEY_DOWN_NOW(BUTTON_A)){ while(KEY_DOWN_NOW(BUTTON_A)); int rowConversion=((mouse->r-UpperLeftRow+1)/4); int colConversion=((mouse->c-UpperLeftCol+2)/4); if (a[rowConversion][colConversion]) a[rowConversion][colConversion]=0; else a[rowConversion][colConversion]=1; newBoard=1; } drawBoard(); } }
void HDSD() { drawBoard(1,30,78,36,30,"Huong dan",10); textcolor(TRANG); printxy(2,31,"Su dung chuot trai de chon va chuot phai de danh dau"); printxy(2,32,"Su dung cac phim mui ten de di chuyen va : "); printxy(2,33,"X : mo o C : danh dau"); printxy(2,34,"Z : lam noi nhung o xung quanh A : mo nhung o xung quanh"); printxy(2,35,"S : Luu ESC : Thoat R : Quay lai man hinh chinh"); }
int main(void) { titleScreen(); initBoard(); drawBoard(); VDP_fillTileMapRectInc(VDP_PLAN_A, TILE_ATTR_FULL(PAL3, PRIORITY_LOW, FALSE, FALSE, TILE_USERINDEX + 20), 32, 0, 5, 3); while(1) { VDP_waitVSync(); } return 0; }
void GraphicalBoardFrame::prepare() { drawBoard(m_board); drawMove(m_candidate); if (isOnBoard(m_arrowRoot)) drawArrow(m_arrowRoot, m_arrowDirection); generateBoardPixmap(&m_pixmap); update(); }
int main() { do { initCurses(); drawBoard(); } while (playGame()); endwin(); return(0); }
void initBoard(uint8_t board[SIZE][SIZE]) { uint8_t x,y; for (x=0;x<SIZE;x++) { for (y=0;y<SIZE;y++) { board[x][y]=0; } } addRandom(board); addRandom(board); drawBoard(board); score = 0; }
int main(int argc, char *argv[]){ int x, y, i, j; FILE *file; char iniBoard[MAX_SIZE][MAX_SIZE]; int status[MAX_SIZE][MAX_SIZE]; SDL_Simplewin sw; SDL_Rect rectangle; file = NULL; Neill_SDL_Init(&sw); initial(iniBoard, status); file = fopen(argv[1], "r"); /* fopen returns NULL pointer on failure */ if (file == NULL){ printf("Could not open file. \n"); } else { printf("File (%s) opened. \n", argv[1]); fscanf(file, "%d %d", &x, &y); printf("Row: %d Column: %d \n", x, y); char board[y][x]; if(fgetc(file) != EOF){ for(j = 0; j < y; j++){ for(i = 0; i < x + 1; i++){ board[j][i] = fgetc(file); } } } /* Closing file */ fclose(file); /* Input the board which read from the txt file to a 50x50 board*/ inputBoard(x, y, board, iniBoard); do{ /* Sleep for a short time */ SDL_Delay(MILLISECONDDELAY); SDL_RenderClear(sw.renderer); /* Draw the actual board */ drawBoard(iniBoard, sw, rectangle, x, y); /* Update window */ SDL_RenderPresent(sw.renderer); SDL_UpdateWindowSurface(sw.win); /* Get the neighbours' status */ getNeighbours(x, y, iniBoard, status); /* Calculate next generation */ nextGen(x, y, iniBoard, status); Neill_SDL_Events(&sw); }while(!sw.finished); /* Clear up graphics subsystems */ atexit(SDL_Quit); } return 0; }
int main() { setupGame(); addLength(); addLength(); drawBoard(); drawFood(); Game(); getchar(); }
XP_Bool board_draw( BoardCtxt* board ) { if ( board->boardBounds.width > 0 ) { drawScoreBoard( board ); drawTray( board ); drawBoard( board ); } return !board->needsDrawing; } /* board_draw */
void draw(void){ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); gluLookAt(0,25,15, 0,0,0, 0,1,0); glLightfv(GL_LIGHT0,GL_POSITION,lpos); glLoadName(99); drawBoard(); drawGrid(); drawPieces(); glutSwapBuffers(); }
void Field::randomize() { // Fisher-Yates for(int i = 7*7 - 1;i >= 1;i--) { int j = rand()%i; int temp = board[i%7][i/7]; board[i%7][i/7] = board[j%7][j/7]; board[j%7][j/7] = temp; } drawBoard(); }