ccdemos/common_sdl.h
branchpyrit
changeset 81 9dbb9c8c115b
parent 72 7c3f38dff082
child 89 fcf1487b398b
equal deleted inserted replaced
80:907929fa9b59 81:9dbb9c8c115b
    50 	else
    50 	else
    51 		SDL_UpdateRect(screen, 0, 0, w, h);
    51 		SDL_UpdateRect(screen, 0, 0, w, h);
    52 }
    52 }
    53 
    53 
    54 void loop_sdl(Raytracer &rt, Camera &cam,
    54 void loop_sdl(Raytracer &rt, Camera &cam,
    55 	void (*update_callback)() = NULL, void (*key_callback)(int, int) = NULL)
    55 	void (*update_callback)(Float*) = NULL, void (*key_callback)(int, int) = NULL)
    56 {
    56 {
    57 	SDL_Surface *screen;
    57 	SDL_Surface *screen;
    58 	Float *render_buffer;
    58 	Float *render_buffer;
    59 
    59 
    60 	pyrit_verbosity = 0;
    60 	pyrit_verbosity = 0;
   154 		cam.u.y = 0;
   154 		cam.u.y = 0;
   155 		cam.u.normalize();
   155 		cam.u.normalize();
   156 		if (move != 0.0)
   156 		if (move != 0.0)
   157 			cam.move(move,0,0);
   157 			cam.move(move,0,0);
   158 		if (update_callback != NULL)
   158 		if (update_callback != NULL)
   159 			update_callback();
   159 			update_callback(render_buffer);
   160 		update(rt, screen, render_buffer);
   160 		update(rt, screen, render_buffer);
   161 	}
   161 	}
   162 	free(render_buffer);
   162 	free(render_buffer);
   163 
   163 
   164 	Uint32 fp100s_aver = fp10s_acc*10/fp10s_acc_samples;
   164 	Uint32 fp100s_aver = fp10s_acc*10/fp10s_acc_samples;