Beispiel #1
0
Mino::Mino(int x, int y, bool updatable, MinoType t) : GameObject(x, y), m_updatable(updatable), m_rotNumber(0), m_collided(false), m_type(t)
{
	m_tiles = initPositions(t);
	m_lastTimeUpdated = SDL_GetTicks();
	m_lastTimeWentDown = SDL_GetTicks();
	m_color = colorFromType(t);
}
Beispiel #2
0
int main()
{

    int Nrun = 500;
    initPositions();   
    initVelocities();

    for (int i = 0; i < N; i++)     // creates array of class methane objects
        methr[i];
    std::ofstream file("methane_coords_500_160211.xyz");   
    std::ofstream fileT("methane_temperature_500_160211.txt");

    for (int k = 0; k < Nrun; k++) {
        if (k % 100 == 0)
            std::cout << k << std::endl;
        
        fileT << instantTemp() << std::endl;
        file << 5*N << std::endl;
        file << "blah" << std::endl;

        if (k % 25 == 0) 
            rescaleVelocities();

        for (int j = 0; j < N; j++)     // set methane on lattice point
            methr[j].set_coord(r[j][0], r[j][1], r[j][2]);
                                        //        methane meth;
        for (int j = 0; j < N; j++) {       
            for (int k = 0; k < 5; k++){
                if (k == 0){
                    file << "C ";
                    for (int l = 0; l < 3; l++)
                        file << " " << methr[j].meth_coord[k][l];
                }
                else
                    file << "H ";
                    for (int l = 0; l < 3; l++)
                        file << " " << methr[j].meth_coord[k][l];       
                file << std::endl;
            }
        }        
        velocityVerlet(dt);
    }
    file.close();
    fileT.close();

    return 0;
}
Beispiel #3
0
int main()
{
    std::cout << d << " " << dhh << std::endl;
    initPositions();   
    std::ofstream file("test.txt");
    file << N << " N" << std::endl;
    file << "blah" << std::endl;
    methane meth;
    std::cout << meth.H1[0] << " H10" << std::endl;
    std::cout << meth.H1[1] << " H11" << std::endl;
    std::cout << meth.com[0] << " com0" << std::endl;
    std::cout << meth.com[1] << " com1" << std::endl;
    for (int i = 0; i < N; i++) 
        file << "C " << r[i][0] << " " << r[i][1] << " " << r[i][2] << std::endl;
    
    file.close();

    return 0;
}
int main(int argc, char **argv)
{
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
	glutInitWindowPosition(100, 100);
	glutInitWindowSize(wX, wY);
	glutCreateWindow("GLUT Tutorial");

	initPositions();
	gettimeofday(&last_frame_time, 0);

	glutDisplayFunc(drawFrame);
	glutReshapeFunc(changeSize);
	glutMotionFunc(processMouseMovement);
	glutPassiveMotionFunc(processMouseMovement);
	glutMouseFunc(processMouseClicks);
	glutIdleFunc(drawFrame);
	glutMainLoop();
	return 1;
}
Beispiel #5
0
/* fdp_tLayout:
 * Given graph g with ports nodes, layout g respecting ports.
 * If some node have position information, it may be useful to
 * reset temperature and other parameters to reflect this.
 */
void
fdp_tLayout (graph_t* g, xparams* xpms)
{
  int       i;
  int       reset;
  bport_t*  pp = PORTS(g);
  double    temp;
  Grid*     grid;
  pointf    ctr;
  Agnode_t* n;

  reset = init_params(g, xpms);
  temp = T0;

  ctr = initPositions (g, pp);
  
  if (T_useGrid) {
    grid = mkGrid (agnnodes (g));
    adjustGrid (grid, agnnodes (g));
    for (i = 0; i < loopcnt; i++) {
      temp = cool (temp, i);
      gAdjust (g, temp, pp, grid);
    }
    delGrid (grid);
  }
  else {
    for (i = 0; i < loopcnt; i++) {
      temp = cool (temp, i);
      adjust (g, temp, pp);
    }
  }

  if ((ctr.x != 0.0) || (ctr.y != 0.0)) {
    for (n = agfstnode(g); n; n = agnxtnode(g,n)) {
      ND_pos(n)[0] += ctr.x;
      ND_pos(n)[1] += ctr.y;
    }
  }
dumpstat (g);
  if (reset) reset_params ();
}
Beispiel #6
0
Datei: fy.c Projekt: AndTH/GCA
/*
 * initialize all before processing
 */
void startup(void) {
  // configure the ports
  initIO();

  waitMS(10);

  // test display
  choice = 41;
  updateDisplay();
  waitMS(1000);

  choice   = MAX_TRACKS/2 +1;
  curtrack = choice;

  initPositions();
  updateDisplay();

  // get the permanent power setting from eeprom
  if( !readByte(ADDR_KEEPPOWER) )
    power = POWER_OFF;

  // signal started up
  confirm(4);
}