Exemplo n.º 1
0
void create_house()
{
  int debx = 412, deby = 494, compt = 0;
  while(compt < 3){
    deby -= 44;
    object wall = create_wall(debx,deby);
    w_house = insert(wall, w_house);
    compt ++;
  }
  compt = 0;
  deby -= 44;
  while(compt < 6){
    object wall = create_ceiling(debx,deby);
    w_house = insert(wall, w_house);
    compt ++;
    debx += 60;
  }
  compt = 0;
  debx -= 60;
  deby += 44;
  while(compt < 3){
    object wall = create_wall(debx,deby);
    w_house = insert(wall, w_house);
    deby += 44;
    compt ++;
  }
  debx = 429;
  deby = 494;
  object door = create_door(debx,deby);
  d_house = insert(door, d_house);
  debx += 300;
  door = create_door(debx,deby);
  d_house = insert(door, d_house);
}
Exemplo n.º 2
0
World::World(int size_x,int size_y) : _physical_world(b2Vec2(0.f, 1.5f)),_x(size_x), _y(size_y)
{

    create_wall(0,0,BOOK_BOX_SIZE,_y*BOOK_BOX_SIZE);
    create_wall(BOOK_BOX_SIZE*(_x+1.2),0,BOOK_BOX_SIZE,_y*BOOK_BOX_SIZE);
    create_wall(0,BOOK_BOX_SIZE*_y,BOOK_BOX_SIZE*(_x+2.2),BOOK_BOX_SIZE);

#ifdef BOOK_DEBUG
    _physical_world.SetDebugDraw(&_debugDraw);
#endif
}
Exemplo n.º 3
0
/*
 * Class:     cbccore_low_Create
 * Method:    create_wall
 * Signature: ()I
 */
