libresman

changeset 16:0a789208498d

fixed resman.def added debug mode in thumbs.c
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 11 Feb 2014 18:47:33 +0200
parents a42888d26839
children 43a9fe4a80ee
files examples/imgthumbs/src/main.c examples/imgthumbs/src/thumbs.c libresman.sln resman.def
diffstat 4 files changed, 24 insertions(+), 20 deletions(-) [+]
line diff
     1.1 --- a/examples/imgthumbs/src/main.c	Sat Feb 08 07:41:39 2014 +0200
     1.2 +++ b/examples/imgthumbs/src/main.c	Tue Feb 11 18:47:33 2014 +0200
     1.3 @@ -9,7 +9,7 @@
     1.4  static int init(void);
     1.5  static void cleanup(void);
     1.6  static void display(void);
     1.7 -/*static void idle(void);*/
     1.8 +static void idle(void);
     1.9  static void reshape(int x, int y);
    1.10  static void keyb(unsigned char key, int x, int y);
    1.11  static void mouse(int bn, int st, int x, int y);
    1.12 @@ -40,7 +40,7 @@
    1.13  	glutCreateWindow("imgthumbs");
    1.14  
    1.15  	glutDisplayFunc(display);
    1.16 -	glutIdleFunc(glutPostRedisplay);
    1.17 +	glutIdleFunc(idle);
    1.18  	glutReshapeFunc(reshape);
    1.19  	glutKeyboardFunc(keyb);
    1.20  	glutMouseFunc(mouse);
    1.21 @@ -105,12 +105,10 @@
    1.22  	assert(glGetError() == GL_NO_ERROR);
    1.23  }
    1.24  
    1.25 -/*
    1.26  static void idle(void)
    1.27  {
    1.28  	glutPostRedisplay();
    1.29  }
    1.30 -*/
    1.31  
    1.32  static void reshape(int x, int y)
    1.33  {
     2.1 --- a/examples/imgthumbs/src/thumbs.c	Sat Feb 08 07:41:39 2014 +0200
     2.2 +++ b/examples/imgthumbs/src/thumbs.c	Tue Feb 11 18:47:33 2014 +0200
     2.3 @@ -9,6 +9,8 @@
     2.4  #include "thumbs.h"
     2.5  #include "resman.h"
     2.6  
     2.7 +#define DBG_SYNC
     2.8 +
     2.9  #ifndef GL_COMPRESSED_RGB
    2.10  #define GL_COMPRESSED_RGB	0x84ed
    2.11  #endif
    2.12 @@ -27,12 +29,6 @@
    2.13  	/* allocate dummy head node */
    2.14  	struct thumbnail *list = calloc(1, sizeof *list);
    2.15  
    2.16 -	/*unsigned int intfmt = GL_COMPRESSED_RGB;
    2.17 -	if(!strstr((char*)glGetString(GL_EXTENSIONS), "GL_ARB_texture_compression")) {
    2.18 -		printf("warning, no texture compression available.\n");
    2.19 -		intfmt = GL_RGB;
    2.20 -	}*/
    2.21 -
    2.22  	if(!texman) {
    2.23  		texman = resman_create();
    2.24  		resman_set_load_func(texman, load_res_texture, 0);
    2.25 @@ -46,8 +42,10 @@
    2.26  	}
    2.27  
    2.28  	while((dent = readdir(dir))) {
    2.29 -		/*int xsz, ysz;
    2.30 -		unsigned char *pixels;*/
    2.31 +#ifdef DBG_SYNC
    2.32 +		int xsz, ysz;
    2.33 +		unsigned char *pixels;
    2.34 +#endif
    2.35  		struct thumbnail *node;
    2.36  
    2.37  		if(!(node = malloc(sizeof *node))) {
    2.38 @@ -66,11 +64,12 @@
    2.39  		}
    2.40  		strcat(node->fname, dent->d_name);
    2.41  
    2.42 -		node->aspect = 1.0;/*(float)xsz / (float)ysz;*/
    2.43 +		node->aspect = 1.0;
    2.44  
    2.45 +#ifndef DBG_SYNC
    2.46  		resman_lookup(texman, node->fname, node);
    2.47 -
    2.48 -		/*if(!(pixels = img_load_pixels(node->fname, &xsz, &ysz, IMG_FMT_RGBA32))) {
    2.49 +#else
    2.50 +		if(!(pixels = img_load_pixels(node->fname, &xsz, &ysz, IMG_FMT_RGBA32))) {
    2.51  			free(node->fname);
    2.52  			free(node);
    2.53  			continue;
    2.54 @@ -82,9 +81,11 @@
    2.55  		glBindTexture(GL_TEXTURE_2D, node->tex);
    2.56  		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    2.57  		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    2.58 -		glTexImage2D(GL_TEXTURE_2D, 0, intfmt, xsz, ysz, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
    2.59 +		glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, xsz, ysz, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
    2.60  		img_free_pixels(pixels);
    2.61 -		*/
    2.62 +
    2.63 +		node->aspect = (float)xsz / (float)ysz;
    2.64 +#endif
    2.65  
    2.66  		node->next = list->next;
    2.67  		node->prev = list;
     3.1 --- a/libresman.sln	Sat Feb 08 07:41:39 2014 +0200
     3.2 +++ b/libresman.sln	Tue Feb 11 18:47:33 2014 +0200
     3.3 @@ -6,6 +6,10 @@
     3.4  Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libresman-static", "libresman-static.vcproj", "{30D59998-59D6-46D6-ADEC-9C716878317D}"
     3.5  EndProject
     3.6  Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "imgthumbs", "examples\imgthumbs\imgthumbs.vcproj", "{022D306F-6002-4EAD-ADF5-5B31BB339791}"
     3.7 +	ProjectSection(ProjectDependencies) = postProject
     3.8 +		{30D59998-59D6-46D6-ADEC-9C716878317D} = {30D59998-59D6-46D6-ADEC-9C716878317D}
     3.9 +		{BCD20CF4-E710-4520-8A51-E29E221D53BA} = {BCD20CF4-E710-4520-8A51-E29E221D53BA}
    3.10 +	EndProjectSection
    3.11  EndProject
    3.12  Global
    3.13  	GlobalSection(SolutionConfigurationPlatforms) = preSolution
     4.1 --- a/resman.def	Sat Feb 08 07:41:39 2014 +0200
     4.2 +++ b/resman.def	Tue Feb 11 18:47:33 2014 +0200
     4.3 @@ -7,8 +7,7 @@
     4.4  	resman_destroy
     4.5  
     4.6  	resman_set_load_func
     4.7 -	resman_set_create_func
     4.8 -	resman_set_update_func
     4.9 +	resman_set_done_func
    4.10  	resman_set_destroy_func
    4.11  
    4.12  	resman_lookup
    4.13 @@ -16,5 +15,7 @@
    4.14  
    4.15  	resman_poll
    4.16  
    4.17 +	resman_get_res_name
    4.18  	resman_set_res_data
    4.19 -	resman_get_res_data
    4.20 \ No newline at end of file
    4.21 +	resman_get_res_data
    4.22 +	resman_get_res_result
    4.23 \ No newline at end of file