rayzor

diff src/modeller.cc @ 22:5380ff64e83f

minor changes from dos, and line endings cleanup
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 02 May 2014 14:32:58 +0300
parents 79609d482762
children
line diff
     1.1 --- a/src/modeller.cc	Tue Apr 15 20:52:05 2014 +0300
     1.2 +++ b/src/modeller.cc	Fri May 02 14:32:58 2014 +0300
     1.3 @@ -8,6 +8,7 @@
     1.4  #include "keyb.h"
     1.5  #include "scrman.h"
     1.6  #include "logger.h"
     1.7 +#include "timer.h"
     1.8  
     1.9  struct ModellerImpl {
    1.10  	int mx, my;
    1.11 @@ -18,6 +19,9 @@
    1.12  
    1.13  	bool bnstate[8];
    1.14  	int prev_x, prev_y;
    1.15 +
    1.16 +	float orig_theta;
    1.17 +	bool screensaver;
    1.18  };
    1.19  
    1.20  static void draw_grid(float size, float spacing);
    1.21 @@ -69,6 +73,10 @@
    1.22  
    1.23  void Modeller::draw() const
    1.24  {
    1.25 +	if(mod->screensaver) {
    1.26 +		mod->cam_theta = get_msec() / 100.0f;
    1.27 +	}
    1.28 +
    1.29  	m3d_clear(M3D_COLOR_BUFFER_BIT);
    1.30  
    1.31  	m3d_matrix_mode(M3D_MODELVIEW);
    1.32 @@ -173,6 +181,15 @@
    1.33  			}
    1.34  			break;
    1.35  
    1.36 +		case KB_F1:
    1.37 +			mod->screensaver = !mod->screensaver;
    1.38 +			if(mod->screensaver) {
    1.39 +				mod->orig_theta = mod->cam_theta;
    1.40 +			} else {
    1.41 +				mod->cam_theta = mod->orig_theta;
    1.42 +			}
    1.43 +			break;
    1.44 +
    1.45  		default:
    1.46  			break;
    1.47  		}