コード例 #1
0
ファイル: ROCKET.CPP プロジェクト: randrews/turbo-cpp-code
void main(){char c;
startgraph();
setpalette();
for(int j=0;j!=256;j++)
 directpixel(j,50,j);
//display();
getch();
while(c!='q')
 {
 //cleargfx(0);
 for(int n=199;n>=50;n--)
  {
  if(kbhit())break;
  pixel(n,n,255);
  //directpixel(n,n,255);
  burn();
  display();
  }
 c=getch();
 }
endgraph();
}
コード例 #2
0
ファイル: BOUNCIE.CPP プロジェクト: randrews/turbo-cpp-code
void main(){
init();
//for(int n=0;n!=256;n++)
// pixel(n+50,50,n);
while(!kbhit())
 {
 red.disp(green);
 green.disp(blue);
 blue.disp(white);
 white.disp(red);
 red.colcyc();
 green.colcyc();
 blue.colcyc();
 white.colcyc();
 red.move();
 green.move();
 blue.move();
 white.move();
 display();
 //getch();
 }
endgraph();
}
コード例 #3
0
ファイル: GOL.c プロジェクト: PJensen/GameOfLife
//////////////////////////////////////////////////////////////////////////////
//                         Program Entry Point
int main(int argc, char **argv)
{
    int argNumCells;

    (void) randomize();

    if (argc == 2) {
        // Grab argument, convert to integer; init cells with passed arg.
        argNumCells = (int)atoi((char*)argv[1]);
        (void) initializeCells(argNumCells);

        // Display message, showing # of init'ed cells.
        printf("[Game of Life:] Initialized %d Cells.", argNumCells);

        // Wait a second.
        delay(1000);
    }
    // No arguments were passed? Initialize Default # of cells.
    else {
        (void) initializeCells(INIT_CELLS);
        delay(1000);
    }

    // Initialize 0x13H Graphics Mode, 320x200x256
    (void) initgraph();

    // Display program message, copyright etc.
    (void) displayMessage();

    // Draw a border around the cell area.
    (void) drawShadedBorder();

#ifdef __MOUSE_ENABLED
    (void) ShowMouse();
#endif


    // Enter main loop
    while ( !kbhit() )
    {

//////////////////////////////////////////////////////////////////////////////
// From my general feelings I am guessing that opening a bracket in an #ifdef
// expecting to close that bracket if there is a following #ifdef a few lines
// down is somewhat of a different idea.  This technique allows me to let the
// user click per iteration that they want to see.
#ifdef __MOUSE_ENABLED
        (void)ReadMouse();

        if (MOUSE_BUTTON_1_PRESSED) {
#endif
// Display & Process cells, then wait delay time, Reapeat until
// keystroke is enacted.
            (void) displayCells();
            (void) processCells();

#ifdef __MOUSE_ENABLED
            (void) processCells();
        }                           // <-- END funky idea.
#endif

        // @see #define DELAY_TIME
        (void) delay(DELAY_TIME);
    }

#ifdef __MOUSE_ENABLED
    (void) HideMouse();
#endif

    // End graphics mode.
    (void) endgraph();

    // Exit politely.
    return EXIT_SUCCESS;
}