//set a cell to dead void Cell::setDead() { this->level = 0; isOccupied = false; //if the game was played in the command-line mode, then do not have to draw the block in the window. if (xw) undraw(); }
void CreatureBrush::draw(BaseMap* map, Tile* tile, void* parameter) { ASSERT(tile); ASSERT(parameter); if(canDraw(map, tile->getPosition())) { undraw(map, tile); if(creature_type) { tile->creature = newd Creature(creature_type); tile->creature->setSpawnTime(*(int*)parameter); } } }
void PHN_Widget::draw_validate() { if ((visible & 0x4) != 0x4) { if (visible & 0x1) { visible |= 0x2; draw(); } else if (visible & 0x2) { visible &= ~0x2; undraw(); } invalidated = false; } }
void LMain::main_loop() { while (true) { undraw(); // Depending on the vsync option, I do either frameskipping or // a set number of logic cycle calculations. if (gloB->screen_vsync) { const unsigned loops = Help::get_timer_ticks_per_draw() + 1; rest(1); while (++tck % loops != 0) calc(); // To not have the program hang when the user changes the vsync // option, set tck here. The following "else" will start working // immediately in the next main_loop() call then. if (!gloB->screen_vsync) tck = Help::timer_ticks; } // If vsync is deactivated, do normal frameskipping: Calculate until // the logic is up to date, then draw. If the computer is slow, several // logic updates will be calcd before the draw. else { while (tck == Help::timer_ticks) { rest(1); // The mouse poll is something I've inserted here against // the Yassin bug. The Yassin bug is when clicks from the user // won't get registered by L++. I hope this helps. hardware.poll_mouse(); } while (tck < Help::timer_ticks) { ++tck; calc(); } } if (exit) break; draw(); } // This gets uncommented only whenever I want to test for exit crashes. // clear_to_color(screen, makecol(0, 0, 128)); // rest(400); }
void Deck::flip_to(GlyphIndex index) { undraw(); card_ = index; }
GraphicBG::~GraphicBG() { if (drawn) undraw(); destroy_bitmap(bg); }
main() { #ifdef DETAILED sz=getmaxy()/2-5; long_sz=sz-18; short_sz=sz/2; #else sz=getmaxy()/2-1; long_sz=sz-2; short_sz=sz/2; #endif cx=getmaxx()/2; cy=getmaxy()/2; printf("%cTime set..\n\n Hours: ",12); gets(hr); k=atoi(hr); printf("\n Minutes: "); scanf("%s",hr); j=atoi(hr); k=k*5+(j/12); if (k<15) k=k+45; else k-=15; if (j<15) j=j+45; else j-=15; clg(); circle(cx,cy,cy,1); #ifdef DETAILED circle(cx,cy,cy-3,1); circle(cx,cy,3,1); #endif for (i=0;i<60;i++) { x=icos(i*6)*sz/256; y=isin(i*6)*sz/256; plot (cx+x,cy+y); } #ifdef DETAILED for (i=0;i<12;i++) { x=isin(i*30)*(sz-8)/256; y=icos(i*30)*(sz-8)/256; putsprite(spr_or, cx+x-5, cy-y-3, roman_nums + i*16 + 7*(i>8)); } #endif x=-1; i=0; tm=clock(); while (getk()!=' ') { tm=clock(); if (i++ == 59) i=0; if (i == 45) { if (x != -1) { // min undraw(cx-1,cy+1,cx+x_min,cy+y_min); undraw(cx+1,cy-1,cx+x_min,cy+y_min); undraw(cx+1,cy+1,cx+x_min,cy+y_min); undraw(cx-1,cy-1,cx+x_min,cy+y_min); } if (j++ == 59) { j=0; } if (j == 45) { if (x != -1) { undraw(cx,cy,cx+x_hr,cy+y_hr); undraw(cx-1,cy+1,cx+x_hr-1,cy+y_hr+1); undraw(cx+1,cy-1,cx+x_hr+1,cy+y_hr-1); undraw(cx+1,cy+1,cx+x_hr+1,cy+y_hr+1); undraw(cx-1,cy-1,cx+x_hr-1,cy+y_hr-1); } if (k++ == 59) k=0; } } if (x != -1) { //sec undraw(cx,cy,cx+x,cy+y); } x=icos(i*6)*long_sz/256; y=isin(i*6)*long_sz/256; x_min=icos(j*6)*long_sz/256; y_min=isin(j*6)*long_sz/256; x_hr=icos(k*6)*short_sz/256; y_hr=isin(k*6)*short_sz/256; // sec draw(cx,cy,cx+x,cy+y); // min draw(cx-1,cy+1,cx+x_min,cy+y_min); draw(cx+1,cy-1,cx+x_min,cy+y_min); draw(cx+1,cy+1,cx+x_min,cy+y_min); draw(cx-1,cy-1,cx+x_min,cy+y_min); // hr draw(cx,cy,cx+x_hr,cy+y_hr); draw(cx-1,cy+1,cx+x_hr-1,cy+y_hr+1); draw(cx+1,cy-1,cx+x_hr+1,cy+y_hr-1); draw(cx+1,cy+1,cx+x_hr+1,cy+y_hr+1); draw(cx-1,cy-1,cx+x_hr-1,cy+y_hr-1); circle(cx,cy,3,1); #ifdef DETAILED circle(cx,cy,5,1); #endif while ((clock() < (tm+CLOCKS_PER_SEC))&&(clock() > CLOCKS_PER_SEC)) {} tm=clock(); } }