From: Wolfgang Becker Date: Wed, 10 Jan 2007 18:34:33 +0000 (+0000) Subject: Patch by Klaus Denker: X-Git-Url: https://git.octo.it/?p=supertux.git;a=commitdiff_plain;h=d2440685edc37a6faa6008f9987062a1c44c273c Patch by Klaus Denker: The little lightmap_resolution.patch makes the Level "light+magic" playable at any screen resolution. It fixes a TODO to calculate the correct lightmap-coordinates in the function get_light. SVN-Revision: 4541 --- diff --git a/src/video/drawing_context.cpp b/src/video/drawing_context.cpp index 1b4a4b38f..20e8710b0 100644 --- a/src/video/drawing_context.cpp +++ b/src/video/drawing_context.cpp @@ -273,9 +273,8 @@ DrawingContext::get_light(DrawingRequest& request) for( int i = 0; i<3; i++) pixels[i] = 0.0f; //set to black - float posX = request.pos.x /LIGHTMAP_DIV; - //TODO:this works when playing with 800x600 otherwise posY is wrong - float posY = screen->h - request.pos.y / LIGHTMAP_DIV; + float posX = request.pos.x * lightmap_width / SCREEN_WIDTH; + float posY = screen->h - request.pos.y * lightmap_height / SCREEN_HEIGHT; glReadPixels((GLint) posX, (GLint) posY , 1, 1, GL_RGB, GL_FLOAT, pixels); *(getlightrequest->color_ptr) = Color( pixels[0], pixels[1], pixels[2]); //printf("get_light %f/%f =>%f/%f r%f g%f b%f\n", request.pos.x, request.pos.y, posX, posY, pixels[0], pixels[1], pixels[2]);