JNIEXPORT jint JNICALL Java_cbccore_low_Create_create_1wall(JNIEnv *env, jobject obj)
{
#ifdef CBC
    return create_wall();
#else
    printf("Java_cbccore_low_Create_1wall stub\n");
    return -1;
#endif
}
Exemplo n.º 4
0
Arquivo: create.c Projeto: CBCJVM/cbc
//this function will update the values for many of the sensor globals above
//serial connection failure codes are
// -1:create_mode, -2:create_wall, -3:create_buttons, -4:create_bumpdrop, -5:create_cliffs,
// -6:create_angle, -7:create_distance, -8:create_velocity, -9:create_read_IR 
int create_sensor_update()
{
	int r=0; // if serial connection times out, bit positions give the functions where it occurred
	r=r-2*create_wall();
	r=r-4*create_buttons();
	r=r-8*create_bumpdrop();
	r=r-16*create_cliffs();
	r=r-32*create_angle();
	r=r-64*create_distance();
	r=r-128*create_velocity();
	return(r);
}
Exemplo n.º 5
0
Arquivo: main.c Projeto: ErikHK/tsbk03
/////////////////////////////////////////
//		M A I N
//
int main(int argc, char **argv)
{
	srand(time(NULL));
	mouse_x = 0;
	old_mouse_x = 0;
	mouse_y = 0;
	old_mouse_y = 0;

	m_angle = -300*M_PI; //FOULHACK!


	glutInit(&argc, argv);


	initKeymapManager();
	glutPassiveMotionFunc(mouse);

	//glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
	glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GL_MULTISAMPLE);
	glutInitWindowSize(800, 600);
	glutInitContextVersion(3, 2); // Might not be needed in Linux
	glutCreateWindow("Farm Escape");
	glutDisplayFunc(DisplayWindow);

	create_floor(&f);
	//create_plank(&p, SetVector(4,4,0), SetVector(0,5,0));
	create_fence(&ff, 14, SetVector(0,0,0));
	//f.model = generate_terrain(32);
	create_ball(&ball, SetVector(5,0,0));
	create_wall(&wall, SetVector(0,10,0), SetVector(2,5,2));

	create_joint(&legbase_joint[0], SetVector(-2.2, 3.8, .7), 
	"legjoint0", "legcurrpos0", "legbonepos0", 0);
	create_joint(&legbase_joint[1], SetVector(-2.2, 3.8, -.7),
	"legjoint1", "legcurrpos1", "legbonepos1", 0);
	create_joint(&legbase_joint[2], SetVector(.2, 3.9, -.7),
	"legjoint2", "legcurrpos2", "legbonepos2", 0);
	create_joint(&legbase_joint[3], SetVector(.2, 3.9, .7),
	"legjoint3", "legcurrpos3", "legbonepos3", 0);

	create_joint(&thigh_joint[0], SetVector(-2.3, 1.8, .4),
	NULL, NULL, NULL, 0);
	create_joint(&thigh_joint[1], SetVector(-2.3, 1.8, -.4),
	NULL, NULL, NULL, 0);
	create_joint(&thigh_joint[2], SetVector(.1, 2, -.4),
	NULL, NULL, NULL, 0);
	create_joint(&thigh_joint[3], SetVector(.1, 2.0, .4),
	NULL, NULL, NULL, 0);

	create_joint(&knee_joint[0], SetVector(-2.6, .9, .4),
	NULL, NULL, NULL, 0);
	create_joint(&knee_joint[1], SetVector(-2.6, .9, -.4),
	NULL, NULL, NULL, 0);
	create_joint(&knee_joint[2], SetVector(.4, .9, -.4),
	NULL, NULL, NULL, 0);
	create_joint(&knee_joint[3], SetVector(.4, .9, .4),
	NULL, NULL, NULL, 0);
	create_joint(&foot_joint[0], SetVector(-2.75, 0, .4),
	NULL, NULL, NULL, 0);
	create_joint(&foot_joint[1], SetVector(-2.75, 0, -.4),
	NULL, NULL, NULL, 0);
	create_joint(&foot_joint[2], SetVector(.34, 0, -.4),
	NULL, NULL, NULL, 0);
	create_joint(&foot_joint[3], SetVector(.34, 0, .4),
	NULL, NULL, NULL, 0);


	//BODY JOINTS
	create_joint(&body_joint[0], SetVector(-1.8, 3.6, 0),
	"bodyjoint", "bodycurrpos", "bodybonepos", 0);
	create_joint(&body_joint[1], SetVector(-1, 3.3, 0),
	NULL, NULL, NULL, 0);
	create_joint(&body_joint[2], SetVector(.14, 3.9, 0),
	NULL, NULL, NULL, 0);


	//TAIL JOINTS
	create_joint(&tail_joint[0], SetVector(.7+.3, 3.75, 0),
	"tailjoint", "tailcurrpos", "tailbonepos", 0);
	create_joint(&tail_joint[1], SetVector(2.2, 3.8, 0),
	NULL, NULL, NULL, 0);
	create_joint(&tail_joint[2], SetVector(3.0, 3.75, 0),
	NULL, NULL, NULL, 0);
	create_joint(&tail_joint[3], SetVector(3.9, 3.65, 0),
	NULL, NULL, NULL, 0);

	//HEAD JOINTS
	create_joint(&head_joint[0], SetVector(-2.9, 3.2, 0),
	"headjoint", "headcurrpos", "headbonepos", 0);
	create_joint(&head_joint[1], SetVector(-3.85, 4, 0),
	NULL, NULL, NULL, 0);
	create_joint(&head_joint[2], SetVector(-4.7, 3, 0),
	NULL, NULL, NULL, 0);

	//EAR JOINTS
	//create_joint(&left_ear_joint[0], SetVector(-2.9, 3.2, -.4),
	//"leftearjoint", "leftearcurrpos", "leftearbonepos", 0);
	create_joint(&left_ear_joint[0], SetVector(-2.9, 3.2, .6),
	NULL, NULL, NULL, 0);
	create_joint(&right_ear_joint[0], SetVector(-2.9, 3.2, -.6),
	NULL, NULL, NULL, 0);
	//create_joint(&left_ear_joint[1], SetVector(-2.9, 3.2, .6),
	//NULL, NULL, NULL, 0);
	//create_joint(&right_ear_joint[1], SetVector(-2.9, 3.2, -.6),
	//NULL, NULL, NULL, 0);

	//create_joint(&right_ear_joint[0], SetVector(-2.9, 3.2, -.6),
	//"rightearjoint", "rightearcurrpos", "rightearbonepos", 0);

	//create_joint(&right_ear_joint[1], SetVector(-2.9, 3.2, -.8),
	//"rightearjoint", "rightearcurrpos", "rightearbonepos", 0);


	//SET CHILDREN!
	body_joint[0].child[0] = &body_joint[1];
	body_joint[1].child[0] = &body_joint[2];
	body_joint[2].child[0] = &tail_joint[0];
	body_joint[2].child[1] = &legbase_joint[2];
	body_joint[2].child[2] = &legbase_joint[3];

	tail_joint[0].child[0] = &tail_joint[1];
	tail_joint[1].child[0] = &tail_joint[2];
	tail_joint[2].child[0] = &tail_joint[3];
	tail_joint[3].child[0] = NULL;

	head_joint[0].child[0] = &head_joint[1];
	head_joint[1].child[0] = &head_joint[2];
	head_joint[2].child[0] = NULL;
	//head_joint[2].child[0] = &right_ear_joint[1];
	head_joint[2].child[1] = &left_ear_joint[0];
	head_joint[2].child[2] = &right_ear_joint[0];

	//left_ear_joint[0].child[0] = &left_ear_joint[1];
	//right_ear_joint[0].child[0] = &right_ear_joint[1];

	//left_ear_joint[1].child[0] = NULL;
	//right_ear_joint[1].child[0] = NULL;

	//head_joint[0].child = &legbase_joint[0];
	int i;
        for(i=0;i<4;i++)
	{
	  legbase_joint[i].child[0] = &thigh_joint[i];
	  thigh_joint[i].child[0] = &knee_joint[i];
	  knee_joint[i].child[0] = &foot_joint[i];
	  foot_joint[i].child[0] = NULL;
	}

	//SET PARENTS
	legbase_joint[2].parent = &body_joint[2];
	legbase_joint[3].parent = &body_joint[2];

	//left_ear_joint[1].parent = &left_ear_joint[0];
	left_ear_joint[0].parent = &head_joint[2];

	//right_ear_joint[1].parent = &right_ear_joint[0];
	right_ear_joint[0].parent = &head_joint[2];


	create_cow(&cow);
	create_farmer(&farmer, SetVector(0,0,0));

	create_ragdoll(&ragdoll);

	g_shader = loadShaders("shader.vert" , "shader.frag");
	glUseProgram(g_shader);

	// Set up depth buffer
	glEnable(GL_DEPTH_TEST);

	//glEnable (GL_BLEND);
	//glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

	// initiering
//#ifdef WIN32
//	glewInit();
//#endif

	//glutSetCursor(0);

	//terr = generate_terrain(512);


	glutTimerFunc(20, &OnTimer, 0);

	glutMainLoop();
	exit(0);
}