ccdemos/common_sdl.h
branchpyrit
changeset 93 96d65f841791
parent 92 9af5c039b678
child 100 c005054bf4c1
equal deleted inserted replaced
92:9af5c039b678 93:96d65f841791
    92 					if (event.key.keysym.sym == SDLK_ESCAPE) {
    92 					if (event.key.keysym.sym == SDLK_ESCAPE) {
    93 						quit = true;
    93 						quit = true;
    94 						break;
    94 						break;
    95 					}
    95 					}
    96 					if (event.key.keysym.sym == SDLK_LEFT) {
    96 					if (event.key.keysym.sym == SDLK_LEFT) {
    97 						roty = +0.01;
    97 						roty = +0.01f;
    98 						break;
    98 						break;
    99 					}
    99 					}
   100 					if (event.key.keysym.sym == SDLK_RIGHT) {
   100 					if (event.key.keysym.sym == SDLK_RIGHT) {
   101 						roty = -0.01;
   101 						roty = -0.01f;
   102 						break;
   102 						break;
   103 					}
   103 					}
   104 					if (event.key.keysym.sym == SDLK_DOWN) {
   104 					if (event.key.keysym.sym == SDLK_DOWN) {
   105 						rotx = +0.01f;
   105 						rotx = +0.01f;
   106 						break;
   106 						break;
   150 			}
   150 			}
   151 		}
   151 		}
   152 		cam.rotate(Quaternion(cos(roty),0,sin(roty),0).normalize());
   152 		cam.rotate(Quaternion(cos(roty),0,sin(roty),0).normalize());
   153 		cam.rotate(Quaternion(cos(rotx),
   153 		cam.rotate(Quaternion(cos(rotx),
   154 			cam.getu()[0]*sin(rotx),0,cam.getu()[2]*sin(rotx)).normalize());
   154 			cam.getu()[0]*sin(rotx),0,cam.getu()[2]*sin(rotx)).normalize());
   155 		//cam.u.y = 0;
       
   156 		//cam.u.normalize();
       
   157 		if (move != 0.0)
   155 		if (move != 0.0)
   158 			cam.move(move,0,0);
   156 			cam.move(move,0,0);
   159 		if (update_callback != NULL)
   157 		if (update_callback != NULL)
   160 			update_callback(render_buffer);
   158 			update_callback(render_buffer);
   161 		update(rt, screen, render_buffer);
   159 		update(rt, screen, render_buffer);