dbf-udg

diff src/udg.cc @ 12:1abbed71e9c9

cleanup, copyright statements and notices, readme files
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 20 Feb 2013 05:45:27 +0200
parents 5f99c4c7a9fe
children 6a836b1dc31b
line diff
     1.1 --- a/src/udg.cc	Wed Feb 20 04:55:03 2013 +0200
     1.2 +++ b/src/udg.cc	Wed Feb 20 05:45:27 2013 +0200
     1.3 @@ -1,3 +1,20 @@
     1.4 +/*
     1.5 +Printblobs - typography display hack
     1.6 +Copyright (C) 2013  John Tsiombikas <nuclear@member.fsf.org>
     1.7 +
     1.8 +This program is free software: you can redistribute it and/or modify
     1.9 +it under the terms of the GNU General Public License as published by
    1.10 +the Free Software Foundation, either version 3 of the License, or
    1.11 +(at your option) any later version.
    1.12 +
    1.13 +This program is distributed in the hope that it will be useful,
    1.14 +but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.15 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.16 +GNU General Public License for more details.
    1.17 +
    1.18 +You should have received a copy of the GNU General Public License
    1.19 +along with this program.  If not, see <http://www.gnu.org/licenses/>.
    1.20 +*/
    1.21  #include <stdio.h>
    1.22  #include <stdlib.h>
    1.23  #include <string.h>
    1.24 @@ -7,7 +24,6 @@
    1.25  #include "udg.h"
    1.26  #include "sdr.h"
    1.27  #include "dither_matrix.h"
    1.28 -#include "scroller.h"
    1.29  #include "mballs.h"
    1.30  #include "dsys.h"
    1.31  #include "post.h"
    1.32 @@ -46,7 +62,7 @@
    1.33  struct render_target *rtarg;
    1.34  unsigned int post_prog, phong_prog;
    1.35  
    1.36 -int opt_highres, opt_regular_render;
    1.37 +int opt_blocky = true, opt_regular_render;
    1.38  bool opt_autorot = true;
    1.39  
    1.40  struct dsys_demo *demo;
    1.41 @@ -138,10 +154,6 @@
    1.42  	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    1.43  	glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, DITHER_SZ, DITHER_SZ * DITHER_LEVELS, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, img);
    1.44  
    1.45 -	if(!init_scroller()) {
    1.46 -		return false;
    1.47 -	}
    1.48 -
    1.49  	if(!mball_init()) {
    1.50  		return false;
    1.51  	}
    1.52 @@ -153,8 +165,8 @@
    1.53  	glEnable(GL_LIGHT1);
    1.54  	glEnable(GL_NORMALIZE);
    1.55  
    1.56 -	//dsys_start(demo);
    1.57  
    1.58 +	reshape(glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT));
    1.59  	return true;
    1.60  }
    1.61  
    1.62 @@ -185,7 +197,6 @@
    1.63  	glPopMatrix();
    1.64  
    1.65  	glPopAttrib();
    1.66 -	/*draw_scroller(glutGet(GLUT_ELAPSED_TIME) / 1000.0); */
    1.67  }
    1.68  
    1.69  void disp()
    1.70 @@ -202,7 +213,7 @@
    1.71  	float auto_angle = sec * 10.0;
    1.72  
    1.73  	int xres, yres;
    1.74 -	if(opt_highres) {
    1.75 +	if(!opt_blocky) {
    1.76  		xres = xsz;
    1.77  		yres = ysz;
    1.78  	} else {
    1.79 @@ -344,13 +355,21 @@
    1.80  		opt_regular_render = !opt_regular_render;
    1.81  		break;
    1.82  
    1.83 -	case 'h':
    1.84 -		opt_highres = !opt_highres;
    1.85 +	case 'b':
    1.86 +		opt_blocky = !opt_blocky;
    1.87  		if(rtarg) {
    1.88  			destroy_rtarg(rtarg);
    1.89  			rtarg = 0;
    1.90  		}
    1.91  		break;
    1.92 +
    1.93 +	case ' ':
    1.94 +		if(dsys_is_running(demo)) {
    1.95 +			dsys_stop(demo);
    1.96 +		} else {
    1.97 +			dsys_start(demo);
    1.98 +		}
    1.99 +		break;
   1.100  	}
   1.101  }
   1.102  
   1.103 @@ -441,8 +460,10 @@
   1.104  bool parse_args(int argc, char **argv)
   1.105  {
   1.106  	for(int i=1; i<argc; i++) {
   1.107 -		if(strcmp(argv[i], "-noblock") == 0) {
   1.108 -			opt_highres = true;
   1.109 +		if(strcmp(argv[i], "-noblocky") == 0) {
   1.110 +			opt_blocky = false;
   1.111 +		} else if(strcmp(argv[i], "-blocky") == 0) {
   1.112 +			opt_blocky = true;
   1.113  		} else if(strcmp(argv[i], "-nodither") == 0) {
   1.114  			opt_regular_render = true;
   1.115  		} else {