void game_init() { clear(); set_palette(1,RGB(255,255,160),0); // light yellow on black // testing vga bits on micro for (int i=0;i<8;i++) { set_palette(2+i,1<<(7-i),0); print_at(20+i,0,2+i,"\x7"); } window(0,2,1,45,4); print_at(14,2,1, " \xf9\xfa\xfb USB TEST "); print_at(5,3,0, " \x01 Hi ! Plug some usb device..."); print_at(2, 6, 1,"Mouse:"); print_at(9, 6, 0,"X= Y= lmr"); print_at(2,PAD_Y-2,1, "Gamepads:"); draw_controller(PAD_X, PAD_Y); draw_controller(PAD_X, PAD_Y2); // analog values print_at(27,PAD_Y-2,1,"Analog pad0:"); window (0,27, PAD_Y, 27+17, PAD_Y+9); // keyboard print_at(2,KB_Y,1,"Keyboard:"); // lowlevel print_at( 2,28,1,"USB Low level:"); print_at(22,29,0,"[0-HS] [1-FS]"); print_at( 2,30,0," Port enabled"); print_at( 2,31,0," Device connected"); print_at( 2,32,0," Device speed"); print_at( 2,33,0," Host status"); print_at( 2,34,0," Host Ctrl State"); print_at( 2,35,0," Transfers In/Out"); print_at( 2,36,0," Data Size In/Out"); cx = cy = 0; }
/* draw the user object */ static int draw_object(int obj_id, double gl_para[16]) { GLfloat mat_ambient[] = { 0.0, 0.0, 1.0, 1.0 }; GLfloat mat_ambient_collide[] = { 1.0, 0.0, 0.0, 1.0 }; GLfloat mat_flash[] = { 0.0, 0.0, 1.0, 1.0 }; GLfloat mat_flash_collide[] = { 1.0, 0.0, 0.0, 1.0 }; GLfloat mat_flash_shiny[] = { 50.0 }; GLfloat light_position[] = { 100.0, -200.0, 200.0, 0.0 }; GLfloat ambi[] = { 0.1, 0.1, 0.1, 0.1 }; GLfloat lightZeroColor[] = { 0.9, 0.9, 0.9, 0.1 }; argDrawMode3D(); argDraw3dCamera(0, 0); glMatrixMode(GL_MODELVIEW); glLoadMatrixd(gl_para); /* set the material */ glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glLightfv(GL_LIGHT0, GL_POSITION, light_position); glLightfv(GL_LIGHT0, GL_AMBIENT, ambi); glLightfv(GL_LIGHT0, GL_DIFFUSE, lightZeroColor); glMaterialfv(GL_FRONT, GL_SHININESS, mat_flash_shiny); switch (obj_id){ case 0: glMaterialfv(GL_FRONT, GL_SPECULAR, mat_flash); glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient); glColor3f(1.0, 2.0, 0.0); //glTranslated(10.0, 20.0, -100.0); draw_scene(); //glTranslated(-10.0, -20.0, 100.0); break; case 1: glMaterialfv(GL_FRONT, GL_SPECULAR, mat_flash); glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient); glColor3f(1.0, 0.0, 0.0); //draw piano left break; case 2: glMaterialfv(GL_FRONT, GL_SPECULAR, mat_flash); glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient); glColor3f(1.0, 2.0, 0.0); draw_controller(distX/4, distY/4); break; } argDrawMode2D(); return 0; }