dungeon_crawler

changeset 26:21999ef6636b

lalala
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 25 Aug 2012 04:07:51 +0300
parents 527fede30057
children cbf86e5198a9
files prototype/src/cmdcon.cc prototype/src/main.cc
diffstat 2 files changed, 17 insertions(+), 6 deletions(-) [+]
line diff
     1.1 --- a/prototype/src/cmdcon.cc	Sat Aug 25 02:16:08 2012 +0300
     1.2 +++ b/prototype/src/cmdcon.cc	Sat Aug 25 04:07:51 2012 +0300
     1.3 @@ -25,6 +25,7 @@
     1.4  		return false;
     1.5  	}
     1.6  
     1.7 +	printf("loading font: %s\n", path);
     1.8  	if(!(font = dtx_open_font(path, 12))) {
     1.9  		fprintf(stderr, "failed to open font file: %s\n", path);
    1.10  		return false;
    1.11 @@ -71,19 +72,25 @@
    1.12  
    1.13  void draw_cmdcon()
    1.14  {
    1.15 +	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    1.16 +
    1.17  	glMatrixMode(GL_PROJECTION);
    1.18  	glPushMatrix();
    1.19  	glLoadIdentity();
    1.20 -	glOrtho(0, cfg.width, -cfg.height, 0, -1, 1);
    1.21 +	//glOrtho(0, cfg.width, cfg.height, 0, -1, 1);
    1.22 +	glOrtho(-cfg.width / 2.0, cfg.width / 2.0, -cfg.height / 2.0, cfg.height / 2.0, -1, 1);
    1.23  	glMatrixMode(GL_MODELVIEW);
    1.24  	glPushMatrix();
    1.25  	glLoadIdentity();
    1.26  
    1.27 +	//glTranslatef(100, 100, 0);
    1.28 +
    1.29  	glPushAttrib(GL_ENABLE_BIT | GL_CURRENT_BIT);
    1.30 -	glEnable(GL_BLEND);
    1.31 +	glUseProgram(0);
    1.32  	glDisable(GL_DEPTH_TEST);
    1.33  	glDisable(GL_LIGHTING);
    1.34 -	glUseProgram(0);
    1.35 +	glDisable(GL_CULL_FACE);
    1.36 +	glEnable(GL_BLEND);
    1.37  	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    1.38  
    1.39  	glBegin(GL_QUADS);
    1.40 @@ -94,8 +101,6 @@
    1.41  	glVertex2f(-10, 10);
    1.42  	glEnd();
    1.43  
    1.44 -	glTranslatef(cfg.width / 2, cfg.height / 2, 0);
    1.45 -
    1.46  	glColor4f(0.2, 0.9, 0.3, 1.0);
    1.47  	dtx_string(cmdline.c_str());
    1.48  	dtx_flush();
     2.1 --- a/prototype/src/main.cc	Sat Aug 25 02:16:08 2012 +0300
     2.2 +++ b/prototype/src/main.cc	Sat Aug 25 04:07:51 2012 +0300
     2.3 @@ -86,6 +86,10 @@
     2.4  		return false;
     2.5  	}
     2.6  
     2.7 +	if(!init_cmdcon()) {
     2.8 +		return false;
     2.9 +	}
    2.10 +
    2.11  	// load a tileset
    2.12  	tileset = new TileSet;
    2.13  	printf("loading tileset: %s\n", cfg.tileset_file);
    2.14 @@ -111,6 +115,8 @@
    2.15  	delete tileset;
    2.16  
    2.17  	destroy_renderer();
    2.18 +
    2.19 +	cleanup_cmdcon();
    2.20  }
    2.21  
    2.22  void idle()
    2.23 @@ -163,7 +169,7 @@
    2.24  
    2.25  void draw()
    2.26  {
    2.27 -	render_deferred(level);
    2.28 +	//render_deferred(level);
    2.29  
    2.30  	if(show_con) {
    2.31  		draw_cmdcon();